Upload agents.md
Browse files- docs/source/zh/agents.md +52 -0
docs/source/zh/agents.md
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Agents(智能体)
|
2 |
+
|
3 |
+
<Tip warning={true}>
|
4 |
+
|
5 |
+
Smolagents 是一个实验性的 API,可能会随时发生变化。由于 API 或底层模型可能发生变化,代理返回的结果也可能有所不同。
|
6 |
+
|
7 |
+
</Tip>
|
8 |
+
|
9 |
+
要了解有关智能体和工具的更多信息,请务必阅读[入门指南](../index)。本页面包含基础类的 API 文档。
|
10 |
+
|
11 |
+
## 智能体(Agents)
|
12 |
+
|
13 |
+
我们的智能体继承自 [`MultiStepAgent`],这意味着它们可以执行多步操作,每一步包含一个思考(thought),然后是一个工具调用和执行。请阅读[概念指南](../conceptual_guides/react)以了解更多信息。
|
14 |
+
|
15 |
+
我们提供两种类型的代理,它们基于主要的 [`Agent`] 类:
|
16 |
+
- [`CodeAgent`] 是默认代理,它以 Python 代码编写工具调用。
|
17 |
+
- [`ToolCallingAgent`] 以 JSON 编写工具调用。
|
18 |
+
|
19 |
+
两者在初始化时都需要提供参数 `model` 和工具列表 `tools`。
|
20 |
+
|
21 |
+
### 智能体类
|
22 |
+
|
23 |
+
[[autodoc]] MultiStepAgent
|
24 |
+
|
25 |
+
[[autodoc]] CodeAgent
|
26 |
+
|
27 |
+
[[autodoc]] ToolCallingAgent
|
28 |
+
|
29 |
+
### ManagedAgent
|
30 |
+
|
31 |
+
_此类自 1.8.0 起已被弃用:现在您只需向普通代理传递 `name` 和 `description` 属性即可使其可被管理代理调用。_
|
32 |
+
|
33 |
+
### stream_to_gradio
|
34 |
+
|
35 |
+
[[autodoc]] stream_to_gradio
|
36 |
+
|
37 |
+
### GradioUI
|
38 |
+
|
39 |
+
> [!TIP]
|
40 |
+
> 您必须安装 `gradio` 才能使用 UI。如果尚未安装,请运行 `pip install smolagents[gradio]`。
|
41 |
+
|
42 |
+
[[autodoc]] GradioUI
|
43 |
+
|
44 |
+
## 提示(Prompts)
|
45 |
+
|
46 |
+
[[autodoc]] smolagents.agents.PromptTemplates
|
47 |
+
|
48 |
+
[[autodoc]] smolagents.agents.PlanningPromptTemplate
|
49 |
+
|
50 |
+
[[autodoc]] smolagents.agents.ManagedAgentPromptTemplate
|
51 |
+
|
52 |
+
[[autodoc]] smolagents.agents.FinalAnswerPromptTemplate
|