From 03bfb8fa20f9b63d703ff587817635145bdbf956 Mon Sep 17 00:00:00 2001 From: Jay Date: Sat, 3 Aug 2024 21:23:59 +0530 Subject: [PATCH] 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. --- autogen/oai/cohere.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autogen/oai/cohere.py b/autogen/oai/cohere.py index e04d07327..35b7ac97c 100644 --- a/autogen/oai/cohere.py +++ b/autogen/oai/cohere.py @@ -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