Think Tool node#
Think Tool 节点#
The Think Tool node is a tool that invites an agent to do some thinking before answering. Essentially, it allows the agent to reflect on the question by talking to itself before providing an answer. In particular, this is useful for complex queries that require a thoughtful response.
Think Tool 节点是一个 工具,邀请 代理 在回答之前进行一些思考。从本质上讲,它允许代理在提供答案之前通过自言自语来反思问题。特别是,这对于需要深思熟虑回应的复杂查询很有用。
子节点中的参数解析
子节点在使用表达式处理多个项目时的行为与其他节点不同。
大多数节点,包括根节点,接受任意数量的项目作为输入,处理这些项目,并输出结果。您可以使用表达式引用输入项目,节点会依次为每个项目解析表达式。例如,给定五个 name
值的输入,表达式 {{ $json.name }}
会依次解析为每个名称。
在子节点中,表达式始终解析为第一个项目。例如,给定五个 name
值的输入,表达式 {{ $json.name }}
始终解析为第一个名称。
Templates and examples#
模板和示例#
Prompting example#
提示示例#
As an example, say you ask the agent:
例如,假设您向代理询问:
Jack is looking at Anne. Anne is looking at George. Jack is married, George is not, and we don't know if Anne is married. Is a married person looking at an unmarried person?
杰克在看安妮。安妮在看乔治。杰克已婚,乔治未婚,我们不知道安妮是否已婚。已婚人士在看未婚人士吗?
The agent will do its thinking with the tool:
代理将使用该工具进行思考:
We have the following information: 1. Jack is looking at Anne. 2. Anne is looking at George. 3. Jack is married. 4. George is not married. 5. We don't know if Anne is married or not.
我们有以下信息:1. 杰克在看安妮。2. 安妮在看乔治。3. 杰克已婚。4. 乔治未婚。5. 我们不知道安妮是否已婚。
We need to determine if a married person is looking at an unmarried person. Let's consider both cases for Anne:
我们需要确定已婚人士是否在看未婚人士。让我们考虑安妮的两种情况:
Case 1: Anne is married.
情况 1:安妮已婚。
If Anne is married, then she (married) is looking at George (unmarried). In this case, a married person (Anne) is looking at an unmarried person (George).
如果安妮已婚,那么她(已婚)在看乔治(未婚)。在这种情况下,已婚人士(安妮)在看未婚人士(乔治)。
Case 2: Anne is unmarried.
情况 2:安妮未婚。
If Anne is unmarried, then Jack (married) is looking at Anne (unmarried). In this case, a married person (Jack) is looking at an unmarried person (Anne).
如果安妮未婚,那么杰克(已婚)在看安妮(未婚)。在这种情况下,已婚人士(杰克)在看未婚人士(安妮)。
In both scenarios, we find that a married person is looking at an unmarried person. Therefore, the answer to the question is yes.
在这两种情况下,我们发现已婚人士都在看未婚人士。因此,问题的答案是肯定的。
and then afterward provide the answer:
然后提供答案:
Yes, a married person is looking at an unmarried person. In both possible scenarios regarding Anne's marital status, we find that a married individual (either Jack or Anne) is looking at an unmarried individual (either George or Anne).
是的,已婚人士在看未婚人士。在安妮婚姻状况的两种可能情况下,我们发现已婚个人(杰克或安妮)都在看未婚个人(乔治或安妮)。
Related resources#
相关资源#
有关 LangChain 中工具的更多信息,请参阅 LangChain 关于工具的文档。
查看 n8n 的高级 AI文档。
AI 术语表#
- completion(完成/补全): 完成是由 GPT 等模型生成的响应。
- hallucinations(幻觉): AI 中的幻觉是指大语言模型(LLM)错误地感知到不存在的模式或对象。
- vector database(向量数据库): 向量数据库存储信息的数学表示。与嵌入和检索器一起使用,创建 AI 在回答问题时可以访问的数据库。
- vector store(向量存储): 向量存储或向量数据库,存储信息的数学表示。与嵌入和检索器一起使用,创建 AI 在回答问题时可以访问的数据库。