File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -277,6 +277,22 @@ def transform_request(
277
277
m , BaseModel
278
278
): # avoid message serialization issues - https://github.com/BerriAI/litellm/issues/5319
279
279
m = m .model_dump (exclude_none = True )
280
+
281
+ content = m .get ("content" )
282
+ if content is not None and isinstance (content , list ):
283
+ for content_item in content :
284
+ if "text" in content_item :
285
+ new_messages .append ({
286
+ "role" : m ["role" ],
287
+ "content" : content_item ["text" ]
288
+ })
289
+ else :
290
+ verbose_logger .warning (
291
+ 'Dropping item in message["content"] with keys %s. Only items with a "text" key are supported.' ,
292
+ content_item .keys ()
293
+ )
294
+ continue
295
+
280
296
tool_calls = m .get ("tool_calls" )
281
297
if tool_calls is not None and isinstance (tool_calls , list ):
282
298
new_tools : List [OllamaToolCall ] = []
You can’t perform that action at this time.
0 commit comments