AWS bedrock documentation change
Summary
Updated code examples from Amazon Titan Text G1 - Express to Amazon Nova Micro model, changing model IDs and API request/response structures to use newer message-based format.
Security assessment
This is a routine documentation update reflecting model version changes and API evolution. No security vulnerabilities, fixes, or security features are mentioned or documented.
Diff
diff --git a/bedrock/latest/userguide/getting-started-api-ex-python.md b/bedrock/latest/userguide/getting-started-api-ex-python.md index 08adc5fb3..7b1af8a72 100644 --- a//bedrock/latest/userguide/getting-started-api-ex-python.md +++ b//bedrock/latest/userguide/getting-started-api-ex-python.md @@ -102 +102 @@ The following example runs the [InvokeModel](https://docs.aws.amazon.com/bedrock - # Use the native inference API to send a text message to Amazon Titan Text G1 - Express. + # Use the native inference API to send a text message to Amazon Nova Micro. @@ -112,2 +112,2 @@ The following example runs the [InvokeModel](https://docs.aws.amazon.com/bedrock - # Set the model ID, e.g., Amazon Titan Text G1 - Express. - model_id = "amazon.titan-text-express-v1" + # Set the model ID, e.g., Amazon Nova Micro. + model_id = "amazon.nova-micro-v1:0" @@ -120,3 +120,8 @@ The following example runs the [InvokeModel](https://docs.aws.amazon.com/bedrock - "inputText": prompt, - "textGenerationConfig": { - "maxTokenCount": 512, + "messages": [ + { + "role": "user", + "content": [{"text": prompt}] + } + ], + "inferenceConfig": { + "maxTokens": 512, @@ -143 +148 @@ The following example runs the [InvokeModel](https://docs.aws.amazon.com/bedrock - response_text = model_response["results"][0]["outputText"] + response_text = model_response["output"]["message"]["content"][0]["text"] @@ -153 +159 @@ The following example runs the [Converse](https://docs.aws.amazon.com/bedrock/la - # Use the Conversation API to send a text message to Amazon Titan Text G1 - Express. + # Use the Conversation API to send a text message to Amazon Nova Micro. @@ -161,2 +167,2 @@ The following example runs the [Converse](https://docs.aws.amazon.com/bedrock/la - # Set the model ID, e.g., Amazon Titan Text G1 - Express. - model_id = "amazon.titan-text-express-v1" + # Set the model ID, e.g., Amazon Nova Micro. + model_id = "amazon.nova-micro-v1:0"