Skip to content

Think Tool 节点#

¥Think Tool node

“思考工具”节点是一个 tool,它引导 agent 在回答问题前进行思考。本质上,它允许智能体在给出答案之前通过与自身对话来思考问题。这对于需要仔细思考的复杂查询尤其有用。

¥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.

Parameter resolution in sub-nodes

Sub-nodes behave differently to other nodes when processing multiple items using an expression.

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.

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.

模板和示例#

¥Templates and examples

Template widget placeholder.

提示示例#

¥Prompting example

例如,假设你向代理提出以下请求:

¥As an example, say you ask the agent:

Jack 正在看着 Anne。安妮正在看着乔治。Jack 已婚,George 未婚,我们不知道 Anne 是否已婚。已婚人士是否正在浏览未婚人士?

¥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:

我们掌握以下信息:1.2.3.4.5.

¥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.

我们需要判断已婚人士是否正在查看未婚人士的内容。让我们考虑 Anne 的两种情况:

¥We need to determine if a married person is looking at an unmarried person. Let's consider both cases for Anne:

案例 1:安妮已婚。

¥Case 1: Anne is married.

  • 如果 Anne 已婚,则她(已婚)正在查看 George(未婚)。在这种情况下,已婚人士(Anne)正在查看未婚人士(George)。

¥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).

案例 2:安妮未婚。

¥Case 2: Anne is unmarried.

  • 如果 Anne 未婚,则 Jack(已婚)正在查看 Anne(未婚)。在这种情况下,已婚人士(Jack)正在查看未婚人士(Anne)。

¥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:

是的,已婚人士正在查看未婚人士。在关于 Anne 婚姻状况的两种可能情况下,我们发现已婚人士(Jack 或 Anne)正在查看未婚人士(George 或 Anne)。

¥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

Refer to LangChain's documentation on tools for more information about tools in LangChain.

View n8n's Advanced AI documentation.