Skip to content

Commit

Permalink
Renaming and removal of tools filtering where not necessary
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Sze <[email protected]>
  • Loading branch information
marklysze committed Dec 8, 2024
1 parent 3b04874 commit fe18acb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 30 deletions.
8 changes: 4 additions & 4 deletions test/agentchat/test_async_chats.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@pytest.mark.skipif(skip_openai, reason="requested to skip openai tests")
@pytest.mark.asyncio
async def test_async_chats():
config_list_35 = autogen.config_list_from_json(
config_list_4omini = autogen.config_list_from_json(
OAI_CONFIG_LIST,
file_location=KEY_LOC,
filter_dict={"tags": ["gpt-4o-mini"]},
Expand All @@ -39,16 +39,16 @@ async def test_async_chats():

financial_assistant_1 = AssistantAgent(
name="Financial_assistant_1",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
system_message="You are a knowledgeable AI Assistant. Reply TERMINATE when everything is done.",
)
financial_assistant_2 = AssistantAgent(
name="Financial_assistant_2",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
)
writer = AssistantAgent(
name="Writer",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
is_termination_msg=lambda x: x.get("content", "").find("TERMINATE") >= 0,
system_message="""
You are a professional writer, known for
Expand Down
30 changes: 14 additions & 16 deletions test/agentchat/test_chats.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
)
)

config_list_35 = (
config_list_4omini = (
[]
if skip_openai
else autogen.config_list_from_json(
Expand All @@ -40,8 +40,6 @@
)
)

config_list_tool = filter_config(config_list_35, {"tags": ["tool"]})


def test_chat_messages_for_summary():
assistant = UserProxyAgent(name="assistant", human_input_mode="NEVER", code_execution_config={"use_docker": False})
Expand Down Expand Up @@ -87,12 +85,12 @@ def test_chats_group():

financial_assistant = AssistantAgent(
name="Financial_assistant",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
)

writer = AssistantAgent(
name="Writer",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
system_message="""
You are a professional writer, known for
your insightful and engaging articles.
Expand All @@ -106,7 +104,7 @@ def test_chats_group():
system_message="""Critic. Double check plan, claims, code from other agents and provide feedback. Check whether the plan includes adding verifiable info such as source URL.
Reply "TERMINATE" in the end when everything is done.
""",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
)

groupchat_1 = GroupChat(agents=[user_proxy, financial_assistant, critic], messages=[], max_round=3)
Expand All @@ -116,7 +114,7 @@ def test_chats_group():
manager_1 = GroupChatManager(
groupchat=groupchat_1,
name="Research_manager",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
code_execution_config={
"last_n_messages": 1,
"work_dir": "groupchat",
Expand All @@ -127,7 +125,7 @@ def test_chats_group():
manager_2 = GroupChatManager(
groupchat=groupchat_2,
name="Writing_manager",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
code_execution_config={
"last_n_messages": 1,
"work_dir": "groupchat",
Expand Down Expand Up @@ -201,17 +199,17 @@ def luck_number_message(sender, recipient, context):
func = Function()
financial_assistant_1 = AssistantAgent(
name="Financial_assistant_1",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
function_map={"get_random_number": func.get_random_number},
)
financial_assistant_2 = AssistantAgent(
name="Financial_assistant_2",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
function_map={"get_random_number": func.get_random_number},
)
writer = AssistantAgent(
name="Writer",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
is_termination_msg=lambda x: x.get("content", "").find("TERMINATE") >= 0,
system_message="""
You are a professional writer, known for
Expand Down Expand Up @@ -315,15 +313,15 @@ def test_chats_general():

financial_assistant_1 = AssistantAgent(
name="Financial_assistant_1",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
)
financial_assistant_2 = AssistantAgent(
name="Financial_assistant_2",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
)
writer = AssistantAgent(
name="Writer",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
is_termination_msg=lambda x: x.get("content", "").find("TERMINATE") >= 0,
system_message="""
You are a professional writer, known for
Expand Down Expand Up @@ -494,7 +492,7 @@ def test_chats_exceptions():
@pytest.mark.skipif(skip_openai, reason=reason)
def test_chats_w_func():
llm_config = {
"config_list": config_list_tool,
"config_list": config_list_4omini,
"timeout": 120,
}

Expand Down Expand Up @@ -549,7 +547,7 @@ def currency_calculator(

@pytest.mark.skipif(skip_openai, reason=reason)
def test_udf_message_in_chats():
llm_config_35 = {"config_list": config_list_35}
llm_config_35 = {"config_list": config_list_4omini}

research_task = """
## NVDA (NVIDIA Corporation)
Expand Down
10 changes: 4 additions & 6 deletions test/agentchat/test_function_call_groupchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,13 @@ def get_random_number(self):
return random.randint(0, 100)

# llm_config without functions
config_list_35 = autogen.config_list_from_json(
config_list_4omini = autogen.config_list_from_json(
OAI_CONFIG_LIST,
file_location=KEY_LOC,
filter_dict={"tags": ["gpt-4o-mini"]},
)
llm_config_no_function = {"config_list": config_list_35}
config_list_tool = autogen.filter_config(config_list_35, {"tags": ["tool"]})
llm_config = {
"config_list": config_list_tool,
"config_list": config_list_4omini,
key: value,
}

Expand All @@ -81,7 +79,7 @@ def get_random_number(self):
name="Observer",
system_message="You observe the the player's actions and results. Summarize in 1 sentence.",
description="An observer.",
llm_config=llm_config_no_function,
llm_config=llm_config,
)
groupchat = autogen.GroupChat(
agents=[player, user_proxy, observer], messages=[], max_round=7, speaker_selection_method="round_robin"
Expand All @@ -94,7 +92,7 @@ def get_random_number(self):
):
manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config)

manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config_no_function)
manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config)

if sync:
res = observer.initiate_chat(manager, message="Let's start the game!", summary_method="reflection_with_llm")
Expand Down
8 changes: 4 additions & 4 deletions test/agentchat/test_nested.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def mock_reply(recipient, messages, sender, config):
@pytest.mark.skipif(skip_openai, reason=reason)
def test_nested():
config_list = autogen.config_list_from_json(env_or_file=OAI_CONFIG_LIST, file_location=KEY_LOC)
config_list_35 = autogen.config_list_from_json(
config_list_4omini = autogen.config_list_from_json(
OAI_CONFIG_LIST,
file_location=KEY_LOC,
filter_dict={"tags": ["gpt-4o-mini"]},
Expand Down Expand Up @@ -96,7 +96,7 @@ def test_nested():

assistant_2 = autogen.AssistantAgent(
name="Assistant",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
# is_termination_msg=lambda x: x.get("content", "") == "",
)

Expand Down Expand Up @@ -124,7 +124,7 @@ def test_nested():

writer = autogen.AssistantAgent(
name="Writer",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
system_message="""
You are a professional writer, known for
your insightful and engaging articles.
Expand All @@ -135,7 +135,7 @@ def test_nested():

autogen.AssistantAgent(
name="Reviewer",
llm_config={"config_list": config_list_35},
llm_config={"config_list": config_list_4omini},
system_message="""
You are a compliance reviewer, known for your thoroughness and commitment to standards.
Your task is to scrutinize content for any harmful elements or regulatory violations, ensuring
Expand Down

0 comments on commit fe18acb

Please sign in to comment.