From 5da2247aa8b98d1d2e5f3abff687c582bd97f56a Mon Sep 17 00:00:00 2001 From: MarianoMolina Date: Fri, 26 Apr 2024 13:18:10 -0300 Subject: [PATCH 01/10] Added 'role' as a summary_args and to the reflection_with_llm flow to be able to pass the role for the summarizing prompt --- autogen/agentchat/conversable_agent.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py index 262fc513d23..07cb1c7ab3f 100644 --- a/autogen/agentchat/conversable_agent.py +++ b/autogen/agentchat/conversable_agent.py @@ -921,6 +921,7 @@ def my_summary_method( summary_args (dict): a dictionary of arguments to be passed to the summary_method. One example key is "summary_prompt", and value is a string of text used to prompt a LLM-based agent (the sender or receiver agent) to reflect on the conversation and extract a summary when summary_method is "reflection_with_llm". + Another argument is 'role', the default for which is 'system'. The default summary_prompt is DEFAULT_SUMMARY_PROMPT, i.e., "Summarize takeaway from the conversation. Do not add any introductory phrases. If the intended request is NOT properly addressed, please point it out." message (str, dict or Callable): the initial message to be sent to the recipient. Needs to be provided. Otherwise, input() will be called to get the initial message. - If a string or a dict is provided, it will be used as the initial message. `generate_init_message` is called to generate the initial message for the agent based on this string and the context. @@ -1153,8 +1154,11 @@ def _reflection_with_llm_as_summary(sender, recipient, summary_args): raise ValueError("The summary_prompt must be a string.") msg_list = recipient.chat_messages_for_summary(sender) agent = sender if recipient is None else recipient + role = summary_args.get("role", None) + if role and not isinstance(role, str): + raise ValueError("The role (summary_arg) must be a string.") try: - summary = sender._reflection_with_llm(prompt, msg_list, llm_agent=agent, cache=summary_args.get("cache")) + summary = sender._reflection_with_llm(prompt, msg_list, llm_agent=agent, cache=summary_args.get("cache"), role=role) except BadRequestError as e: warnings.warn( f"Cannot extract summary using reflection_with_llm: {e}. Using an empty str as summary.", UserWarning @@ -1163,7 +1167,7 @@ def _reflection_with_llm_as_summary(sender, recipient, summary_args): return summary def _reflection_with_llm( - self, prompt, messages, llm_agent: Optional[Agent] = None, cache: Optional[AbstractCache] = None + self, prompt, messages, llm_agent: Optional[Agent] = None, cache: Optional[AbstractCache] = None, role: Union[str, None] = None ) -> str: """Get a chat summary using reflection with an llm client based on the conversation history. @@ -1172,14 +1176,19 @@ def _reflection_with_llm( messages (list): The messages generated as part of a chat conversation. llm_agent: the agent with an llm client. cache (AbstractCache or None): the cache client to be used for this conversation. + role (str): the role of the message, usually "system" or "user". Default is "system". """ + if not role: + role = "system" + system_msg = [ { - "role": "system", + "role": role, "content": prompt, } ] + messages = messages + system_msg if llm_agent and llm_agent.client is not None: llm_client = llm_agent.client From fa927f18251bc0d1945b986f9ab8650c131f13cb Mon Sep 17 00:00:00 2001 From: MarianoMolina Date: Fri, 26 Apr 2024 13:51:58 -0300 Subject: [PATCH 02/10] Added 'role' as a summary_args and to the reflection_with_llm flow to be able to pass the role for the summarizing prompt, minor docstring adjustments --- autogen/agentchat/conversable_agent.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py index 07cb1c7ab3f..dc7129f0190 100644 --- a/autogen/agentchat/conversable_agent.py +++ b/autogen/agentchat/conversable_agent.py @@ -921,7 +921,6 @@ def my_summary_method( summary_args (dict): a dictionary of arguments to be passed to the summary_method. One example key is "summary_prompt", and value is a string of text used to prompt a LLM-based agent (the sender or receiver agent) to reflect on the conversation and extract a summary when summary_method is "reflection_with_llm". - Another argument is 'role', the default for which is 'system'. The default summary_prompt is DEFAULT_SUMMARY_PROMPT, i.e., "Summarize takeaway from the conversation. Do not add any introductory phrases. If the intended request is NOT properly addressed, please point it out." message (str, dict or Callable): the initial message to be sent to the recipient. Needs to be provided. Otherwise, input() will be called to get the initial message. - If a string or a dict is provided, it will be used as the initial message. `generate_init_message` is called to generate the initial message for the agent based on this string and the context. @@ -930,8 +929,7 @@ def my_summary_method( 1. "content": content of the message, can be None. 2. "function_call": a dictionary containing the function name and arguments. (deprecated in favor of "tool_calls") 3. "tool_calls": a list of dictionaries containing the function name and arguments. - 4. "role": role of the message, can be "assistant", "user", "function". - This field is only needed to distinguish between "function" or "assistant"/"user". + 4. "role": role of the message, default is "system". Can be "assistant", "user", "function" or "system" 5. "name": In most cases, this field is not needed. When the role is "function", this field is needed to indicate the function name. 6. "context" (dict): the context of the message, which will be passed to [OpenAIWrapper.create](../oai/client#create). From 04b059783a3a2cbd30c7a877d213f8e5bbe6eeae Mon Sep 17 00:00:00 2001 From: MarianoMolina Date: Sat, 27 Apr 2024 13:51:30 -0300 Subject: [PATCH 03/10] Added test for summary prompt role assignment --- test/agentchat/test_groupchat.py | 48 ++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/test/agentchat/test_groupchat.py b/test/agentchat/test_groupchat.py index 8a4758d2d37..f0720ce3bf6 100755 --- a/test/agentchat/test_groupchat.py +++ b/test/agentchat/test_groupchat.py @@ -3,14 +3,14 @@ import builtins import json from typing import Any, Dict, List, Optional -from unittest import mock +from unittest import mock, TestCase import pytest import autogen from autogen import Agent, GroupChat from autogen.exception_utils import AgentNameConflict, UndefinedNextAgent - +from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST def test_func_call_groupchat(): agent1 = autogen.ConversableAgent( @@ -1425,6 +1425,47 @@ def test_speaker_selection_agent_name_match(): ) assert result == {} +def test_role_for_reflection_summary(): + config_list = autogen.config_list_from_json( + OAI_CONFIG_LIST, + file_location=KEY_LOC, + ) + llm_config={ + "config_list": config_list, + "model": "gpt-3.5-turbo-0613", + }, + agent1 = autogen.ConversableAgent( + "alice", + max_consecutive_auto_reply=10, + human_input_mode="NEVER", + llm_config=False, + default_auto_reply="This is alice speaking.", + ) + agent2 = autogen.ConversableAgent( + "bob", + max_consecutive_auto_reply=10, + human_input_mode="NEVER", + llm_config=False, + default_auto_reply="This is bob speaking.", + ) + groupchat = autogen.GroupChat(agents=[agent1, agent2], messages=[], max_round=3, speaker_selection_method="round_robin") + group_chat_manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config) + + role_name = "user" + with mock.patch.object(autogen.ConversableAgent, '_generate_oai_reply_from_client') as mock_generate_oai_reply_from_client: + mock_generate_oai_reply_from_client.return_value = "Mocked summary" + + res = agent1.initiate_chat( + group_chat_manager, + max_turns=2, + message="hello", + summary_method="reflection_with_llm", + summary_args={"role": role_name} + ) + + mock_generate_oai_reply_from_client.assert_called_once() + args, kwargs = mock_generate_oai_reply_from_client.call_args + assert kwargs['messages'][-1]["role"] == role_name if __name__ == "__main__": # test_func_call_groupchat() @@ -1443,5 +1484,6 @@ def test_speaker_selection_agent_name_match(): # test_custom_speaker_selection_overrides_transition_graph() # test_role_for_select_speaker_messages() # test_select_speaker_message_and_prompt_templates() - test_speaker_selection_agent_name_match() + # test_speaker_selection_agent_name_match() + test_role_for_reflection_summary() # pass From 953464a41708204ba524172dbc61be98a1c4656b Mon Sep 17 00:00:00 2001 From: MarianoMolina Date: Tue, 30 Apr 2024 15:19:23 -0300 Subject: [PATCH 04/10] Fixed docstrings and mocked llm-config in the test --- autogen/agentchat/conversable_agent.py | 6 ++++-- test/agentchat/test_groupchat.py | 9 +-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py index dc7129f0190..d06524063ad 100644 --- a/autogen/agentchat/conversable_agent.py +++ b/autogen/agentchat/conversable_agent.py @@ -922,6 +922,7 @@ def my_summary_method( One example key is "summary_prompt", and value is a string of text used to prompt a LLM-based agent (the sender or receiver agent) to reflect on the conversation and extract a summary when summary_method is "reflection_with_llm". The default summary_prompt is DEFAULT_SUMMARY_PROMPT, i.e., "Summarize takeaway from the conversation. Do not add any introductory phrases. If the intended request is NOT properly addressed, please point it out." + Another available key is "summary_role", which is the role of the message sent to the agent in charge of summarizing. Default is "system". message (str, dict or Callable): the initial message to be sent to the recipient. Needs to be provided. Otherwise, input() will be called to get the initial message. - If a string or a dict is provided, it will be used as the initial message. `generate_init_message` is called to generate the initial message for the agent based on this string and the context. If dict, it may contain the following reserved fields (either content or tool_calls need to be provided). @@ -929,7 +930,8 @@ def my_summary_method( 1. "content": content of the message, can be None. 2. "function_call": a dictionary containing the function name and arguments. (deprecated in favor of "tool_calls") 3. "tool_calls": a list of dictionaries containing the function name and arguments. - 4. "role": role of the message, default is "system". Can be "assistant", "user", "function" or "system" + 4. "role": role of the message, can be "assistant", "user", "function". + This field is only needed to distinguish between "function" or "assistant"/"user". 5. "name": In most cases, this field is not needed. When the role is "function", this field is needed to indicate the function name. 6. "context" (dict): the context of the message, which will be passed to [OpenAIWrapper.create](../oai/client#create). @@ -1152,7 +1154,7 @@ def _reflection_with_llm_as_summary(sender, recipient, summary_args): raise ValueError("The summary_prompt must be a string.") msg_list = recipient.chat_messages_for_summary(sender) agent = sender if recipient is None else recipient - role = summary_args.get("role", None) + role = summary_args.get("summary_role", None) if role and not isinstance(role, str): raise ValueError("The role (summary_arg) must be a string.") try: diff --git a/test/agentchat/test_groupchat.py b/test/agentchat/test_groupchat.py index f0720ce3bf6..3887b8e387f 100755 --- a/test/agentchat/test_groupchat.py +++ b/test/agentchat/test_groupchat.py @@ -1426,14 +1426,7 @@ def test_speaker_selection_agent_name_match(): assert result == {} def test_role_for_reflection_summary(): - config_list = autogen.config_list_from_json( - OAI_CONFIG_LIST, - file_location=KEY_LOC, - ) - llm_config={ - "config_list": config_list, - "model": "gpt-3.5-turbo-0613", - }, + llm_config={"config_list": [{"model": "mock", "api_key": "mock"}]} agent1 = autogen.ConversableAgent( "alice", max_consecutive_auto_reply=10, From d309e15f95135c44d4341ebc07a4a2e323eed754 Mon Sep 17 00:00:00 2001 From: MarianoMolina Date: Thu, 2 May 2024 11:59:27 -0300 Subject: [PATCH 05/10] Update autogen/agentchat/conversable_agent.py Co-authored-by: Chi Wang --- autogen/agentchat/conversable_agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py index d06524063ad..c2e5c039dfd 100644 --- a/autogen/agentchat/conversable_agent.py +++ b/autogen/agentchat/conversable_agent.py @@ -1156,7 +1156,7 @@ def _reflection_with_llm_as_summary(sender, recipient, summary_args): agent = sender if recipient is None else recipient role = summary_args.get("summary_role", None) if role and not isinstance(role, str): - raise ValueError("The role (summary_arg) must be a string.") + raise ValueError("The summary_role in summary_arg must be a string.") try: summary = sender._reflection_with_llm(prompt, msg_list, llm_agent=agent, cache=summary_args.get("cache"), role=role) except BadRequestError as e: From 2dd6b14aaf1b4457b0754f3711fe93927a6d7e04 Mon Sep 17 00:00:00 2001 From: MarianoMolina Date: Fri, 3 May 2024 14:40:14 -0300 Subject: [PATCH 06/10] ran pre-commit --- test/agentchat/test_groupchat.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/test/agentchat/test_groupchat.py b/test/agentchat/test_groupchat.py index 3d58beddef9..1a8cec9767b 100755 --- a/test/agentchat/test_groupchat.py +++ b/test/agentchat/test_groupchat.py @@ -3,14 +3,15 @@ import builtins import json from typing import Any, Dict, List, Optional -from unittest import mock, TestCase +from unittest import TestCase, mock import pytest +from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST import autogen from autogen import Agent, GroupChat from autogen.exception_utils import AgentNameConflict, UndefinedNextAgent -from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST + def test_func_call_groupchat(): agent1 = autogen.ConversableAgent( @@ -1443,8 +1444,9 @@ def test_speaker_selection_agent_name_match(): ) assert result == {} + def test_role_for_reflection_summary(): - llm_config={"config_list": [{"model": "mock", "api_key": "mock"}]} + llm_config = {"config_list": [{"model": "mock", "api_key": "mock"}]} agent1 = autogen.ConversableAgent( "alice", max_consecutive_auto_reply=10, @@ -1459,24 +1461,29 @@ def test_role_for_reflection_summary(): llm_config=False, default_auto_reply="This is bob speaking.", ) - groupchat = autogen.GroupChat(agents=[agent1, agent2], messages=[], max_round=3, speaker_selection_method="round_robin") + groupchat = autogen.GroupChat( + agents=[agent1, agent2], messages=[], max_round=3, speaker_selection_method="round_robin" + ) group_chat_manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config) role_name = "user" - with mock.patch.object(autogen.ConversableAgent, '_generate_oai_reply_from_client') as mock_generate_oai_reply_from_client: + with mock.patch.object( + autogen.ConversableAgent, "_generate_oai_reply_from_client" + ) as mock_generate_oai_reply_from_client: mock_generate_oai_reply_from_client.return_value = "Mocked summary" - res = agent1.initiate_chat( + agent1.initiate_chat( group_chat_manager, max_turns=2, message="hello", summary_method="reflection_with_llm", - summary_args={"role": role_name} + summary_args={"role": role_name}, ) mock_generate_oai_reply_from_client.assert_called_once() args, kwargs = mock_generate_oai_reply_from_client.call_args - assert kwargs['messages'][-1]["role"] == role_name + assert kwargs["messages"][-1]["role"] == role_name + def test_speaker_selection_auto_process_result(): """ @@ -1822,5 +1829,4 @@ def test_select_speaker_auto_messages(): test_speaker_selection_auto_process_result() test_speaker_selection_validate_speaker_name() test_select_speaker_auto_messages() -main - # pass +# pass From bf32bf06aea7f8704957af07c266bf9bdca11989 Mon Sep 17 00:00:00 2001 From: MarianoMolina Date: Fri, 3 May 2024 14:45:43 -0300 Subject: [PATCH 07/10] ran pre-commit2 --- autogen/agentchat/conversable_agent.py | 12 +- ...33\357\200\233\357\200\233\357\200\233asd" | 385 ++++++++++++++++++ 2 files changed, 394 insertions(+), 3 deletions(-) create mode 100644 "dasda\357\200\233\357\200\233\357\200\233\357\200\233asd" diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py index 9689b3de016..35af969673b 100644 --- a/autogen/agentchat/conversable_agent.py +++ b/autogen/agentchat/conversable_agent.py @@ -1163,7 +1163,9 @@ def _reflection_with_llm_as_summary(sender, recipient, summary_args): if role and not isinstance(role, str): raise ValueError("The summary_role in summary_arg must be a string.") try: - summary = sender._reflection_with_llm(prompt, msg_list, llm_agent=agent, cache=summary_args.get("cache"), role=role) + summary = sender._reflection_with_llm( + prompt, msg_list, llm_agent=agent, cache=summary_args.get("cache"), role=role + ) except BadRequestError as e: warnings.warn( f"Cannot extract summary using reflection_with_llm: {e}. Using an empty str as summary.", UserWarning @@ -1172,7 +1174,12 @@ def _reflection_with_llm_as_summary(sender, recipient, summary_args): return summary def _reflection_with_llm( - self, prompt, messages, llm_agent: Optional[Agent] = None, cache: Optional[AbstractCache] = None, role: Union[str, None] = None + self, + prompt, + messages, + llm_agent: Optional[Agent] = None, + cache: Optional[AbstractCache] = None, + role: Union[str, None] = None, ) -> str: """Get a chat summary using reflection with an llm client based on the conversation history. @@ -1193,7 +1200,6 @@ def _reflection_with_llm( } ] - messages = messages + system_msg if llm_agent and llm_agent.client is not None: llm_client = llm_agent.client diff --git "a/dasda\357\200\233\357\200\233\357\200\233\357\200\233asd" "b/dasda\357\200\233\357\200\233\357\200\233\357\200\233asd" new file mode 100644 index 00000000000..3867aa00b78 --- /dev/null +++ "b/dasda\357\200\233\357\200\233\357\200\233\357\200\233asd" @@ -0,0 +1,385 @@ +commit 9b3555eec4cec5b75af6b49558aee7c8ccad0ee1 (HEAD -> add-role-to-reflection-with-llm, origin/add-role-to-reflection-with-llm) +Merge: d309e15f 3e693578 +Author: MarianoMolina +Date: Thu May 2 12:03:26 2024 -0300 + + Merge branch 'main' into add-role-to-reflection-with-llm + +diff --cc test/agentchat/test_groupchat.py +index 3887b8e3,a4689bd5..3d58bedd +--- a/test/agentchat/test_groupchat.py ++++ b/test/agentchat/test_groupchat.py +@@@ -1425,41 -1443,329 +1443,363 @@@ def test_speaker_selection_agent_name_m + ) + assert result == {} +  + +def test_role_for_reflection_summary(): + + llm_config={"config_list": [{"model": "mock", "api_key": "mock"}]} + + agent1 = autogen.ConversableAgent( + + "alice", + + max_consecutive_auto_reply=10, + + human_input_mode="NEVER", + + llm_config=False, + + default_auto_reply="This is alice speaking.", + + ) + + agent2 = autogen.ConversableAgent( + + "bob", + + max_consecutive_auto_reply=10, + + human_input_mode="NEVER", + + llm_config=False, + + default_auto_reply="This is bob speaking.", + + ) + + groupchat = autogen.GroupChat(agents=[agent1, agent2], messages=[], max_round=3, speaker_selection_method="round_robin") + + group_chat_manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config) + + + + role_name = "user" + + with mock.patch.object(autogen.ConversableAgent, '_generate_oai_reply_from_client') as mock_generate_oai_reply_from_client: + + mock_generate_oai_reply_from_client.return_value = "Mocked summary" + + + + res = agent1.initiate_chat( + + group_chat_manager, + + max_turns=2, + + message="hello", + + summary_method="reflection_with_llm", + + summary_args={"role": role_name} + + ) + + + + mock_generate_oai_reply_from_client.assert_called_once() + + args, kwargs = mock_generate_oai_reply_from_client.call_args + + assert kwargs['messages'][-1]["role"] == role_name +  ++ def test_speaker_selection_auto_process_result(): ++ """ ++ Tests the return result of the 2-agent chat used for speaker selection for the auto method. ++ The last message of the messages passed in will contain a pass or fail. ++ If passed, the message will contain the name of the correct agent and that agent will be returned. ++ If failed, the message will contain the reason for failure for the last attempt and the next ++ agent in the sequence will be returned. ++ """ ++ cmo = autogen.ConversableAgent( ++ name="Chief_Marketing_Officer", ++ human_input_mode="NEVER", ++ llm_config=False, ++ default_auto_reply="This is alice speaking.", ++ ) ++ pm = autogen.ConversableAgent( ++ name="Product_Manager", ++ human_input_mode="NEVER", ++ llm_config=False, ++ default_auto_reply="This is bob speaking.", ++ function_map={"test_func": lambda x: x}, ++ ) ++  ++ agent_list = [cmo, pm] ++ groupchat = autogen.GroupChat(agents=agent_list, messages=[], max_round=3) ++  ++ chat_result = autogen.ChatResult( ++ chat_id=None, ++ chat_history=[ ++ { ++ "content": "Let's get this meeting started. First the Product_Manager will create 3 new product ideas.", ++ "name": "Chairperson", ++ "role": "assistant", ++ }, ++ {"content": "You are an expert at finding the next speaker.", "role": "assistant"}, ++ {"content": "Product_Manager", "role": "user"}, ++ {"content": "UPDATED_BELOW", "role": "user"}, ++ ], ++ ) ++  ++ ### Agent selected successfully ++ chat_result.chat_history[3]["content"] = "[AGENT SELECTED]Product_Manager" ++  ++ # Product_Manager should be returned ++ assert groupchat._process_speaker_selection_result(chat_result, cmo, agent_list) == pm ++  ++ ### Agent not selected successfully ++ chat_result.chat_history[3][ ++ "content" ++ ] = "[AGENT SELECTION FAILED]Select speaker attempt #3 of 3 failed as it did not include any agent names." ++  ++ # The next speaker in the list will be selected, which will be the Product_Manager (as the last speaker is the Chief_Marketing_Officer) ++ assert groupchat._process_speaker_selection_result(chat_result, cmo, agent_list) == pm ++  ++ ### Invalid result messages, will return the next agent ++ chat_result.chat_history[3]["content"] = "This text should not be here." ++  ++ # The next speaker in the list will be selected, which will be the Chief_Marketing_Officer (as the last speaker is the Product_Maanger) ++ assert groupchat._process_speaker_selection_result(chat_result, pm, agent_list) == cmo ++  ++  ++ def test_speaker_selection_validate_speaker_name(): ++ """ ++ Tests the speaker name validation function used to evaluate the return result of the LLM ++ during speaker selection in 'auto' mode. ++  ++ Function: _validate_speaker_name ++  ++ If a single agent name is returned by the LLM, it will add a relevant message to the chat messages and return True, None ++ If multiple agent names are returned and there are attempts left, it will return a message to be used to prompt the LLM to try again ++ If multiple agent names are return and there are no attempts left, it will add a relevant message to the chat messages and return True, None ++ If no agent names are returned and there are attempts left, it will return a message to be used to prompt the LLM to try again ++ If no agent names are returned and there are no attempts left, it will add a relevant message to the chat messages and return True, None ++  ++ When returning a message, it will include the 'override_role' key and value to support the GroupChat role_for_select_speaker_messages attribute ++ """ ++  ++ # Group Chat setup ++ cmo = autogen.ConversableAgent( ++ name="Chief_Marketing_Officer", ++ human_input_mode="NEVER", ++ llm_config=False, ++ default_auto_reply="This is alice speaking.", ++ ) ++ pm = autogen.ConversableAgent( ++ name="Product_Manager", ++ human_input_mode="NEVER", ++ llm_config=False, ++ default_auto_reply="This is bob speaking.", ++ function_map={"test_func": lambda x: x}, ++ ) ++  ++ agent_list = [cmo, pm] ++ agent_list_string = f"{[agent.name for agent in agent_list]}" ++ groupchat = autogen.GroupChat(agents=agent_list, messages=[], max_round=3) ++  ++ # Speaker Selection 2-agent chat setup ++  ++ # Agent for selecting a single agent name from the response ++ speaker_selection_agent = autogen.ConversableAgent( ++ "speaker_selection_agent", ++ ) ++  ++ # Agent for checking the response from the speaker_select_agent ++ checking_agent = autogen.ConversableAgent("checking_agent") ++  ++ # Select speaker messages ++ select_speaker_messages = [ ++ { ++ "content": "Let's get this meeting started. First the Product_Manager will create 3 new product ideas.", ++ "name": "Chairperson", ++ "role": "assistant", ++ }, ++ {"content": "You are an expert at finding the next speaker.", "role": "assistant"}, ++ {"content": "UPDATED_BELOW", "role": "user"}, ++ ] ++  ++ ### Single agent name returned ++ attempts_left = 2 ++ attempt = 1 ++ select_speaker_messages[-1]["content"] = "Product_Manager is the next to speak" ++  ++ result = groupchat._validate_speaker_name( ++ recipient=checking_agent, ++ messages=select_speaker_messages, ++ sender=speaker_selection_agent, ++ config=None, ++ attempts_left=attempts_left, ++ attempt=attempt, ++ agents=agent_list, ++ ) ++  ++ assert result == (True, None) ++ assert select_speaker_messages[-1]["content"] == "[AGENT SELECTED]Product_Manager" ++  ++ select_speaker_messages.pop(-1) # Remove the last message before the next test ++  ++ ### Multiple agent names returned with attempts left ++ attempts_left = 2 ++ attempt = 1 ++ select_speaker_messages[-1]["content"] = "Product_Manager must speak after the Chief_Marketing_Officer" ++  ++ result = groupchat._validate_speaker_name( ++ recipient=checking_agent, ++ messages=select_speaker_messages, ++ sender=speaker_selection_agent, ++ config=None, ++ attempts_left=attempts_left, ++ attempt=attempt, ++ agents=agent_list, ++ ) ++  ++ assert result == ( ++ True, ++ { ++ "content": groupchat.select_speaker_auto_multiple_template.format(agentlist=agent_list_string), ++ "override_role": groupchat.role_for_select_speaker_messages, ++ }, ++ ) ++  ++ ### Multiple agent names returned with no attempts left ++ attempts_left = 0 ++ attempt = 1 ++ select_speaker_messages[-1]["content"] = "Product_Manager must speak after the Chief_Marketing_Officer" ++  ++ result = groupchat._validate_speaker_name( ++ recipient=checking_agent, ++ messages=select_speaker_messages, ++ sender=speaker_selection_agent, ++ config=None, ++ attempts_left=attempts_left, ++ attempt=attempt, ++ agents=agent_list, ++ ) ++  ++ assert result == (True, None) ++ assert ( ++ select_speaker_messages[-1]["content"] ++ == f"[AGENT SELECTION FAILED]Select speaker attempt #{attempt} of {attempt + attempts_left} failed as it returned multiple names." ++ ) ++  ++ select_speaker_messages.pop(-1) # Remove the last message before the next test ++  ++ ### No agent names returned with attempts left ++ attempts_left = 3 ++ attempt = 2 ++ select_speaker_messages[-1]["content"] = "The PM must speak after the CMO" ++  ++ result = groupchat._validate_speaker_name( ++ recipient=checking_agent, ++ messages=select_speaker_messages, ++ sender=speaker_selection_agent, ++ config=None, ++ attempts_left=attempts_left, ++ attempt=attempt, ++ agents=agent_list, ++ ) ++  ++ assert result == ( ++ True, ++ { ++ "content": groupchat.select_speaker_auto_none_template.format(agentlist=agent_list_string), ++ "override_role": groupchat.role_for_select_speaker_messages, ++ }, ++ ) ++  ++ ### Multiple agents returned with no attempts left ++ attempts_left = 0 ++ attempt = 3 ++ select_speaker_messages[-1]["content"] = "The PM must speak after the CMO" ++  ++ result = groupchat._validate_speaker_name( ++ recipient=checking_agent, ++ messages=select_speaker_messages, ++ sender=speaker_selection_agent, ++ config=None, ++ attempts_left=attempts_left, ++ attempt=attempt, ++ agents=agent_list, ++ ) ++  ++ assert result == (True, None) ++ assert ( ++ select_speaker_messages[-1]["content"] ++ == f"[AGENT SELECTION FAILED]Select speaker attempt #{attempt} of {attempt + attempts_left} failed as it did not include any agent names." ++ ) ++  ++  ++ def test_select_speaker_auto_messages(): ++ """ ++ In this test, two agents are part of a group chat which has customized select speaker "auto" multiple and no-name prompt messages. Both valid and empty string values will be used. ++ The expected behaviour is that the customized speaker selection "auto" messages will override the default values or throw exceptions if empty. ++ """ ++  ++ agent1 = autogen.ConversableAgent( ++ "Alice", ++ description="A wonderful employee named Alice.", ++ human_input_mode="NEVER", ++ llm_config=False, ++ ) ++ agent2 = autogen.ConversableAgent( ++ "Bob", ++ description="An amazing employee named Bob.", ++ human_input_mode="NEVER", ++ llm_config=False, ++ ) ++  ++ # Customised message for select speaker auto method where multiple agent names are returned ++ custom_multiple_names_msg = "You mentioned multiple names but we need just one. Select the best one. A reminder that the options are {agentlist}." ++  ++ # Customised message for select speaker auto method where no agent names are returned ++ custom_no_names_msg = "You forgot to select a single names and we need one, and only one. Select the best one. A reminder that the options are {agentlist}." ++  ++ # Test empty is_termination_msg function ++ groupchat = autogen.GroupChat( ++ agents=[agent1, agent2], ++ messages=[], ++ speaker_selection_method="auto", ++ max_round=10, ++ select_speaker_auto_multiple_template=custom_multiple_names_msg, ++ select_speaker_auto_none_template=custom_no_names_msg, ++ ) ++  ++ # Test using the _validate_speaker_name function, checking for the correct string and agentlist to be included ++ agents = [agent1, agent2] ++  ++ messages = [{"content": "Alice and Bob should both speak.", "name": "speaker_selector", "role": "user"}] ++ assert groupchat._validate_speaker_name(None, messages, None, None, 1, 1, agents) == ( ++ True, ++ { ++ "content": custom_multiple_names_msg.replace("{agentlist}", "['Alice', 'Bob']"), ++ "override_role": groupchat.role_for_select_speaker_messages, ++ }, ++ ) ++  ++ messages = [{"content": "Fred should both speak.", "name": "speaker_selector", "role": "user"}] ++ assert groupchat._validate_speaker_name(None, messages, None, None, 1, 1, agents) == ( ++ True, ++ { ++ "content": custom_no_names_msg.replace("{agentlist}", "['Alice', 'Bob']"), ++ "override_role": groupchat.role_for_select_speaker_messages, ++ }, ++ ) ++  ++ # Test with empty strings ++ with pytest.raises(ValueError, match="select_speaker_auto_multiple_template cannot be empty or None."): ++ groupchat = autogen.GroupChat( ++ agents=[agent1, agent2], ++ messages=[], ++ speaker_selection_method="auto", ++ max_round=10, ++ select_speaker_auto_multiple_template="", ++ ) ++  ++ with pytest.raises(ValueError, match="select_speaker_auto_none_template cannot be empty or None."): ++ groupchat = autogen.GroupChat( ++ agents=[agent1, agent2], ++ messages=[], ++ speaker_selection_method="auto", ++ max_round=10, ++ select_speaker_auto_none_template="", ++ ) ++  ++ # Test with None ++ with pytest.raises(ValueError, match="select_speaker_auto_multiple_template cannot be empty or None."): ++ groupchat = autogen.GroupChat( ++ agents=[agent1, agent2], ++ messages=[], ++ speaker_selection_method="auto", ++ max_round=10, ++ select_speaker_auto_multiple_template=None, ++ ) ++  ++ with pytest.raises(ValueError, match="select_speaker_auto_none_template cannot be empty or None."): ++ groupchat = autogen.GroupChat( ++ agents=[agent1, agent2], ++ messages=[], ++ speaker_selection_method="auto", ++ max_round=10, ++ select_speaker_auto_none_template=None, ++ ) ++  ++  + if __name__ == "__main__": + # test_func_call_groupchat() + # test_broadcast() +@@@ -1478,5 -1784,7 +1818,9 @@@ + # test_role_for_select_speaker_messages() + # test_select_speaker_message_and_prompt_templates() + # test_speaker_selection_agent_name_match() + + test_role_for_reflection_summary() ++ test_speaker_selection_auto_process_result() ++ test_speaker_selection_validate_speaker_name() ++ test_select_speaker_auto_messages() +++main + # pass From 0f3f5d546ddd6d98f0292911fba1373d523edba6 Mon Sep 17 00:00:00 2001 From: MarianoMolina Date: Sun, 5 May 2024 15:15:02 -0300 Subject: [PATCH 08/10] fixed old arg name --- test/agentchat/test_groupchat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/agentchat/test_groupchat.py b/test/agentchat/test_groupchat.py index 1a8cec9767b..6e5e6736e37 100755 --- a/test/agentchat/test_groupchat.py +++ b/test/agentchat/test_groupchat.py @@ -1477,7 +1477,7 @@ def test_role_for_reflection_summary(): max_turns=2, message="hello", summary_method="reflection_with_llm", - summary_args={"role": role_name}, + summary_args={"summary_role": role_name}, ) mock_generate_oai_reply_from_client.assert_called_once() From ed1cdf225b857f2a4139bbb96211cbfcc9835937 Mon Sep 17 00:00:00 2001 From: MarianoMolina Date: Sat, 11 May 2024 14:40:42 -0300 Subject: [PATCH 09/10] =?UTF-8?q?Delete=20dasda=EF=80=9B=EF=80=9B=EF=80=9B?= =?UTF-8?q?=EF=80=9Basd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No idea what this file was about --- ...33\357\200\233\357\200\233\357\200\233asd" | 385 ------------------ 1 file changed, 385 deletions(-) delete mode 100644 "dasda\357\200\233\357\200\233\357\200\233\357\200\233asd" diff --git "a/dasda\357\200\233\357\200\233\357\200\233\357\200\233asd" "b/dasda\357\200\233\357\200\233\357\200\233\357\200\233asd" deleted file mode 100644 index 3867aa00b78..00000000000 --- "a/dasda\357\200\233\357\200\233\357\200\233\357\200\233asd" +++ /dev/null @@ -1,385 +0,0 @@ -commit 9b3555eec4cec5b75af6b49558aee7c8ccad0ee1 (HEAD -> add-role-to-reflection-with-llm, origin/add-role-to-reflection-with-llm) -Merge: d309e15f 3e693578 -Author: MarianoMolina -Date: Thu May 2 12:03:26 2024 -0300 - - Merge branch 'main' into add-role-to-reflection-with-llm - -diff --cc test/agentchat/test_groupchat.py -index 3887b8e3,a4689bd5..3d58bedd ---- a/test/agentchat/test_groupchat.py -+++ b/test/agentchat/test_groupchat.py -@@@ -1425,41 -1443,329 +1443,363 @@@ def test_speaker_selection_agent_name_m - ) - assert result == {} -  - +def test_role_for_reflection_summary(): - + llm_config={"config_list": [{"model": "mock", "api_key": "mock"}]} - + agent1 = autogen.ConversableAgent( - + "alice", - + max_consecutive_auto_reply=10, - + human_input_mode="NEVER", - + llm_config=False, - + default_auto_reply="This is alice speaking.", - + ) - + agent2 = autogen.ConversableAgent( - + "bob", - + max_consecutive_auto_reply=10, - + human_input_mode="NEVER", - + llm_config=False, - + default_auto_reply="This is bob speaking.", - + ) - + groupchat = autogen.GroupChat(agents=[agent1, agent2], messages=[], max_round=3, speaker_selection_method="round_robin") - + group_chat_manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config) - + - + role_name = "user" - + with mock.patch.object(autogen.ConversableAgent, '_generate_oai_reply_from_client') as mock_generate_oai_reply_from_client: - + mock_generate_oai_reply_from_client.return_value = "Mocked summary" - + - + res = agent1.initiate_chat( - + group_chat_manager, - + max_turns=2, - + message="hello", - + summary_method="reflection_with_llm", - + summary_args={"role": role_name} - + ) - + - + mock_generate_oai_reply_from_client.assert_called_once() - + args, kwargs = mock_generate_oai_reply_from_client.call_args - + assert kwargs['messages'][-1]["role"] == role_name -  -+ def test_speaker_selection_auto_process_result(): -+ """ -+ Tests the return result of the 2-agent chat used for speaker selection for the auto method. -+ The last message of the messages passed in will contain a pass or fail. -+ If passed, the message will contain the name of the correct agent and that agent will be returned. -+ If failed, the message will contain the reason for failure for the last attempt and the next -+ agent in the sequence will be returned. -+ """ -+ cmo = autogen.ConversableAgent( -+ name="Chief_Marketing_Officer", -+ human_input_mode="NEVER", -+ llm_config=False, -+ default_auto_reply="This is alice speaking.", -+ ) -+ pm = autogen.ConversableAgent( -+ name="Product_Manager", -+ human_input_mode="NEVER", -+ llm_config=False, -+ default_auto_reply="This is bob speaking.", -+ function_map={"test_func": lambda x: x}, -+ ) -+  -+ agent_list = [cmo, pm] -+ groupchat = autogen.GroupChat(agents=agent_list, messages=[], max_round=3) -+  -+ chat_result = autogen.ChatResult( -+ chat_id=None, -+ chat_history=[ -+ { -+ "content": "Let's get this meeting started. First the Product_Manager will create 3 new product ideas.", -+ "name": "Chairperson", -+ "role": "assistant", -+ }, -+ {"content": "You are an expert at finding the next speaker.", "role": "assistant"}, -+ {"content": "Product_Manager", "role": "user"}, -+ {"content": "UPDATED_BELOW", "role": "user"}, -+ ], -+ ) -+  -+ ### Agent selected successfully -+ chat_result.chat_history[3]["content"] = "[AGENT SELECTED]Product_Manager" -+  -+ # Product_Manager should be returned -+ assert groupchat._process_speaker_selection_result(chat_result, cmo, agent_list) == pm -+  -+ ### Agent not selected successfully -+ chat_result.chat_history[3][ -+ "content" -+ ] = "[AGENT SELECTION FAILED]Select speaker attempt #3 of 3 failed as it did not include any agent names." -+  -+ # The next speaker in the list will be selected, which will be the Product_Manager (as the last speaker is the Chief_Marketing_Officer) -+ assert groupchat._process_speaker_selection_result(chat_result, cmo, agent_list) == pm -+  -+ ### Invalid result messages, will return the next agent -+ chat_result.chat_history[3]["content"] = "This text should not be here." -+  -+ # The next speaker in the list will be selected, which will be the Chief_Marketing_Officer (as the last speaker is the Product_Maanger) -+ assert groupchat._process_speaker_selection_result(chat_result, pm, agent_list) == cmo -+  -+  -+ def test_speaker_selection_validate_speaker_name(): -+ """ -+ Tests the speaker name validation function used to evaluate the return result of the LLM -+ during speaker selection in 'auto' mode. -+  -+ Function: _validate_speaker_name -+  -+ If a single agent name is returned by the LLM, it will add a relevant message to the chat messages and return True, None -+ If multiple agent names are returned and there are attempts left, it will return a message to be used to prompt the LLM to try again -+ If multiple agent names are return and there are no attempts left, it will add a relevant message to the chat messages and return True, None -+ If no agent names are returned and there are attempts left, it will return a message to be used to prompt the LLM to try again -+ If no agent names are returned and there are no attempts left, it will add a relevant message to the chat messages and return True, None -+  -+ When returning a message, it will include the 'override_role' key and value to support the GroupChat role_for_select_speaker_messages attribute -+ """ -+  -+ # Group Chat setup -+ cmo = autogen.ConversableAgent( -+ name="Chief_Marketing_Officer", -+ human_input_mode="NEVER", -+ llm_config=False, -+ default_auto_reply="This is alice speaking.", -+ ) -+ pm = autogen.ConversableAgent( -+ name="Product_Manager", -+ human_input_mode="NEVER", -+ llm_config=False, -+ default_auto_reply="This is bob speaking.", -+ function_map={"test_func": lambda x: x}, -+ ) -+  -+ agent_list = [cmo, pm] -+ agent_list_string = f"{[agent.name for agent in agent_list]}" -+ groupchat = autogen.GroupChat(agents=agent_list, messages=[], max_round=3) -+  -+ # Speaker Selection 2-agent chat setup -+  -+ # Agent for selecting a single agent name from the response -+ speaker_selection_agent = autogen.ConversableAgent( -+ "speaker_selection_agent", -+ ) -+  -+ # Agent for checking the response from the speaker_select_agent -+ checking_agent = autogen.ConversableAgent("checking_agent") -+  -+ # Select speaker messages -+ select_speaker_messages = [ -+ { -+ "content": "Let's get this meeting started. First the Product_Manager will create 3 new product ideas.", -+ "name": "Chairperson", -+ "role": "assistant", -+ }, -+ {"content": "You are an expert at finding the next speaker.", "role": "assistant"}, -+ {"content": "UPDATED_BELOW", "role": "user"}, -+ ] -+  -+ ### Single agent name returned -+ attempts_left = 2 -+ attempt = 1 -+ select_speaker_messages[-1]["content"] = "Product_Manager is the next to speak" -+  -+ result = groupchat._validate_speaker_name( -+ recipient=checking_agent, -+ messages=select_speaker_messages, -+ sender=speaker_selection_agent, -+ config=None, -+ attempts_left=attempts_left, -+ attempt=attempt, -+ agents=agent_list, -+ ) -+  -+ assert result == (True, None) -+ assert select_speaker_messages[-1]["content"] == "[AGENT SELECTED]Product_Manager" -+  -+ select_speaker_messages.pop(-1) # Remove the last message before the next test -+  -+ ### Multiple agent names returned with attempts left -+ attempts_left = 2 -+ attempt = 1 -+ select_speaker_messages[-1]["content"] = "Product_Manager must speak after the Chief_Marketing_Officer" -+  -+ result = groupchat._validate_speaker_name( -+ recipient=checking_agent, -+ messages=select_speaker_messages, -+ sender=speaker_selection_agent, -+ config=None, -+ attempts_left=attempts_left, -+ attempt=attempt, -+ agents=agent_list, -+ ) -+  -+ assert result == ( -+ True, -+ { -+ "content": groupchat.select_speaker_auto_multiple_template.format(agentlist=agent_list_string), -+ "override_role": groupchat.role_for_select_speaker_messages, -+ }, -+ ) -+  -+ ### Multiple agent names returned with no attempts left -+ attempts_left = 0 -+ attempt = 1 -+ select_speaker_messages[-1]["content"] = "Product_Manager must speak after the Chief_Marketing_Officer" -+  -+ result = groupchat._validate_speaker_name( -+ recipient=checking_agent, -+ messages=select_speaker_messages, -+ sender=speaker_selection_agent, -+ config=None, -+ attempts_left=attempts_left, -+ attempt=attempt, -+ agents=agent_list, -+ ) -+  -+ assert result == (True, None) -+ assert ( -+ select_speaker_messages[-1]["content"] -+ == f"[AGENT SELECTION FAILED]Select speaker attempt #{attempt} of {attempt + attempts_left} failed as it returned multiple names." -+ ) -+  -+ select_speaker_messages.pop(-1) # Remove the last message before the next test -+  -+ ### No agent names returned with attempts left -+ attempts_left = 3 -+ attempt = 2 -+ select_speaker_messages[-1]["content"] = "The PM must speak after the CMO" -+  -+ result = groupchat._validate_speaker_name( -+ recipient=checking_agent, -+ messages=select_speaker_messages, -+ sender=speaker_selection_agent, -+ config=None, -+ attempts_left=attempts_left, -+ attempt=attempt, -+ agents=agent_list, -+ ) -+  -+ assert result == ( -+ True, -+ { -+ "content": groupchat.select_speaker_auto_none_template.format(agentlist=agent_list_string), -+ "override_role": groupchat.role_for_select_speaker_messages, -+ }, -+ ) -+  -+ ### Multiple agents returned with no attempts left -+ attempts_left = 0 -+ attempt = 3 -+ select_speaker_messages[-1]["content"] = "The PM must speak after the CMO" -+  -+ result = groupchat._validate_speaker_name( -+ recipient=checking_agent, -+ messages=select_speaker_messages, -+ sender=speaker_selection_agent, -+ config=None, -+ attempts_left=attempts_left, -+ attempt=attempt, -+ agents=agent_list, -+ ) -+  -+ assert result == (True, None) -+ assert ( -+ select_speaker_messages[-1]["content"] -+ == f"[AGENT SELECTION FAILED]Select speaker attempt #{attempt} of {attempt + attempts_left} failed as it did not include any agent names." -+ ) -+  -+  -+ def test_select_speaker_auto_messages(): -+ """ -+ In this test, two agents are part of a group chat which has customized select speaker "auto" multiple and no-name prompt messages. Both valid and empty string values will be used. -+ The expected behaviour is that the customized speaker selection "auto" messages will override the default values or throw exceptions if empty. -+ """ -+  -+ agent1 = autogen.ConversableAgent( -+ "Alice", -+ description="A wonderful employee named Alice.", -+ human_input_mode="NEVER", -+ llm_config=False, -+ ) -+ agent2 = autogen.ConversableAgent( -+ "Bob", -+ description="An amazing employee named Bob.", -+ human_input_mode="NEVER", -+ llm_config=False, -+ ) -+  -+ # Customised message for select speaker auto method where multiple agent names are returned -+ custom_multiple_names_msg = "You mentioned multiple names but we need just one. Select the best one. A reminder that the options are {agentlist}." -+  -+ # Customised message for select speaker auto method where no agent names are returned -+ custom_no_names_msg = "You forgot to select a single names and we need one, and only one. Select the best one. A reminder that the options are {agentlist}." -+  -+ # Test empty is_termination_msg function -+ groupchat = autogen.GroupChat( -+ agents=[agent1, agent2], -+ messages=[], -+ speaker_selection_method="auto", -+ max_round=10, -+ select_speaker_auto_multiple_template=custom_multiple_names_msg, -+ select_speaker_auto_none_template=custom_no_names_msg, -+ ) -+  -+ # Test using the _validate_speaker_name function, checking for the correct string and agentlist to be included -+ agents = [agent1, agent2] -+  -+ messages = [{"content": "Alice and Bob should both speak.", "name": "speaker_selector", "role": "user"}] -+ assert groupchat._validate_speaker_name(None, messages, None, None, 1, 1, agents) == ( -+ True, -+ { -+ "content": custom_multiple_names_msg.replace("{agentlist}", "['Alice', 'Bob']"), -+ "override_role": groupchat.role_for_select_speaker_messages, -+ }, -+ ) -+  -+ messages = [{"content": "Fred should both speak.", "name": "speaker_selector", "role": "user"}] -+ assert groupchat._validate_speaker_name(None, messages, None, None, 1, 1, agents) == ( -+ True, -+ { -+ "content": custom_no_names_msg.replace("{agentlist}", "['Alice', 'Bob']"), -+ "override_role": groupchat.role_for_select_speaker_messages, -+ }, -+ ) -+  -+ # Test with empty strings -+ with pytest.raises(ValueError, match="select_speaker_auto_multiple_template cannot be empty or None."): -+ groupchat = autogen.GroupChat( -+ agents=[agent1, agent2], -+ messages=[], -+ speaker_selection_method="auto", -+ max_round=10, -+ select_speaker_auto_multiple_template="", -+ ) -+  -+ with pytest.raises(ValueError, match="select_speaker_auto_none_template cannot be empty or None."): -+ groupchat = autogen.GroupChat( -+ agents=[agent1, agent2], -+ messages=[], -+ speaker_selection_method="auto", -+ max_round=10, -+ select_speaker_auto_none_template="", -+ ) -+  -+ # Test with None -+ with pytest.raises(ValueError, match="select_speaker_auto_multiple_template cannot be empty or None."): -+ groupchat = autogen.GroupChat( -+ agents=[agent1, agent2], -+ messages=[], -+ speaker_selection_method="auto", -+ max_round=10, -+ select_speaker_auto_multiple_template=None, -+ ) -+  -+ with pytest.raises(ValueError, match="select_speaker_auto_none_template cannot be empty or None."): -+ groupchat = autogen.GroupChat( -+ agents=[agent1, agent2], -+ messages=[], -+ speaker_selection_method="auto", -+ max_round=10, -+ select_speaker_auto_none_template=None, -+ ) -+  -+  - if __name__ == "__main__": - # test_func_call_groupchat() - # test_broadcast() -@@@ -1478,5 -1784,7 +1818,9 @@@ - # test_role_for_select_speaker_messages() - # test_select_speaker_message_and_prompt_templates() - # test_speaker_selection_agent_name_match() - + test_role_for_reflection_summary() -+ test_speaker_selection_auto_process_result() -+ test_speaker_selection_validate_speaker_name() -+ test_select_speaker_auto_messages() -++main - # pass From 467d079a42b3e00d0d6f377fc30b9e0bd7f52cb7 Mon Sep 17 00:00:00 2001 From: MarianoMolina Date: Mon, 13 May 2024 19:13:35 -0300 Subject: [PATCH 10/10] Fixed incorrect merge update on test_groupchat --- test/agentchat/test_groupchat.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/agentchat/test_groupchat.py b/test/agentchat/test_groupchat.py index 517a88dd10b..0176c9e8990 100755 --- a/test/agentchat/test_groupchat.py +++ b/test/agentchat/test_groupchat.py @@ -2037,3 +2037,4 @@ def test_manager_resume_messages(): # test_manager_resume_functions() # test_manager_resume_returns() # test_manager_resume_messages() + pass