结构化输出解析器节点常见问题#
¥Structured Output Parser node common issues
以下是 结构化输出解析器节点 的一些常见错误和问题,以及解决或故障排除步骤。
¥Here are some common errors and issues with the Structured Output Parser node and steps to resolve or troubleshoot them.
处理参数#
¥Processing parameters
“结构化输出解析器”节点是一个 sub-node 节点。使用表达式处理多个项目时,子节点的行为与其他节点不同。
¥The Structured Output Parser node is a sub-node. Sub-nodes behave differently than other nodes when processing multiple items using expressions.
大多数节点(包括 根节点集)接受任意数量的项目作为输入,处理这些项目,并输出结果。你可以使用表达式引用输入项,节点会依次解析每个项的表达式。例如,给定五个名称值的输入,表达式 {{ $json.name }} 依次解析为每个名称。
¥Most nodes, including root nodes, take any number of items as input, process these items, and output the results. You can use expressions to refer to input items, and the node resolves the expression for each item in turn. For example, given an input of five name values, the expression {{ $json.name }} resolves to each name in turn.
在子节点中,表达式始终解析为第一个项。例如,给定五个名称值的输入,表达式 {{ $json.name }} 始终解析为第一个名称。
¥In sub-nodes, the expression always resolves to the first item. For example, given an input of five name values, the expression {{ $json.name }} always resolves to the first name.
添加结构化输出解析器节点到 AI 节点#
¥Adding the structured output parser node to AI nodes
你可以将输出解析器节点附加到选定的 AI 根节点。
¥You can attach output parser nodes to select AI root nodes.
要向节点添加结构化输出解析器,请在要格式化的 AI 根节点中启用“需要特定输出格式”选项。启用该选项后,将显示一个新的输出解析器连接点。点击输出解析器附件点,将结构化输出解析器节点添加到该节点。
¥To add the Structured Output Parser to a node, enable the Require Specific Output Format option in the AI root node you wish to format. Once the option is enabled, a new output parser attachment point is displayed. Click the output parser attachment point to add the Structured Output Parser node to the node.
使用结构化输出解析器格式化中间步骤#
¥Using the structured output parser to format intermediary steps
“结构化输出解析器”节点用于构建 AI 代理的最终输出。它不用于构建中间输出以传递给其他 AI 工具或阶段。
¥The Structured Output Parser node structures the final output from AI agents. It's not intended to structure intermediary output to pass to other AI tools or stages.
要请求特定格式的中间输出,请在 AI 代理的系统消息中包含响应结构。消息可以包含架构或示例响应,供代理用作其结果的模板。
¥To request a specific format for intermediary output, include the response structure in the System Message for the AI Agent. The message can include either a schema or example response for the agent to use as a template for its results.
结构化代理输出#
¥Structuring output from agents
使用 agents 时,结构化输出解析通常不可靠。
¥Structured output parsing is often not reliable when working with agents.
如果你的工作流使用代理,n8n 建议使用单独的 LLM 链 来接收来自代理的数据并进行解析。与直接在代理工作流中解析相比,这可以带来更好、更一致的结果。
¥If your workflow uses agents, n8n recommends using a separate LLM-chain to receive the data from the agent and parse it. This leads to better, more consistent results than parsing directly in the agent workflow.