Skip to content

Commit

Permalink
fix execute a_generate_reply with function_call: None (#3250)
Browse files Browse the repository at this point in the history
Co-authored-by: Jack Gerrits <[email protected]>
  • Loading branch information
artero and jackgerrits authored Sep 25, 2024
1 parent 0847b45 commit c1289b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions autogen/agentchat/conversable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1658,8 +1658,8 @@ async def a_generate_function_call_reply(
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):
Expand Down
2 changes: 2 additions & 0 deletions test/agentchat/test_function_and_tool_calling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -56,6 +57,7 @@ async def _a_tool_func_error(arg1: str, arg2: str) -> str:
_tool_use_message_1_bad_json = {
"role": "assistant",
"content": None,
"function_call": None,
"tool_calls": [
{
"id": "1",
Expand Down

0 comments on commit c1289b4

Please sign in to comment.