Skip to content

Commit

Permalink
Correcting tool calling with Cohere (microsoft#3271)
Browse files Browse the repository at this point in the history
* Update cohere.py

Key in the directory should be 'message' and not 'content' as it checks for message empty at a later point in code.

* Update cohere.py

Added required comments to the changes made in previous commit.
  • Loading branch information
jaygdesai authored Aug 3, 2024
1 parent a375d7a commit 03bfb8f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion autogen/oai/cohere.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,9 @@ def oai_messages_to_cohere_messages(

# If we're adding tool_results, like we are, the last message can't be a USER message
# So, we add a CHATBOT 'continue' message, if so.
# Changed key from "content" to "message" (jaygdesai/autogen_Jay)
if cohere_messages[-1]["role"] == "USER":
cohere_messages.append({"role": "CHATBOT", "content": "Please continue."})
cohere_messages.append({"role": "CHATBOT", "message": "Please continue."})

# We return a blank message when we have tool results
# TODO: Check what happens if tool_results aren't the latest message
Expand Down

0 comments on commit 03bfb8f

Please sign in to comment.