File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed
libs/python/agent/agent/loops Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -132,23 +132,22 @@ def _convert_responses_items_to_completion_messages(messages: Messages) -> List[
132
132
converted_content = []
133
133
for item in content :
134
134
if isinstance (item , dict ) and item .get ("type" ) == "input_image" :
135
- # Convert input_image to Anthropic image format
135
+ # Convert input_image to OpenAI image format
136
136
image_url = item .get ("image_url" , "" )
137
137
if image_url and image_url != "[omitted]" :
138
- # Extract base64 data from data URL
139
- if "," in image_url :
140
- base64_data = image_url .split ("," )[- 1 ]
141
- else :
142
- base64_data = image_url
143
-
144
138
converted_content .append ({
145
- "type" : "image" ,
146
- "source" : {
147
- "type" : "base64" ,
148
- "media_type" : "image/png" ,
149
- "data" : base64_data
139
+ "type" : "image_url" ,
140
+ "image_url" : {
141
+ "url" : image_url
150
142
}
151
143
})
144
+ elif isinstance (item , dict ) and item .get ("type" ) == "input_text" :
145
+ # Convert input_text to OpenAI text format
146
+ text = item .get ("text" , "" )
147
+ converted_content .append ({
148
+ "type" : "text" ,
149
+ "text" : text
150
+ })
152
151
else :
153
152
# Keep other content types as-is
154
153
converted_content .append (item )
You can’t perform that action at this time.
0 commit comments