a2aproject / a2aproject/a2a-samples

Mismatch between AI Response and Structured Output in LangGraph Example

未关闭
#117 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Jupyter Notebook
星标
1.8k
派生
751
PR 合并指标
30 天内没有已合并 PR

描述

In the LangGraph example, you are using create_react_agent with a structured output (which is required for A2A). However, under the hood, what create_react_agent does is run the model twice: once with bind_tools and once with with_structured_output. With bind_tools, the model knows about the tool, and its response is correct, but it's not formatted, so the status can't be extracted. On the other hand, with with_structured_output, the model doesn't know about the tools (because none are bound), so the response doesn't include any information about them, and it's completely different from the bind_tools response. In fact, sometimes this response doesn't even make sense. If you look at the state, you'll see that the first option is correct, while the second one is not, as the first will appear in the message list, and the second will be in the structured output field.

```json
{
"messages": [
{
"role": "HumanMessage",
"content": "Hello, I want to build a minisite"
},
{
"role": "AIMessage",
"content": "Hello! I can help you with that. To build the minisite, I'll need you to provide information about the tool you'd like to add. I'll need the name, description, key benefits, key features, FAQs, real use cases, and how to get started with the tool.\n\nIs it okay if we start with that?"
}
],
"structured_response": {
"status": "input_required",
"message": "Hello! To help you build your minisite, I need more information. What topic would you like the minisite to be about? Do you have any content ready, such as text or images? Do you have any design or layout preferences?"
}
}
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。