forked from phoenix/litellm-mirror
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] = []
|
assistant_tool_calls: List[ToolCallObject] = []
|
||||||
## MERGE CONSECUTIVE ASSISTANT CONTENT ##
|
## MERGE CONSECUTIVE ASSISTANT CONTENT ##
|
||||||
while msg_i < len(messages) and messages[msg_i]["role"] == "assistant":
|
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"]:
|
for m in messages[msg_i]["content"]:
|
||||||
if m.get("type", "") == "text":
|
if m.get("type", "") == "text":
|
||||||
assistant_content += m["text"]
|
assistant_content += m["text"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue