fix execute a_generate_reply with function_call: None (#3250)

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
This commit is contained in:
Juan Artero 2024-09-25 17:13:45 +02:00 committed by GitHub
parent 0847b459d1
commit c1289b4da7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -1658,8 +1658,8 @@ class ConversableAgent(LLMAgent):
if messages is None:
messages = self._oai_messages[sender]
message = messages[-1]
if "function_call" in message:
func_call = message["function_call"]
func_call = message.get("function_call")
if func_call:
func_name = func_call.get("name", "")
func = self._function_map.get(func_name, None)
if func and inspect.iscoroutinefunction(func):

View File

@ -33,6 +33,7 @@ async def _a_tool_func_error(arg1: str, arg2: str) -> str:
_tool_use_message_1 = {
"role": "assistant",
"content": None,
"function_call": None,
"tool_calls": [
{
"id": "1",
@ -56,6 +57,7 @@ _tool_use_message_1 = {
_tool_use_message_1_bad_json = {
"role": "assistant",
"content": None,
"function_call": None,
"tool_calls": [
{
"id": "1",