Skip to content

LLM 链基础节点(Basic LLM Chain node)#

使用 Basic LLM Chain 节点设置模型将使用的提示符,并设置可选的响应解析器。

🌐 Use the Basic LLM Chain node to set the prompt that the model will use along with setting an optional parser for the response.

本页提供 Basic LLM 链节点的参数以及更多资源的链接。

🌐 On this page, you'll find the node parameters for the Basic LLM Chain node and links to more resources.

Examples and templates

For usage examples and templates to help you get started, refer to n8n's Basic LLM Chain integrations page.

节点参数(Node parameters)#

提示(Prompt)#

Select how you want the node to construct the prompt (also known as the user's query or input from the chat).

Choose from:

  • Take from previous node automatically: If you select this option, the node expects an input from a previous node called chatInput.
  • Define below: If you select this option, provide either static text or an expression for dynamic content to serve as the prompt in the Prompt (User Message) field.

要求特定输出格式(Require Specific Output Format)#

This parameter controls whether you want the node to require a specific output format. When turned on, n8n prompts you to connect one of these output parsers to the node:

聊天消息(Chat Messages)#

当你使用聊天模型设置消息时,请使用聊天消息

🌐 Use Chat Messages when you're using a chat model to set a message.

如果不连接聊天模型,n8n 会忽略这些选项。请选择您希望节点使用的 类型名称或 ID

🌐 n8n ignores these options if you don't connect a chat model. Select the Type Name or ID you want the node to use:

人工智能(AI)#

消息字段中输入一个示例预期响应。模型将尝试在其消息中以相同的方式进行回应。

🌐 Enter a sample expected response in the Message field. The model will try to respond in the same way in its messages.

系统(System)#

输入一个系统消息,与用户输入一起使用,以帮助指导模型应该做什么。

🌐 Enter a system Message to include with the user input to help guide the model in what it should do.

使用此选项来定义语调,例如:Always respond talking like a pirate

🌐 Use this option for things like defining tone, for example: Always respond talking like a pirate.

用户(User)#

输入一个示例用户输入。将此与 AI 选项一起使用可以帮助提高代理的输出质量。两者结合使用可以为模型提供输入示例和预期的响应(AI 消息)以供参考。

🌐 Enter a sample user input. Using this with the AI option can help improve the output of the agent. Using both together provides a sample of an input and expected response (the AI Message) for the model to follow.

选择以下输入类型之一:

🌐 Select one of these input types:

  • 文本:输入一个示例用户输入作为文本消息
  • 图片(二进制):从前一个节点中选择二进制输入。输入图片数据字段名称以识别前一个节点中哪个二进制字段包含图片数据。
  • 图片 (URL):使用此选项通过 URL 提供图片。输入 图片 URL

对于两种 图片 类型,选择 图片详情 来控制模型如何处理图片并生成其文本理解。选项包括:

🌐 For both the Image types, select the Image Details to control how the model processes the image and generates its textual understanding. Choose from:

  • 自动:该模型使用自动设置,会根据图片输入的大小决定使用低设置还是高设置。
  • 低分辨率:模型接收图片的低分辨率版本(512px x 512px),并使用65个令牌的预算表示图片。这使得API能够更快地返回响应并消耗更少的输入令牌。对于不需要高细节的使用情况,请使用此选项。
  • :该模型可以访问低分辨率图片,然后根据输入图片的大小创建输入图片的详细裁剪,裁剪尺寸为512像素的正方形。每个详细裁剪使用两倍的令牌预算(65个令牌),总计129个令牌。对于需要高细节的使用场景,请使用此选项。

模板和示例(Templates and examples)#

Template widget placeholder.

有关该服务的更多信息,请参阅 LangChain 的基础 LLM 链文档

🌐 Refer to LangChain's documentation on Basic LLM Chains for more information about the service.

View n8n's Advanced AI documentation.

常见问题(Common issues)#

以下是一些与基本 LLM 链节点相关的常见错误和问题,以及解决或故障排除步骤。

🌐 Here are some common errors and issues with the Basic LLM Chain node and steps to resolve or troubleshoot them.

未指定错误提示(No prompt specified error)#

提示为空或无效时,会显示此错误。

🌐 This error displays when the Prompt is empty or invalid.

你可能会在以下两种情况下看到此错误:

🌐 You might see this error in one of two scenarios:

  1. 当你将提示设置为在下方定义,但在文本字段中没有输入任何内容时。
    • 要解决此问题,请在 文本 字段中输入有效的提示。
  2. 当你将 Prompt 设置为 Connected Chat Trigger Node 且传入数据没有名为 chatInput 的字段时。
    • 该节点需要 chatInput 字段。如果你之前的节点没有此字段,请添加一个 编辑字段(设置) 节点,将输入字段名称编辑为 chatInput