AWS Security ChangesHomeSearch

AWS bedrock documentation change

Service: bedrock · 2026-05-13 · Documentation low

File: bedrock/latest/userguide/conversation-inference-examples.md

Summary

Moved all content to a new page and replaced with redirection notice

Security assessment

This change purely relocates documentation content to a new page without modifying security-related content. There is no evidence of security vulnerability fixes, security incident references, or new security documentation.

Diff

diff --git a/bedrock/latest/userguide/conversation-inference-examples.md b/bedrock/latest/userguide/conversation-inference-examples.md
index c27d8aef3..3ea7fbaf1 100644
--- a//bedrock/latest/userguide/conversation-inference-examples.md
+++ b//bedrock/latest/userguide/conversation-inference-examples.md
@@ -7 +7 @@
-# Converse API examples
+# Converse API examples (moved)
@@ -9,632 +9 @@
-The following examples show you how to use the `Converse` and `ConverseStream` operations.
-
-Text
-    
-
-This example shows how to call the `Converse` operation with the _Anthropic Claude 3 Sonnet_ model. The example shows how to send the input text, inference parameters, and additional parameters that are unique to the model. The code starts a conversation by asking the model to create a list of songs. It then continues the conversation by asking that the songs are by artists from the United Kingdom.
-    
-    
-    # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
-    # SPDX-License-Identifier: Apache-2.0
-    """
-    Shows how to use the <noloc>Converse</noloc> API with Anthropic Claude 3 Sonnet (on demand).
-    """
-    
-    import logging
-    import boto3
-    
-    from botocore.exceptions import ClientError
-    
-    
-    logger = logging.getLogger(__name__)
-    logging.basicConfig(level=logging.INFO)
-    
-    
-    def generate_conversation(bedrock_client,
-                              model_id,
-                              system_prompts,
-                              messages):
-        """
-        Sends messages to a model.
-        Args:
-            bedrock_client: The Boto3 Bedrock runtime client.
-            model_id (str): The model ID to use.
-            system_prompts (JSON) : The system prompts for the model to use.
-            messages (JSON) : The messages to send to the model.
-    
-        Returns:
-            response (JSON): The conversation that the model generated.
-    
-        """
-    
-        logger.info("Generating message with model %s", model_id)
-    
-        # Inference parameters to use.
-        temperature = 0.5
-        top_k = 200
-    
-        # Base inference parameters to use.
-        inference_config = {"temperature": temperature}
-        # Additional inference parameters to use.
-        additional_model_fields = {"top_k": top_k}
-    
-        # Send the message.
-        response = bedrock_client.converse(
-            modelId=model_id,
-            messages=messages,
-            system=system_prompts,
-            inferenceConfig=inference_config,
-            additionalModelRequestFields=additional_model_fields
-        )
-    
-        # Log token usage.
-        token_usage = response['usage']
-        logger.info("Input tokens: %s", token_usage['inputTokens'])
-        logger.info("Output tokens: %s", token_usage['outputTokens'])
-        logger.info("Total tokens: %s", token_usage['totalTokens'])
-        logger.info("Stop reason: %s", response['stopReason'])
-    
-        return response
-    
-    def main():
-        """
-        Entrypoint for Anthropic Claude 3 Sonnet example.
-        """
-    
-        logging.basicConfig(level=logging.INFO,
-                            format="%(levelname)s: %(message)s")
-    
-        model_id = "anthropic.claude-3-sonnet-20240229-v1:0"
-    
-        # Setup the system prompts and messages to send to the model.
-        system_prompts = [{"text": "You are an app that creates playlists for a radio station that plays rock and pop music. Only return song names and the artist."}]
-        message_1 = {
-            "role": "user",
-            "content": [{"text": "Create a list of 3 pop songs."}]
-        }
-        message_2 = {
-            "role": "user",
-            "content": [{"text": "Make sure the songs are by artists from the United Kingdom."}]
-        }
-        messages = []
-    
-        try:
-    
-            bedrock_client = boto3.client(service_name='bedrock-runtime')
-    
-            # Start the conversation with the 1st message.
-            messages.append(message_1)
-            response = generate_conversation(
-                bedrock_client, model_id, system_prompts, messages)
-    
-            # Add the response message to the conversation.
-            output_message = response['output']['message']
-            messages.append(output_message)
-    
-            # Continue the conversation with the 2nd message.
-            messages.append(message_2)
-            response = generate_conversation(
-                bedrock_client, model_id, system_prompts, messages)
-    
-            output_message = response['output']['message']
-            messages.append(output_message)
-    
-            # Show the complete conversation.
-            for message in messages:
-                print(f"Role: {message['role']}")
-                for content in message['content']:
-                    print(f"Text: {content['text']}")
-                print()
-    
-        except ClientError as err:
-            message = err.response['Error']['Message']
-            logger.error("A client error occurred: %s", message)
-            print(f"A client error occured: {message}")
-    
-        else:
-            print(
-                f"Finished generating text with model {model_id}.")
-    
-    
-    if __name__ == "__main__":
-        main()
-    
-
-Image
-    
-
-This example shows how to send an image as part of a message and requests that the model describe the image. The example uses `Converse` operation and the _Anthropic Claude 3 Sonnet_ model. 
-    
-    
-    # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
-    # SPDX-License-Identifier: Apache-2.0
-    """
-    Shows how to send an image with the <noloc>Converse</noloc> API with an accompanying text prompt to Anthropic Claude 3 Sonnet (on demand).
-    """
-    
-    import logging
-    import boto3
-    
-    
-    from botocore.exceptions import ClientError
-    
-    
-    logger = logging.getLogger(__name__)
-    logging.basicConfig(level=logging.INFO)
-    
-    
-    def generate_conversation(bedrock_client,
-                              model_id,
-                              input_text,
-                              input_image):
-        """
-        Sends a message to a model.
-        Args:
-            bedrock_client: The Boto3 Bedrock runtime client.
-            model_id (str): The model ID to use.
-            input text : The text prompt accompanying the image.
-            input_image : The path to the input image.
-    
-        Returns:
-            response (JSON): The conversation that the model generated.
-    
-        """
-    
-        logger.info("Generating message with model %s", model_id)
-    
-        # Get image extension and read in image as bytes
-        image_ext = input_image.split(".")[-1]
-        with open(input_image, "rb") as f:
-            image = f.read()
-    
-        message = {
-            "role": "user",
-            "content": [
-                {
-                    "text": input_text
-                },
-                {
-                    "image": {
-                        "format": image_ext,
-                        "source": {
-                            "bytes": image