mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-15 23:31:29 +00:00
Merge pull request #5384 from miraclebakelaser/fix/cohere-tool-calls-content-field
fix(factory.py): handle missing 'content' in cohere assistant messages
This commit is contained in:
commit
ec2357f1d2
1 changed files with 1 additions and 1 deletions
|
|
@ -1781,7 +1781,7 @@ def cohere_messages_pt_v2(
|
|||
assistant_tool_calls: List[ToolCallObject] = []
|
||||
## MERGE CONSECUTIVE ASSISTANT CONTENT ##
|
||||
while msg_i < len(messages) and messages[msg_i]["role"] == "assistant":
|
||||
if isinstance(messages[msg_i]["content"], list):
|
||||
if messages[msg_i].get("content", None) is not None and isinstance(messages[msg_i]["content"], list):
|
||||
for m in messages[msg_i]["content"]:
|
||||
if m.get("type", "") == "text":
|
||||
assistant_content += m["text"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue