AWS nova documentation change
Summary
Added S3 integration example for large image file handling
Security assessment
Documents a file handling feature without any security-specific content or vulnerability addressed.
Diff
diff --git a/nova/latest/userguide/modalities-image-examples.md b/nova/latest/userguide/modalities-image-examples.md index 0a859965d..8bb442a10 100644 --- a//nova/latest/userguide/modalities-image-examples.md +++ b//nova/latest/userguide/modalities-image-examples.md @@ -69,0 +70,43 @@ The following example shows how to send a image prompt to Amazon Nova Model with +For passing large image files or multiple image files, where the overall payload is greater than 25 MB, you can use Amazon S3. The following example demonstrates how to use Amazon S3 to upload images to Amazon Nova: + + + import boto3 + import json + import base64 + # Create a Bedrock Runtime client + client = boto3.client("bedrock-runtime", + region_name="us-east-1", + ) + PRO_MODEL_ID = "us.amazon.nova-pro-v1:0" + LITE_MODEL_ID = "us.amazon.nova-lite-v1:0" + MICRO_MODEL_ID = "us.amazon.nova-micro-v1:0" + PREMIER_MODEL_ID = "us.amazon.nova-premier-v1:0" + messages = [ + { + "role": "user", + "content": [ + { + "image": { + "format": "png", + "source": { + "s3Location": { + #Replace the s3 bucket URI + "uri": "s3://demo-bucket/cat.png" + "bucketOwner" : "123456789012" + } + }, + } + }, + {"text": "Describe the following image"}, + ], + } + ] + inf_params = {"maxTokens": 300, "topP": 0.1, "temperature": 0.3} + model_response = client.converse( + modelId=LITE_MODEL_ID, messages=messages, inferenceConfig=inf_params + ) + print("\n[Full Response]") + print(json.dumps(model_response, indent=2)) + print("\n[Response Content Text]") + print(model_response["output"]["message"]["content"][0]["text"]) +