Some will not just a chain of calls to LLMs/other tools, but an chain that on the user's input. In these types of , there is a “agent” which has to a suite of tools. on the user input, the agent can then which, if any, of these tools to call.

某些应用程序不仅需要对LLM/其他工具的预定调用链,还需要依赖于用户输入的未知链。在这些类型的链中,有一个“代理”可以访问一套工具。然后,根据用户输入,代理可以决定调用这些工具中的哪一个(如果有)。

At the , there are two main types of :

目前,有两种主要类型的代理:

: these an to take and take that one step at a time

操作代理:这些代理决定要执行的操作,并一次一步地执行该操作Plan-and- : these first a plan of to take, and then those one at a time.

计划和执行代理:这些代理首先确定要执行的行动计划,然后一次执行一个操作。

When you use each one?

什么时候应该使用每一个?

These two are also not – in fact, it is often best to have an Agent be in of the for the Plan and agent.

这两个代理也不是互斥的 – 事实上,通常最好让一个操作代理负责计划和执行代理的执行。

操作代理

The high-level of an Agent looks like:

操作代理的高级伪代码如下所示:

interface AgentStep {
  action: AgentAction;
  observation: string;
}
interface AgentAction {
  tool: string; // Tool.name
  toolInput: string; // Tool.call argument
}
interface AgentFinish {
  returnValues: object;
}
class Agent {
  plan(steps: AgentStep[], inputs: object): Promise;
}

Plan-and- ​ 计划和执行代理

The high level of a Plan-and- Agent looks like:

计划和执行代理的高级伪代码如下所示:

The is to use an as the and an Agent as the .

当前的实现是使用 作为计划者,使用 Agent 作为执行者。

Go ​ 更深入️ ️代理

️ ️操作代理

️Plan-and- Agent ️计划与执行代理

This shows how to use an agent that uses the Plan-and- to a query.

此示例演示如何使用使用计划和执行框架来回答查询的代理。

️ ️定制代理

️Agent ️代理执行人️Tools ️工具

️ ️集成

the tools you can use out of the box:

提供了以下开箱即用的工具:

️ with ️具有矢量存储的代理

This how to and . The use case for this is that you’ve your data into a store and want to with it in an .

本笔记本介绍了如何组合代理和载体存储。这样做的用例是,您已将数据引入矢量存储,并希望以代理方式与之交互。

️ ️聊天插件

This shows how to use .

这个例子展示了如何在抽象中使用插件。

️ Tools ️自定义工具

One for a tool that runs code is to use a .

创建运行自定义代码的工具的一个选项是使用 。

️Agent with AWS ️使用 AWS 的代理

Full docs here////index.html

完整文档 here////index.html

️Web Tool ️网页浏览器工具

The Tool gives your agent the to visit a and . It is to the agent as

Web浏览器工具使您的代理能够访问网站并提取信息。它被描述为代理

️Agent with NLA ️使用 NLA集成的代理

Full docs here///api/v1//docs

完整的文档在这里///api/v1//docs

️ ️工具包

️JSON Agent ️JSON 代理工具包

This shows how to load and use an agent with a JSON .

此示例演示如何通过 JSON 工具包加载和使用代理。

️ Agent ️ 代理工具包

This shows how to load and use an agent with a .

此示例演示如何通过 工具包加载和使用代理。

️SQL Agent ️SQL 代理工具包

This shows how to load and use an agent with a SQL .

此示例演示如何通过 SQL 工具包加载和使用代理。

️ Agent ️矢量存储代理工具包

This shows how to load and use an agent with a .

此示例演示如何加载和使用带有矢量存储工具包的代理。

️ ️附加功能

We offer a of for . You also look at the LLM- and Chat Model- .

我们为代理提供了许多附加功能。您还应该查看特定于LLM的功能和特定于聊天模型