AWS bedrock documentation change
Summary
Updated API invocation example to use base64-encoded image input and specific outpainting parameters instead of generic text prompt
Security assessment
Change corrects a code sample to match the image model's input requirements. No security vulnerabilities or features are addressed.
Diff
diff --git a/bedrock/latest/userguide/model-card-stability-ai-stable-image-outpaint.md b/bedrock/latest/userguide/model-card-stability-ai-stable-image-outpaint.md index 9e6c57618..1994adbe5 100644 --- a//bedrock/latest/userguide/model-card-stability-ai-stable-image-outpaint.md +++ b//bedrock/latest/userguide/model-card-stability-ai-stable-image-outpaint.md @@ -134,0 +135 @@ Invoke API + import base64 @@ -137,0 +139,3 @@ Invoke API + with open('input.png', 'rb') as f: + image_base64 = base64.b64encode(f.read()).decode('utf-8') + params = {'image': image_base64, 'left': 200, 'right': 200, 'up': 200, 'down': 200} @@ -140,4 +144 @@ Invoke API - body=json.dumps({ - 'messages': [{ 'role': 'user', 'content': 'Can you explain the features of Amazon Bedrock?'}], - 'max_tokens': 1024 - }) + body=json.dumps(params) @@ -145 +146,2 @@ Invoke API - print(json.loads(response['body'].read())) + response_body = json.loads(response['body'].read()) + print(f'Image generated: {len(response_body["images"][0])} bytes (base64)')