使用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

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

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