AWS code-library documentation change
Summary
Removed Amazon Titan Text documentation and code examples, leaving only Amazon Nova content
Security assessment
The changes remove documentation for Amazon Titan Text model usage but show no evidence of addressing security vulnerabilities. This appears to be routine documentation cleanup rather than security-related modification.
Diff
diff --git a/code-library/latest/ug/kotlin_1_bedrock-runtime_code_examples.md b/code-library/latest/ug/kotlin_1_bedrock-runtime_code_examples.md index 9b63908c8..e74c5a9db 100644 --- a//code-library/latest/ug/kotlin_1_bedrock-runtime_code_examples.md +++ b//code-library/latest/ug/kotlin_1_bedrock-runtime_code_examples.md @@ -5 +5 @@ -Amazon NovaAmazon Titan Text +Amazon Nova @@ -19,2 +18,0 @@ Each example includes a link to the complete source code, where you can find ins - * Amazon Titan Text - @@ -195,100 +192,0 @@ Send a text message to Amazon Nova using Bedrock's Converse API and process the -## Amazon Titan Text - -The following code example shows how to send a text message to Amazon Titan Text, using the Invoke Model API. - -**SDK for Kotlin** - - -###### Note - -There's more on GitHub. Find the complete example and learn how to set up and run in the [AWS Code Examples Repository](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/kotlin/services/bedrock-runtime#code-examples). - -Use the Invoke Model API to generate a short story. - - - import aws.sdk.kotlin.services.bedrockruntime.BedrockRuntimeClient - import aws.sdk.kotlin.services.bedrockruntime.model.InvokeModelRequest - import kotlinx.serialization.Serializable - import kotlinx.serialization.json.Json - - /** - * This example demonstrates how to use the Amazon Titan foundation models to generate text. - * It shows how to: - * - Set up the Amazon Bedrock runtime client - * - Create a request payload - * - Configure and send a request - * - Process the response - */ - suspend fun main() { - invokeModel().also { println(it) } - } - - // Data class for parsing the model's response - @Serializable - private data class BedrockResponse(val results: List<Result>) { - @Serializable - data class Result( - val outputText: String, - ) - } - - // Initialize JSON parser with relaxed configuration - private val json = Json { ignoreUnknownKeys = true } - - suspend fun invokeModel(): String { - // Create and configure the Bedrock runtime client - BedrockRuntimeClient { region = "us-east-1" }.use { client -> - - // Specify the model ID. For the latest available models, see: - // https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html - val modelId = "amazon.titan-text-lite-v1" - - // Create the request payload with optional configuration parameters - // For detailed parameter descriptions, see: - // https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-titan-text.html - val prompt = "Describe the purpose of a 'hello world' program in one line." - val request = """ - { - "inputText": "$prompt", - "textGenerationConfig": { - "maxTokenCount": 500, - "temperature": 0.5 - } - } - """.trimIndent() - - // Send the request and process the model's response - runCatching { - // Send the request to the model - val response = client.invokeModel( - InvokeModelRequest { - this.modelId = modelId - body = request.toByteArray() - }, - ) - - // Convert the response bytes to a JSON string - val jsonResponse = response.body.toString(Charsets.UTF_8) - - // Parse the JSON into a Kotlin object - val parsedResponse = json.decodeFromString<BedrockResponse>(jsonResponse) - - // Extract and return the generated text - return parsedResponse.results.firstOrNull()!!.outputText - }.getOrElse { error -> - error.message?.let { msg -> - System.err.println("ERROR: Can't invoke '$modelId'. Reason: $msg") - } - throw RuntimeException("Failed to generate text with model $modelId", error) - } - } - } - - - - - * For API details, see [InvokeModel](https://sdk.amazonaws.com/kotlin/api/latest/index.html) in _AWS SDK for Kotlin API reference_. - - - -