AWS Security ChangesHomeSearch

AWS bedrock documentation change

Service: bedrock · 2025-10-10 · Documentation low

File: bedrock/latest/userguide/service_code_examples_bedrock-runtime.md

Summary

Removed Python code examples for InvokeModel/Converse operations and deleted references to multiple example sections

Security assessment

The changes remove general code examples and documentation links about using Bedrock runtime operations. There is no mention of security vulnerabilities, security configurations, or security best practices in the removed content. This appears to be routine documentation cleanup of implementation examples rather than security-related changes.

Diff

diff --git a/bedrock/latest/userguide/service_code_examples_bedrock-runtime.md b/bedrock/latest/userguide/service_code_examples_bedrock-runtime.md
index a6082b83e..628938f5c 100644
--- a//bedrock/latest/userguide/service_code_examples_bedrock-runtime.md
+++ b//bedrock/latest/userguide/service_code_examples_bedrock-runtime.md
@@ -226,181 +225,0 @@ There's more on GitHub. Find the complete example and learn how to set up and ru
-Python
-    
-
-**SDK for Python (Boto3)**
-    
-
-###### 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/python/example_code/bedrock-runtime#code-examples). 
-
-Send a prompt to a model with the InvokeModel operation.
-    
-    
-    """
-    Uses the Amazon Bedrock runtime client InvokeModel operation to send a prompt to a model.
-    """
-    import logging
-    import json
-    import boto3
-    
-    
-    from botocore.exceptions import ClientError
-    
-    
-    logging.basicConfig(level=logging.INFO)
-    logger = logging.getLogger(__name__)
-    
-    
-    def invoke_model(brt, model_id, prompt):
-        """
-        Invokes the specified model with the supplied prompt.
-        param brt: A bedrock runtime boto3 client
-        param model_id: The model ID for the model that you want to use.
-        param prompt: The prompt that you want to send to the model.
-    
-        :return: The text response from the model.
-        """
-    
-        # Format the request payload using the model's native structure.
-        native_request = {
-            "inputText": prompt,
-            "textGenerationConfig": {
-                "maxTokenCount": 512,
-                "temperature": 0.5,
-                "topP": 0.9
-            }
-        }
-    
-        # Convert the native request to JSON.
-        request = json.dumps(native_request)
-    
-        try:
-            # Invoke the model with the request.
-            response = brt.invoke_model(modelId=model_id, body=request)
-    
-            # Decode the response body.
-            model_response = json.loads(response["body"].read())
-    
-            # Extract and print the response text.
-            response_text = model_response["results"][0]["outputText"]
-            return response_text
-    
-        except (ClientError, Exception) as e:
-            print(f"ERROR: Can't invoke '{model_id}'. Reason: {e}")
-            raise
-    
-    
-    def main():
-        """Entry point for the example. Uses the AWS SDK for Python (Boto3)
-        to create an Amazon Bedrock runtime client. Then sends a prompt to a model
-        in the region set in the callers profile and credentials.
-        """
-    
-        # Create an Amazon Bedrock Runtime client.
-        brt = boto3.client("bedrock-runtime")
-    
-        # Set the model ID, e.g., Amazon Titan Text G1 - Express.
-        model_id = "amazon.titan-text-express-v1"
-    
-        # Define the prompt for the model.
-        prompt = "Describe the purpose of a 'hello world' program in one line."
-    
-        # Send the prompt to the model.
-        response = invoke_model(brt, model_id, prompt)
-    
-        print(f"Response: {response}")
-    
-        logger.info("Done.")
-    
-    
-    if __name__ == "__main__":
-        main()
-    
-    
-    
-
-Send a user message to a model with the Converse operation.
-    
-    
-    """
-    Uses the Amazon Bedrock runtime client Converse operation to send a user message to a model.
-    """
-    import logging
-    import boto3
-    
-    from botocore.exceptions import ClientError
-    
-    
-    logging.basicConfig(level=logging.INFO)
-    logger = logging.getLogger(__name__)
-    
-    
-    def converse(brt, model_id, user_message):
-        """
-        Uses the Converse operation to send a user message to the supplied model.
-        param brt: A bedrock runtime boto3 client
-        param model_id: The model ID for the model that you want to use.
-        param user message: The user message that you want to send to the model.
-    
-        :return: The text response from the model.
-        """
-    
-        # Format the request payload using the model's native structure.
-        conversation = [
-        {
-            "role": "user",
-            "content": [{"text": user_message}],
-        }
-    ]
-    
-        try:
-            # Send the message to the model, using a basic inference configuration.
-            response = brt.converse(
-                modelId=model_id,
-                messages=conversation,
-                inferenceConfig={"maxTokens": 512, "temperature": 0.5, "topP": 0.9},
-            )
-    
-            # Extract and print the response text.
-            response_text = response["output"]["message"]["content"][0]["text"]
-            return response_text
-    
-        except (ClientError, Exception) as e:
-            print(f"ERROR: Can't invoke '{model_id}'. Reason: {e}")
-            raise
-    
-    
-    def main():
-        """Entry point for the example. Uses the AWS SDK for Python (Boto3)
-        to create an Amazon Bedrock runtime client. Then sends a user message to a model
-        in the region set in the callers profile and credentials.
-        """
-    
-        # Create an Amazon Bedrock Runtime client.
-        brt = boto3.client("bedrock-runtime")
-    
-        # Set the model ID, e.g., Amazon Titan Text G1 - Express.
-        model_id = "amazon.titan-text-express-v1"
-    
-        # Define the message for the model.
-        message = "Describe the purpose of a 'hello world' program in one line."
-    
-        # Send the message to the model.
-        response = converse(brt, model_id, message)
-    
-        print(f"Response: {response}")
-    
-        logger.info("Done.")
-    
-    
-    if __name__ == "__main__":
-        main()
-    
-    
-    
-
-  * For API details, see [InvokeModel](https://docs.aws.amazon.com/goto/boto3/bedrock-runtime-2023-09-30/InvokeModel) in _AWS SDK for Python (Boto3) API Reference_. 
-
-
-
-
@@ -451,4 +269,0 @@ Send a user message to a model with the Converse operation.
-    * [Converse](./bedrock-runtime_example_bedrock-runtime_Converse_AmazonTitanText_section.html)
-
-    * [ConverseStream](./bedrock-runtime_example_bedrock-runtime_ConverseStream_AmazonTitanText_section.html)
-
@@ -457,2 +271,0 @@ Send a user message to a model with the Converse operation.
-    * [InvokeModelWithResponseStream](./bedrock-runtime_example_bedrock-runtime_InvokeModelWithResponseStream_TitanText_section.html)
-
@@ -491,2 +303,0 @@ Send a user message to a model with the Converse operation.
-    * [InvokeModel: Command and Command Light](./bedrock-runtime_example_bedrock-runtime_InvokeModel_CohereCommand_section.html)
-
@@ -495,2 +305,0 @@ Send a user message to a model with the Converse operation.
-    * [InvokeModelWithResponseStream: Command and Command Light](./bedrock-runtime_example_bedrock-runtime_InvokeModelWithResponseStream_CohereCommand_section.html)
-