mirror of
https://github.com/microsoft/autogen.git
synced 2025-11-02 02:40:21 +00:00
parent
56aed2d3d1
commit
fba7caee53
@ -871,7 +871,7 @@ class ConversableAgent(Agent):
|
||||
"content": func_return.get("content", ""),
|
||||
}
|
||||
)
|
||||
if len(tool_returns) > 0:
|
||||
if tool_returns:
|
||||
return True, {
|
||||
"role": "tool",
|
||||
"tool_responses": tool_returns,
|
||||
@ -907,14 +907,12 @@ class ConversableAgent(Agent):
|
||||
func = self._function_map.get(tool_call.get("function", {}).get("name", None), None)
|
||||
if func and asyncio.coroutines.iscoroutinefunction(func):
|
||||
async_tool_calls.append(self._a_execute_tool_call(tool_call))
|
||||
if len(async_tool_calls) > 0:
|
||||
if async_tool_calls:
|
||||
tool_returns = await asyncio.gather(*async_tool_calls)
|
||||
return True, {
|
||||
"role": "tool",
|
||||
"tool_responses": tool_returns,
|
||||
"content": "\n\n".join(
|
||||
[self._str_for_tool_response(tool_return["content"]) for tool_return in tool_returns]
|
||||
),
|
||||
"content": "\n\n".join([self._str_for_tool_response(tool_return) for tool_return in tool_returns]),
|
||||
}
|
||||
|
||||
return False, None
|
||||
@ -1128,7 +1126,10 @@ class ConversableAgent(Agent):
|
||||
]
|
||||
)
|
||||
|
||||
response = {"role": "user", "content": reply, "tool_responses": tool_returns}
|
||||
response = {"role": "user", "content": reply}
|
||||
if tool_returns:
|
||||
response["tool_responses"] = tool_returns
|
||||
|
||||
return True, response
|
||||
|
||||
# increment the consecutive_auto_reply_counter
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user