Skip to content

OpenAI Assistant 操作#

¥OpenAI Assistant operations

使用此操作可在 OpenAI 中创建、删除、列出、发送消息或更新助手。有关 OpenAI 节点本身的更多信息,请参阅 OpenAI

¥Use this operation to create, delete, list, message, or update an assistant in OpenAI. Refer to OpenAI for more information on the OpenAI node itself.

Assistant operations deprecated in OpenAI node V2

n8n 版本 1.117.0 引入了支持 OpenAI Responses API 的 OpenAI 节点 V2,并移除了对 即将弃用的 Assistants API 的支持。

¥n8n version 1.117.0 introduces V2 of the OpenAI node that supports the OpenAI Responses API and removes support for the to-be-deprecated Assistants API.

创建助手#

¥Create an Assistant

使用此操作创建新的助手。

¥Use this operation to create a new assistant.

请输入以下参数:

¥Enter these parameters:

¥Credential to connect with: Create or select an existing OpenAI credential.

  • 资源:选择“助手”。

¥Resource: Select Assistant.

  • 操作:选择“创建助手”。

¥Operation: Select Create an Assistant.

  • 模型:选择助手将使用的模型。如果你不确定使用哪个模型,如果你需要高智能,请尝试 gpt-4o;如果你需要最快的速度和最低的成本,请尝试 gpt-4o-mini。有关更多信息,请参阅 模型概览 | OpenAI 平台

¥Model: Select the model that the assistant will use. If you’re not sure which model to use, try gpt-4o if you need high intelligence or gpt-4o-mini if you need the fastest speed and lowest cost. Refer to Models overview | OpenAI Platform for more information.

  • 名称:请输入助手的名称。最大长度为 256 个字符。

¥Name: Enter the name of the assistant. The maximum length is 256 characters.

  • 描述:输入助手的描述。最大长度为 512 个字符。

¥Description: Enter the description of the assistant. The maximum length is 512 characters.

1
A virtual assistant that helps users with daily tasks, including setting reminders, answering general questions, and providing quick information.

  • 指令:输入助手使用的系统指令。最大长度为 32,768 个字符。使用此选项指定模型在回复中使用的角色。

¥Instructions: Enter the system instructions that the assistant uses. The maximum length is 32,768 characters. Use this to specify the persona used by the model in its replies.

1
Always respond in a friendly and engaging manner. When a user asks a question, provide a concise answer first, followed by a brief explanation or additional context if necessary. If the question is open-ended, offer a suggestion or ask a clarifying question to guide the conversation. Keep the tone positive and supportive, and avoid technical jargon unless specifically requested by the user.

  • 代码解释器:启用此功能可使助手具备代码解释器能力,允许其在沙盒环境中编写和执行代码。对于需要计算、数据分析或任何基于逻辑的处理的任务,请启用此工具。

¥Code Interpreter: Turn on to enable the code interpreter for the assistant, where it can write and execute code in a sandbox environment. Enable this tool for tasks that require computations, data analysis, or any logic-based processing.

  • 知识检索:启用此功能可使助手具备知识检索能力,允许其访问外部资源或已连接的知识库。有关更多信息,请参阅 文件搜索 | OpenAI 平台

¥Knowledge Retrieval: Turn on to enable knowledge retrieval for the assistant, allowing it to access external sources or a connected knowledge base. Refer to File Search | OpenAI Platform for more information.

  • 文件:选择要上传到外部知识库的文件。使用“上传文件”操作添加更多文件。

    ¥Files: Select a file to upload for your external knowledge source. Use Upload a File operation to add more files.

选项#

¥Options

  • 输出随机性(温度):调整响应的随机性。取值范围为 0.0(确定性)到 1.0(最大随机性)。我们建议修改此项或输出随机性(Top P),但不要同时修改两者。从中等温度(大约 0.7)开始,并根据观察到的输出进行调整。如果响应过于重复或僵硬,则提高温度。如果他们的工作流过于混乱或偏离轨道,请降低其优先级。默认为 1.0

¥Output Randomness (Temperature): Adjust the randomness of the response. The range is between 0.0 (deterministic) and 1.0 (maximum randomness). We recommend altering this or Output Randomness (Top P) but not both. Start with a medium temperature (around 0.7) and adjust based on the outputs you observe. If the responses are too repetitive or rigid, increase the temperature. If they’re too chaotic or off-track, decrease it. Defaults to 1.0.

  • 输出随机性(前 P 个元素):调整 Top P 设置以控制助手响应的多样性。例如,0.5 表示考虑所有似然加权选项的一半。我们建议修改此项或输出随机性(温度),但不要同时修改两者。默认为 1.0

¥Output Randomness (Top P): Adjust the Top P setting to control the diversity of the assistant's responses. For example, 0.5 means half of all likelihood-weighted options are considered. We recommend altering this or Output Randomness (Temperature) but not both. Defaults to 1.0.

  • 如果助手已存在,则失败:如果启用,如果已存在同名助手,则操作将失败。

¥Fail if Assistant Already Exists: If enabled, the operation will fail if an assistant with the same name already exists.

有关更多信息,请参阅 创建助手 | OpenAI 文档。

¥Refer to Create assistant | OpenAI documentation for more information.

删除助手#

¥Delete an Assistant

使用此操作可从你的账户中删除现有助手。

¥Use this operation to delete an existing assistant from your account.

请输入以下参数:

¥Enter these parameters:

¥Credential to connect with: Create or select an existing OpenAI credential.

  • 资源:选择“助手”。

¥Resource: Select Assistant.

  • 操作:选择删除助手。

¥Operation: Select Delete an Assistant.

  • 助手:选择要从列表中删除或按 ID 删除的助手。

¥Assistant: Select the assistant you want to delete From list or By ID.

有关更多信息,请参阅 删除助手 | OpenAI 文档。

¥Refer to Delete assistant | OpenAI documentation for more information.

列出助手#

¥List Assistants

使用此操作可检索组织中的助理列表。

¥Use this operation to retrieve a list of assistants in your organization.

¥Credential to connect with: Create or select an existing OpenAI credential.

  • 资源:选择“助手”。

¥Resource: Select Assistant.

  • 操作:选择“列表助手”。

¥Operation: Select List Assistants.

选项#

¥Options

  • 简化输出:启用此功能可返回简化的响应版本,而非原始数据。此选项默认启用。

¥Simplify Output: Turn on to return a simplified version of the response instead of the raw data. This option is enabled by default.

有关更多信息,请参阅 列出助手 | OpenAI 文档。

¥Refer to List assistants | OpenAI documentation for more information.

向助手发送消息#

¥Message an Assistant

使用此操作向助手发送消息并接收响应。

¥Use this operation to send a message to an assistant and receive a response.

请输入以下参数:

¥Enter these parameters:

¥Credential to connect with: Create or select an existing OpenAI credential.

  • 资源:选择“助手”。

¥Resource: Select Assistant.

  • 操作:选择“给助理发送消息”。

¥Operation: Select Message an Assistant.

  • 助手:选择要发送消息的助手。

¥Assistant: Select the assistant you want to message.

  • 提示:输入要发送给助手的文本提示或消息。

¥Prompt: Enter the text prompt or message that you want to send to the assistant.

  • 已连接的聊天触发节点:自动使用前一个节点的 chatInput 字段的输入。

    ¥Connected Chat Trigger Node: Automatically use the input from a previous node's chatInput field.

  • 请在下方定义:手动定义提示,方法是输入静态文本或使用表达式引用先前节点的数据。

    ¥Define Below: Manually define the prompt by entering static text or using an expression to reference data from previous nodes.

选项#

¥Options

  • 基本 URL:输入助手用于发出 API 请求的基本 URL。此选项可用于指示助手使用其他 LLM 提供商提供的、与 OpenAI 兼容的 API 的端点。

¥Base URL: Enter the base URL that the assistant should use for making API requests. This option is useful for directing the assistant to use endpoints provided by other LLM providers that offer an OpenAI-compatible API.

  • 最大重试次数:指定助手在操作失败时应重试的次数。

¥Max Retries: Specify the number of times the assistant should retry an operation in case of failure.

  • 超时:设置助手等待响应的最长时间(以毫秒为单位),超过此时间助手将超时。使用此选项可防止操作期间出现长时间等待。

¥Timeout: Set the maximum amount of time in milliseconds, that the assistant should wait for a response before timing out. Use this option to prevent long waits during operations.

  • 保留原始工具:关闭此选项以移除与助手关联的原始工具。如果你希望暂时移除此特定操作所需的工具,请使用此选项。

¥Preserve Original Tools: Turn off to remove the original tools associated with the assistant. Use this if you want to temporarily remove tools for this specific operation.

有关更多信息,请参阅 助手 | OpenAI 文档。

¥Refer to Assistants | OpenAI documentation for more information.

更新助手#

¥Update an Assistant

使用此操作更新现有助手的详细信息。

¥Use this operation to update the details of an existing assistant.

请输入以下参数:

¥Enter these parameters:

¥Credential to connect with: Create or select an existing OpenAI credential.

  • 资源:选择“助手”。

¥Resource: Select Assistant.

  • 操作:选择“更新助手”。

¥Operation: Select Update an Assistant.

  • 助手:选择要更新的助手。

¥Assistant: Select the assistant you want to update.

选项#

¥Options

  • 代码解释器:启用此功能可使助手具备代码解释器能力,允许其在沙盒环境中编写和执行代码。对于需要计算、数据分析或任何基于逻辑的处理的任务,请启用此工具。

¥Code Interpreter: Turn on to enable the code interpreter for the assistant, where it can write and execute code in a sandbox environment. Enable this tool for tasks that require computations, data analysis, or any logic-based processing.

  • 描述:输入助手的描述。最大长度为 512 个字符。

¥Description: Enter the description of the assistant. The maximum length is 512 characters.

1
A virtual assistant that helps users with daily tasks, including setting reminders, answering general questions, and providing quick information.

  • 指令:输入助手使用的系统指令。最大长度为 32,768 个字符。使用此选项指定模型在回复中使用的角色。

¥Instructions: Enter the system instructions that the assistant uses. The maximum length is 32,768 characters. Use this to specify the persona used by the model in its replies.

1
Always respond in a friendly and engaging manner. When a user asks a question, provide a concise answer first, followed by a brief explanation or additional context if necessary. If the question is open-ended, offer a suggestion or ask a clarifying question to guide the conversation. Keep the tone positive and supportive, and avoid technical jargon unless specifically requested by the user.

  • 知识检索:启用此功能可使助手具备知识检索能力,允许其访问外部资源或已连接的知识库。有关更多信息,请参阅 文件搜索 | OpenAI 平台

¥Knowledge Retrieval: Turn on to enable knowledge retrieval for the assistant, allowing it to access external sources or a connected knowledge base. Refer to File Search | OpenAI Platform for more information.

¥Files: Select a file to upload for your external knowledge source. Use Upload a File operation to add more files. Note that this only updates the Code Interpreter tool, not the File Search tool.

  • 模型:选择助手将使用的模型。如果你不确定使用哪个模型,如果你需要高智能,请尝试 gpt-4o;如果你需要最快的速度和最低的成本,请尝试 gpt-4o-mini。有关更多信息,请参阅 模型概览 | OpenAI 平台

¥Model: Select the model that the assistant will use. If you’re not sure which model to use, try gpt-4o if you need high intelligence or gpt-4o-mini if you need the fastest speed and lowest cost. Refer to Models overview | OpenAI Platform for more information.

  • 名称:请输入助手的名称。最大长度为 256 个字符。

¥Name: Enter the name of the assistant. The maximum length is 256 characters.

  • 移除所有自定义工具(功能):启用此功能可从助手中移除所有自定义工具(功能)。

¥Remove All Custom Tools (Functions): Turn on to remove all custom tools (functions) from the assistant.

  • 输出随机性(温度):调整响应的随机性。取值范围为 0.0(确定性)到 1.0(最大随机性)。我们建议修改此项或输出随机性(Top P),但不要同时修改两者。从中等温度(大约 0.7)开始,并根据观察到的输出进行调整。如果响应过于重复或僵硬,则提高温度。如果他们的工作流过于混乱或偏离轨道,请降低其优先级。默认为 1.0

¥Output Randomness (Temperature): Adjust the randomness of the response. The range is between 0.0 (deterministic) and 1.0 (maximum randomness). We recommend altering this or Output Randomness (Top P) but not both. Start with a medium temperature (around 0.7) and adjust based on the outputs you observe. If the responses are too repetitive or rigid, increase the temperature. If they’re too chaotic or off-track, decrease it. Defaults to 1.0.

  • 输出随机性(前 P 个元素):调整 Top P 设置以控制助手响应的多样性。例如,0.5 表示考虑所有似然加权选项的一半。我们建议修改此项或输出随机性(温度),但不要同时修改两者。默认为 1.0

¥Output Randomness (Top P): Adjust the Top P setting to control the diversity of the assistant's responses. For example, 0.5 means half of all likelihood-weighted options are considered. We recommend altering this or Output Randomness (Temperature) but not both. Defaults to 1.0.

有关更多信息,请参阅 修改助手 | OpenAI 文档。

¥Refer to Modify assistant | OpenAI documentation for more information.

常见问题#

¥Common issues

有关常见错误或问题以及建议的解决方法,请参阅 常见问题

¥For common errors or issues and suggested resolution steps, refer to Common Issues.