AWS Security ChangesHomeSearch

AWS code-library documentation change

Service: code-library · 2025-07-16 · Documentation low

File: code-library/latest/ug/python_3_bedrock-runtime_code_examples.md

Summary

Removed references to AI21 Labs Jurassic-2 model and deleted associated code examples for Converse and Invoke Model APIs

Security assessment

The changes remove documentation for a specific model but contain no security context, vulnerability references, or security feature modifications

Diff

diff --git a/code-library/latest/ug/python_3_bedrock-runtime_code_examples.md b/code-library/latest/ug/python_3_bedrock-runtime_code_examples.md
index 70edde4db..0ea5df52f 100644
--- a//code-library/latest/ug/python_3_bedrock-runtime_code_examples.md
+++ b//code-library/latest/ug/python_3_bedrock-runtime_code_examples.md
@@ -5 +5 @@
-ScenariosAI21 Labs Jurassic-2Amazon NovaAmazon Nova CanvasAmazon Nova ReelAmazon Titan Image GeneratorAmazon Titan TextAmazon Titan Text EmbeddingsAnthropic ClaudeCohere CommandDeepSeekMeta LlamaMistral AIStable Diffusion
+ScenariosAmazon NovaAmazon Nova CanvasAmazon Nova ReelAmazon Titan Image GeneratorAmazon Titan TextAmazon Titan Text EmbeddingsAnthropic ClaudeCohere CommandDeepSeekMeta LlamaMistral AIStable Diffusion
@@ -203,2 +202,0 @@ Send a user message to a model with the Converse operation.
-  * AI21 Labs Jurassic-2
-
@@ -840,119 +837,0 @@ The weather tool used by the demo. This script defines the tool specification an
-## AI21 Labs Jurassic-2
-
-The following code example shows how to send a text message to AI21 Labs Jurassic-2, using Bedrock's Converse API.
-
-**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 text message to AI21 Labs Jurassic-2, using Bedrock's Converse API.
-    
-    
-    # Use the Conversation API to send a text message to AI21 Labs Jurassic-2.
-    
-    import boto3
-    from botocore.exceptions import ClientError
-    
-    # Create a Bedrock Runtime client in the AWS Region you want to use.
-    client = boto3.client("bedrock-runtime", region_name="us-east-1")
-    
-    # Set the model ID, e.g., Jurassic-2 Mid.
-    model_id = "ai21.j2-mid-v1"
-    
-    # Start a conversation with the user message.
-    user_message = "Describe the purpose of a 'hello world' program in one line."
-    conversation = [
-        {
-            "role": "user",
-            "content": [{"text": user_message}],
-        }
-    ]
-    
-    try:
-        # Send the message to the model, using a basic inference configuration.
-        response = client.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"]
-        print(response_text)
-    
-    except (ClientError, Exception) as e:
-        print(f"ERROR: Can't invoke '{model_id}'. Reason: {e}")
-        exit(1)
-    
-    
-    
-
-  * For API details, see [Converse](https://docs.aws.amazon.com/goto/boto3/bedrock-runtime-2023-09-30/Converse) in _AWS SDK for Python (Boto3) API Reference_. 
-
-
-
-
-The following code example shows how to send a text message to AI21 Labs Jurassic-2, using the Invoke Model API.
-
-**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). 
-
-Use the Invoke Model API to send a text message.
-    
-    
-    # Use the native inference API to send a text message to AI21 Labs Jurassic-2.
-    
-    import boto3
-    import json
-    
-    from botocore.exceptions import ClientError
-    
-    # Create a Bedrock Runtime client in the AWS Region of your choice.
-    client = boto3.client("bedrock-runtime", region_name="us-east-1")
-    
-    # Set the model ID, e.g., Jurassic-2 Mid.
-    model_id = "ai21.j2-mid-v1"
-    
-    # Define the prompt for the model.
-    prompt = "Describe the purpose of a 'hello world' program in one line."
-    
-    # Format the request payload using the model's native structure.
-    native_request = {
-        "prompt": prompt,
-        "maxTokens": 512,
-        "temperature": 0.5,
-    }
-    
-    # Convert the native request to JSON.
-    request = json.dumps(native_request)
-    
-    try:
-        # Invoke the model with the request.
-        response = client.invoke_model(modelId=model_id, body=request)
-    
-    except (ClientError, Exception) as e:
-        print(f"ERROR: Can't invoke '{model_id}'. Reason: {e}")
-        exit(1)
-    
-    # Decode the response body.
-    model_response = json.loads(response["body"].read())
-    
-    # Extract and print the response text.
-    response_text = model_response["completions"][0]["data"]["text"]
-    print(response_text)
-    
-    
-    
-
-  * 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_. 
-
-
-
-