使用Autogen创建群聊时遇到问题:与`allowed_speaker_transitions_dict`相关的ValueError

我在使用autogen库创建群聊时遇到了一个与allowed_speaker_transitions_dict相关的错误。以下是我代码的简化版本:

# 定义数据获取工具。
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_customer_order_detail_by_customerid
    ],
    system_message="system message",
)

# 定义账单检查代理。
bill_inspection_agent = AssistantAgent(
    name="billing_assistant",
    model_client=az_model_client_o1,
    system_message="system message",
)

# 定义监督代理。
supervisor_agent = AssistantAgent(
    name="supervison_assistant",
    model_client=az_model_client,
    system_message="您的工作是查看查询并要求适当的代理开始工作。您是监督者,必须确保工作正确完成。",
)

user_proxy = autogen.ConversableAgent(
    name="Admin",
    system_message="分配任务,并发送",
    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
)

这导致了以下错误:

ValueError: allowed_speaker_transitions_dict has values that are not lists of Agents.

完整的错误跟踪:

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.

回答:

群聊不允许使用带工具的代理,我们可以使用SelectorGroupChat或其他对话模式来适应带工具/函数调用的代理。

Related Posts

L1-L2正则化的不同系数

我想对网络的权重同时应用L1和L2正则化。然而,我找不…

使用scikit-learn的无监督方法将列表分类成不同组别,有没有办法?

我有一系列实例,每个实例都有一份列表,代表它所遵循的不…

f1_score metric in lightgbm

我想使用自定义指标f1_score来训练一个lgb模型…

通过相关系数矩阵进行特征选择

我在测试不同的算法时,如逻辑回归、高斯朴素贝叶斯、随机…

可以将机器学习库用于流式输入和输出吗?

已关闭。此问题需要更加聚焦。目前不接受回答。 想要改进…

在TensorFlow中,queue.dequeue_up_to()方法的用途是什么?

我对这个方法感到非常困惑,特别是当我发现这个令人费解的…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注