admin管理员组文章数量:1290976
I'm working on creating a group chat using the autogen
library but encountering an error related to the allowed_speaker_transitions_dict
. Here's a simplified version of my code:
# Define the data fetch tool.
data_search_agent = AssistantAgent(
name="assistant",
model_client=az_model_client,
tools=[
get_customer_details_by_customerid,
get_customer_bill_details_by_customerid,
get_customer_call_center_conversations_by_customerid,
get_customer_email_conversations_by_customerid,
get_order_detail_by_customerid
],
system_message="system message",
)
# Define the Bill inspection agent.
bill_inspection_agent = AssistantAgent(
name="billing_assistant",
model_client=az_model_client_o1,
system_message="system message",
)
# Define the supervisor agent.
supervisor_agent = AssistantAgent(
name="supervison_assistant",
model_client=az_model_client,
system_message="Your work is to look at the query and ask the appropriate agent to get to work. You are the supervisor and you have to make sure that the work is done properly.",
)
user_proxy = autogen.ConversableAgent(
name="Admin",
system_message="Give the task, and send",
code_execution_config=False,
llm_config=llm_config,
human_input_mode="ALWAYS",
)
groupchat = autogen.GroupChat(
agents=[user_proxy, data_search_agent, supervisor_agent, bill_inspection_agent],
messages=[],
max_round=10,
)
manager = autogen.GroupChatManager(
groupchat=groupchat, model_client=az_model_client
)
This results in the following error:
ValueError: allowed_speaker_transitions_dict has values that are not lists of Agents.
Full Traceback:
Traceback (most recent call last):
File "agents.py", line 652, in <module>
groupchat = autogen.GroupChat(
File "<string>", line 21, in __init__
File "groupchat.py", line 220, in __post_init__
check_graph_validity(
File "graph_utils.py", line 52, in check_graph_validity
raise ValueError("allowed_speaker_transitions_dict has values that are not lists of Agents.")
ValueError: allowed_speaker_transitions_dict has values that are not lists of Agents.
I'm working on creating a group chat using the autogen
library but encountering an error related to the allowed_speaker_transitions_dict
. Here's a simplified version of my code:
# Define the data fetch tool.
data_search_agent = AssistantAgent(
name="assistant",
model_client=az_model_client,
tools=[
get_customer_details_by_customerid,
get_customer_bill_details_by_customerid,
get_customer_call_center_conversations_by_customerid,
get_customer_email_conversations_by_customerid,
get_order_detail_by_customerid
],
system_message="system message",
)
# Define the Bill inspection agent.
bill_inspection_agent = AssistantAgent(
name="billing_assistant",
model_client=az_model_client_o1,
system_message="system message",
)
# Define the supervisor agent.
supervisor_agent = AssistantAgent(
name="supervison_assistant",
model_client=az_model_client,
system_message="Your work is to look at the query and ask the appropriate agent to get to work. You are the supervisor and you have to make sure that the work is done properly.",
)
user_proxy = autogen.ConversableAgent(
name="Admin",
system_message="Give the task, and send",
code_execution_config=False,
llm_config=llm_config,
human_input_mode="ALWAYS",
)
groupchat = autogen.GroupChat(
agents=[user_proxy, data_search_agent, supervisor_agent, bill_inspection_agent],
messages=[],
max_round=10,
)
manager = autogen.GroupChatManager(
groupchat=groupchat, model_client=az_model_client
)
This results in the following error:
ValueError: allowed_speaker_transitions_dict has values that are not lists of Agents.
Full Traceback:
Traceback (most recent call last):
File "agents.py", line 652, in <module>
groupchat = autogen.GroupChat(
File "<string>", line 21, in __init__
File "groupchat.py", line 220, in __post_init__
check_graph_validity(
File "graph_utils.py", line 52, in check_graph_validity
raise ValueError("allowed_speaker_transitions_dict has values that are not lists of Agents.")
ValueError: allowed_speaker_transitions_dict has values that are not lists of Agents.
Share
Improve this question
asked Feb 13 at 18:49
IpshitaIpshita
32 silver badges7 bronze badges
2
- can you please share the documents you following – Sampath Commented Feb 14 at 3:44
- I am mainly following Autogen 0.4.6 documentation. Also blogs and posts from medium. – Ipshita Commented Feb 14 at 12:28
2 Answers
Reset to default 0The error occurs due to a missing allowed_speaker_transitions_dict
in the GroupChat
initialization. The allowed_speaker_transitions_dict
contains lists of AssistantAgent
instances, which define valid speaker transitions.
data_search_agent = autogen.AssistantAgent(
name="assistant",
system_message="System message for fetching customer data",
)
bill_inspection_agent = autogen.AssistantAgent(
name="billing_assistant",
system_message="System message for handling billing queries",
)
supervisor_agent = autogen.AssistantAgent(
name="supervisor_assistant",
system_message="You are the supervisor. You assign tasks to the correct agents.",
)
user_proxy = autogen.ConversableAgent(
name="Admin",
system_message="Give the task and send",
human_input_mode="ALWAYS",
)
allowed_transitions = {
"Admin": ["supervisor_assistant"],
"supervisor_assistant": ["assistant", "billing_assistant"],
"assistant": ["supervisor_assistant"],
"billing_assistant": ["supervisor_assistant"],
}
groupchat = autogen.GroupChat(
agents=[user_proxy, data_search_agent, supervisor_agent, bill_inspection_agent],
messages=[],
max_round=10,
allowed_speaker_transitions_dict=allowed_transitions
)
manager = autogen.GroupChatManager(
groupchat=groupchat
)
For more details on using Azure AI Agent Service with AutoGen, refer to the following resources:
- Using Azure AI Agent Service with AutoGen & Semantic Kernel
- Extending the Power of AutoGen with PromptFlow
- Building AI Agent Applications with AutoGen
code_writer_agent = ConversableAgent(
name="CodeWriter",
system_message="You are an AI that writes Python code. Output valid Python code only.",
llm_config={"config_list": config_list},
is_termination_msg=lambda msg: "code output" in msg["content"]
)
code_executor_agent = ConversableAgent(
name="CodeExecutor",
llm_config=False,
code_execution_config={"executor": aca_sessions_executor},
human_input_mode="NEVER",
is_termination_msg=lambda msg: "TERMINATE" in msg.get("content", "").strip().upper()
)
news_agent = ConversableAgent(
name="NewsFetcher",
system_message="Fetch the latest top 10 news articles from the world.",
llm_config={"config_list": config_list}
)
groupchat = GroupChat(agents=[code_writer_agent, code_executor_agent, news_agent], messages=[], max_round=10)
manager = GroupChatManager(groupchat=groupchat, llm_config={"config_list": config_list})
Groupchat doesnt allow agents with tool, instead we can use SelectorGroupChat or other conversation patterns to accommodate agents with tools/function calling.
本文标签:
版权声明:本文标题:python - Trouble Creating GroupChat with Autogen: ValueError Related to `allowed_speaker_transitions_dict` - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741509888a2382546.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论