From 5e24cf590bec935738f0a42b539537defb9dbe3d Mon Sep 17 00:00:00 2001 From: Hashwanth S Date: Thu, 2 Apr 2026 01:21:09 -0700 Subject: [PATCH] fix: wrap single-image tool_result in image_url object for Bedrock Converse When a tool result contains a single image, the content field was set to the raw data URI string instead of being wrapped in a ChatCompletionImageObject, unlike the multi-item code path. This aligns the single-item path with the multi-item path. Fixes #24968 --- .../experimental_pass_through/adapters/transformation.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py index ed49943b7fe..14c67986b06 100644 --- a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py +++ b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py @@ -480,7 +480,14 @@ class LiteLLMAnthropicMessagesAdapter: tool_call_id=content.get( "tool_use_id", "" ), - content=openai_image_url, + content=[ + ChatCompletionImageObject( + type="image_url", + image_url=ChatCompletionImageUrlObject( + url=openai_image_url + ), + ) + ], ) self._add_cache_control_if_applicable( content, tool_result, model