路由函数正常 但是图的运行顺序出错 #414

Closed
opened 2026-02-20 17:39:59 -05:00 by yindo · 2 comments
Owner

Originally created by @uyu32 on GitHub (Jan 19, 2025).

Checked other resources

  • This is a bug, not a usage question. For questions, please use GitHub Discussions.
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Example Code

workflow.add_conditional_edges(
    "tools",
    check_ToM,
    {
        # 达到指定次数,更新ToM
        "tom": "tom",
        # 返回agent
        "agent": "agent",
    },
)

Error Message and Stack Trace (if applicable)


Description

Image
我的路由函数都输出了正确的路由为什么没有按照预期的顺序运行?

System Info

因为错误的模型运行顺序导致了错误如下
ValueError: {'message': 'Provider returned error', 'code': 400, 'metadata': {'raw': {'__kind': 'OK', 'data': '{\n "error": {\n "message": "An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: call_Rad8sO1nwvG0fRKww4DlSJBM",\n "type": "invalid_request_error",\n "param": "messages.[15].role",\n "code": null\n }\n}'}, 'provider_name': 'OpenAI'}}

Originally created by @uyu32 on GitHub (Jan 19, 2025). ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use GitHub Discussions. - [x] I added a clear and detailed title that summarizes the issue. - [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example). - [x] I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue. ### Example Code ```python workflow.add_conditional_edges( "tools", check_ToM, { # 达到指定次数,更新ToM "tom": "tom", # 返回agent "agent": "agent", }, ) ``` ### Error Message and Stack Trace (if applicable) ```shell ``` ### Description ![Image](https://github.com/user-attachments/assets/24699fae-8d3b-47d3-9477-cb35dd040cf5)、 我的路由函数都输出了正确的路由为什么没有按照预期的顺序运行? ### System Info 因为错误的模型运行顺序导致了错误如下 ValueError: {'message': 'Provider returned error', 'code': 400, 'metadata': {'raw': {'__kind': 'OK', 'data': '{\n "error": {\n "message": "An assistant message with \'tool_calls\' must be followed by tool messages responding to each \'tool_call_id\'. The following tool_call_ids did not have response messages: call_Rad8sO1nwvG0fRKww4DlSJBM",\n "type": "invalid_request_error",\n "param": "messages.[15].role",\n "code": null\n }\n}'}, 'provider_name': 'OpenAI'}}
yindo added the invalid label 2026-02-20 17:39:59 -05:00
yindo closed this issue 2026-02-20 17:40:00 -05:00
Author
Owner

@uyu32 commented on GitHub (Jan 19, 2025):

我想知道为什么路由函数输出正确的情况下还是来到了错误的结点

@uyu32 commented on GitHub (Jan 19, 2025): 我想知道为什么路由函数输出正确的情况下还是来到了错误的结点
Author
Owner

@gbaian10 commented on GitHub (Jan 19, 2025):

Please provide a minimal reproducible example~~

@gbaian10 commented on GitHub (Jan 19, 2025): Please provide a minimal reproducible example~~
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#414