结构化输出解析器节点常见问题(Structured Output Parser node common issues)#
以下是使用 Structured Output Parser 节点 时的一些常见错误和问题,以及解决或排查它们的步骤。
🌐 Here are some common errors and issues with the Structured Output Parser node and steps to resolve or troubleshoot them.
处理参数(Processing parameters)#
结构化输出解析器节点是一个子节点。在使用表达式处理多个项目时,子节点的行为与其他节点不同。
🌐 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)#
在使用代理时,结构化输出解析通常不可靠。
🌐 Structured output parsing is often not reliable when working with agents.
如果你的工作流使用代理,n8n 建议使用一个独立的 LLM-chain 来接收代理的数据并进行解析。这样比直接在代理工作流中解析能够得到更好、更一致的结果。
🌐 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.