AWS bedrock documentation change
Summary
Updated sample code to use image generation parameters instead of text inference
Security assessment
Functional change to image generation API without security implications
Diff
diff --git a/bedrock/latest/userguide/model-card-amazon-titan-image-generator-g1-v2.md b/bedrock/latest/userguide/model-card-amazon-titan-image-generator-g1-v2.md index d151d47fd..0ddc733ca 100644 --- a//bedrock/latest/userguide/model-card-amazon-titan-image-generator-g1-v2.md +++ b//bedrock/latest/userguide/model-card-amazon-titan-image-generator-g1-v2.md @@ -95,0 +96 @@ Invoke API + import base64 @@ -102,6 +103,8 @@ Invoke API - 'messages': [{ - 'role': 'user', - 'content': [{'text': 'Can you explain the features of Amazon Bedrock?'}] - }], - 'inferenceConfig': { - 'maxTokens': 1024 + 'taskType': 'TEXT_IMAGE', + 'textToImageParams': { + 'text': 'A photograph of a cup of coffee' + }, + 'imageGenerationConfig': { + 'numberOfImages': 1, + 'height': 1024, + 'width': 1024 @@ -111 +114,3 @@ Invoke API - print(json.loads(response['body'].read())) + response_body = json.loads(response['body'].read()) + base64_image = response_body['images'][0] + print(f'Image generated: {len(base64_image)} bytes (base64)')