Browse Source

fix execute a_generate_reply with function_call: None (#3250)

Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com>
tags/v0.2.36
Juan Artero GitHub 1 year ago
parent
commit
c1289b4da7
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions
  1. +2
    -2
      autogen/agentchat/conversable_agent.py
  2. +2
    -0
      test/agentchat/test_function_and_tool_calling.py

+ 2
- 2
autogen/agentchat/conversable_agent.py 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):


+ 2
- 0
test/agentchat/test_function_and_tool_calling.py 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",


Loading…
Cancel
Save