File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
plugins/dynamic-few-shot-lambda Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,16 @@ def _build_text_and_image_content(
218218 # Add images
219219 if image_content :
220220 for image_uri in image_content :
221- content .append ({"image_uri" : image_uri })
221+ # Load image content
222+ if image_uri .startswith ("s3://" ):
223+ # Direct S3 URI
224+ image_bytes = s3 .get_binary_content (image_uri )
225+ else :
226+ raise ValueError (f"Invalid file path { image_path } - expecting S3 path" )
227+
228+ # Convert bytes to base64 string
229+ image_base64 = base64 .b64encode (image_bytes ).decode ("utf-8" )
230+ content .append ({"image_base64" : image_base64 })
222231
223232 # Add text after image
224233 after_text = _prepare_prompt_from_template (
Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ Resources:
148148 - arm64
149149 Timeout : 300
150150 MemorySize : 512
151- Description : Demo Lambda function for GenAI IDP dynamic few-shot prompting using S3 Vectors
151+ Description : Lambda function for GenAI IDP dynamic few-shot prompting using S3 Vectors
152152 Environment :
153153 Variables :
154154 LOG_LEVEL : !Ref LogLevel
You can’t perform that action at this time.
0 commit comments