Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yiranwu0 committed Nov 17, 2024
1 parent c072c4a commit 366332e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions autogen/agentchat/groupchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ def append(self, message: Dict, speaker: Agent):
# if the role is tool, it is OK to modify the name
if message["role"] != "function":
message["name"] = speaker.name
if not isinstance(message["content"], str) and isinstance(message["content"], list):
message["content"] = str(message["content"])
message["content"] = content_str(message["content"])
self.messages.append(message)

Expand Down
2 changes: 1 addition & 1 deletion test/agentchat/test_conversable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def add_num(num_to_be_added):

# when sender is None, messages is provided
assert (
dummy_agent_2.generate_reply(messages=messages, sender=None)["content"] == "15"
dummy_agent_2.generate_reply(messages=messages, sender=None)["content"] == 15
), "generate_reply not working when sender is None"

# when sender is provided, messages is None
Expand Down
2 changes: 1 addition & 1 deletion test/agentchat/test_function_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def add_num(num_to_be_added):

# correct execution
correct_args = {"name": "add_num", "arguments": '{ "num_to_be_added": 5 }'}
assert user.execute_function(func_call=correct_args)[1]["content"] == "15"
assert user.execute_function(func_call=correct_args)[1]["content"] == 15

# function name called is wrong or doesn't exist
wrong_func_name = {"name": "subtract_num", "arguments": '{ "num_to_be_added": 5 }'}
Expand Down

0 comments on commit 366332e

Please sign in to comment.