Correcting tool calling with Cohere (#3271)

* 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.
This commit is contained in:
Jay
2024-08-03 21:23:59 +05:30
committed by GitHub
parent a375d7ac38
commit 03bfb8fa20

View File

@@ -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