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
有关使用示例和模板以帮助你入门,请参阅 n8n 的 LLM 链集成基础 页面。
¥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:
- 文本:以文本消息的形式输入用户输入示例。
¥Text: Enter a sample user input as a text Message.
- 图片(二进制):从上一个节点选择一个二进制输入。输入图片数据字段名称,以标识前一个节点中包含图片数据的二进制字段。
¥Image (Binary): Select a binary input from a previous node. Enter the Image Data Field Name to identify which binary field from the previous node contains the image data.
- 图片(URL):使用此选项可从 URL 输入图片。输入图片 URL。
¥Image (URL): Use this option to feed an image in from a URL. Enter the Image 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:
- 自动:该模型使用自动设置,它会检查图片输入的大小,并决定使用低分辨率还是高分辨率设置。
¥Auto: The model uses the auto setting, which looks at the image input size and decide if it should use the Low or High setting.
- 低:该模型接收一个 512 像素 x 512 像素的低分辨率图片,并使用 65 个 token 的预算来表示该图片。这使得 API 能够更快地返回响应并消耗更少的输入令牌。对于不需要详细信息的用例,请使用此选项。
¥Low: The model receives a low-resolution 512px x 512px version of the image and represents the image with a budget of 65 tokens. This allows the API to return faster responses and consume fewer input tokens. Use this option for use cases that don't require high detail.
- 高:该模型可以访问低分辨率图片,然后根据输入图片的大小,将其裁剪成 512 像素的正方形。每个详细作物都使用两倍的令牌预算(65 个令牌),总共 129 个令牌。对于需要详细信息的用例,请使用此选项。
¥High: The model can access the low-resolution image and then creates detailed crops of input images as 512px squares based on the input image size. Each of the detailed crops uses twice the token budget (65 tokens) for a total of 129 tokens. Use this option for use cases that require high detail.
模板和示例#
¥Templates and examples
相关资源#
¥Related resources
有关服务的更多信息,请参阅 LangChain 的 Basic LLM Chains 文档。
¥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:
- 当你将下方的“提示”设置为“定义”且未在“文本”字段中输入任何内容时。
¥When you've set the Prompt to Define below and haven't entered anything in the Text field.
-
要解决此问题,请在“文本”字段中输入有效的提示。
¥To resolve, enter a valid prompt in the Text field. 2. 当你将提示设置为“已连接聊天触发节点”且传入数据中没有名为
chatInput的字段时。
¥When you've set the Prompt to Connected Chat Trigger Node and the incoming data has no field called chatInput.
-
该节点需要
chatInput字段。如果你的前一个节点没有此字段,请添加一个 编辑字段(设置) 节点,将传入的字段名称编辑为chatInput。¥The node expects the
chatInputfield. If your previous node doesn't have this field, add an Edit Fields (Set) node to edit an incoming field name tochatInput.