Skip to content

Commit 02f0c51

Browse files
committed
fix picture bugs
1 parent 4d14d7f commit 02f0c51

File tree

4 files changed

+102
-54
lines changed

4 files changed

+102
-54
lines changed

docs/content/1.introduction/4.troubleshooting.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ navigation:
3434
2. **安装依赖失败,显示依赖安装空间不足**
3535
- VeFaaS 最大依赖安装大小默认为 250 MB,若需更大空间,请联系 VeFaaS 产品团队扩容。
3636

37-
3. **显示`[apig_gateway][][get_info][Error] ExceededQuota`
37+
3. **显示`[apig_gateway][][get_info][Error] ExceededQuota`**
38+
- ![网关超额报错](/images/troubleshooting-03.jpeg)
3839
- 火山引擎 APIG 中,Serveless 类型的网关实例最多只能有1个。需要指定唯一的网关实例。

docs/content/3.agent/1.agent.md

Lines changed: 97 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -93,55 +93,7 @@ print(response) # 北京天气晴朗,气温25°C。
9393

9494
下面提供了不同类型工作流智能体的定义方法:
9595

96-
#### 顺序类 `SequentialAgent`
97-
98-
#### 循环类 `LoopAgent`
99-
100-
```python [loop_agent.py]
101-
102-
```
103-
104-
#### 并行类 `ParallelAgent`
105-
106-
```python [parallel_agent.py]
107-
108-
```
109-
110-
### 选项
111-
112-
工作流 Agent 采用统一的参数:
113-
114-
::field-group
115-
::field{name="name" type="string"}
116-
智能体的名称
117-
::
118-
119-
::field{name="description" type="string"}
120-
默认为 `DEFAULT_DESCRIPTION` - 智能体的描述,在 A2A 场景下会有帮助
121-
::
122-
123-
::field{name="instruction" type="string"}
124-
默认为 `DEFAULT_INSTRUCTION` - 智能体的指令,例如函数调用的原则
125-
::
126-
127-
::field{name="sub_agents" type="list[BaseAgent]"}
128-
默认为 `[]` - 提供给该智能体的子智能体列表
129-
::
130-
131-
::field{name="tracers" type="list[BaseTracer]"}
132-
默认为 `[]` - 提供给该智能体的 tracer
133-
::
134-
::
135-
136-
::note
137-
更多兼容字段请参考 [Google ADK Agents 定义](https://github.com/google/adk-python/blob/main/src/google/adk/agents/)
138-
::
139-
140-
## 多智能体协作
141-
142-
使用 VeADK 可以构建多 Agent 协作, 主 Agent 通过 `sub_agents` 机制协调多个子 Agent 完成复杂任务。
143-
144-
### 自主决策 Agent
96+
#### LLM 模式
14597

14698
利用能够自主决策的 Agent 来定义一个生活提醒智能体,分别定义了三个智能体:
14799

@@ -182,9 +134,9 @@ print(response)
182134
# It's a comfortable and warm day. You can choose light and breathable clothes. For example, a short - sleeved T - shirt or a thin shirt paired with casual pants or a skirt would be great. Since it's sunny, don't forget to wear a hat and sunglasses to protect yourself from the sun. Also, you can carry a light jacket in case the temperature drops in the evening, but it might not be necessary. Enjoy your day in Beijing!
183135
```
184136

185-
### `SequentialAgent`
137+
#### 顺序类 `SequentialAgent`
186138

187-
```python [sequential_agent.py]
139+
```python[seq_agent.py]
188140
import asyncio
189141
190142
from veadk import Agent, Runner
@@ -210,14 +162,106 @@ response = asyncio.run(runner.run("你好"))
210162
print(response)
211163
```
212164

213-
### `LoopAgent`
165+
#### 循环类 `LoopAgent`
214166

215167
```python [loop_agent.py]
168+
import asyncio
169+
from veadk import Agent, Runner
170+
from veadk.agents.loop_agent import LoopAgent
171+
from google.adk.tools.tool_context import ToolContext
172+
173+
def exit_loop(tool_context: ToolContext):
174+
print(f" [Tool Call] exit_loop triggered by {tool_context.agent_name}")
175+
tool_context.actions.escalate = True
176+
return {}
177+
178+
planner_agent = Agent(
179+
name="planner_agent",
180+
description="Decomposes a complex task into smaller actionable steps.",
181+
instruction=(
182+
"Given the user's goal and current progress, decide the NEXT step to take. You don't need to execute the step, just describe it clearly. "
183+
"If all steps are done, respond with 'TASK COMPLETE'."
184+
),
185+
)
216186

187+
executor_agent = Agent(
188+
name="executor_agent",
189+
description="Executes a given step and returns the result.",
190+
instruction="Execute the provided step and describe what was done or what result was obtained. If you received 'TASK COMPLETE', you must call the 'exit_loop' function. Do not output any text.",
191+
tools=[exit_loop],
192+
)
193+
194+
root_agent = LoopAgent(
195+
sub_agents=[planner_agent, executor_agent],
196+
max_iterations=3, # Limit the number of loops to prevent infinite loops
197+
)
198+
199+
runner = Runner(root_agent)
200+
201+
response = asyncio.run(runner.run("帮我写一首三行的小诗,主题是秋天"))
202+
203+
print(response)
217204
```
218205

219-
### `ParallelAgent`
206+
#### 并行类 `ParallelAgent`
220207

221208
```python [parallel_agent.py]
209+
import asyncio
210+
211+
from veadk import Agent, Runner
212+
from veadk.agents.parallel_agent import ParallelAgent
213+
214+
pros_agent = Agent(
215+
name="pros_agent",
216+
description="An expert that identifies the advantages of a topic.",
217+
instruction="List and explain the positive aspects or advantages of the given topic.",
218+
)
222219

220+
cons_agent = Agent(
221+
name="cons_agent",
222+
description="An expert that identifies the disadvantages of a topic.",
223+
instruction="List and explain the negative aspects or disadvantages of the given topic.",
224+
)
225+
226+
root_agent = ParallelAgent(sub_agents=[pros_agent, cons_agent])
227+
228+
runner = Runner(root_agent)
229+
230+
response = asyncio.run(runner.run("请分析 LLM-as-a-Judge 这种评测模式的优劣"))
231+
232+
print(response)
223233
```
234+
235+
### 选项
236+
237+
工作流 Agent 采用统一的参数:
238+
239+
::field-group
240+
::field{name="name" type="string"}
241+
智能体的名称
242+
::
243+
244+
::field{name="description" type="string"}
245+
默认为 `DEFAULT_DESCRIPTION` - 智能体的描述,在 A2A 场景下会有帮助
246+
::
247+
248+
::field{name="instruction" type="string"}
249+
默认为 `DEFAULT_INSTRUCTION` - 智能体的指令,例如函数调用的原则
250+
::
251+
252+
::field{name="sub_agents" type="list[BaseAgent]"}
253+
默认为 `[]` - 提供给该智能体的子智能体列表
254+
::
255+
256+
::field{name="tracers" type="list[BaseTracer]"}
257+
默认为 `[]` - 提供给该智能体的 tracer
258+
::
259+
::
260+
261+
::note
262+
更多兼容字段请参考 [Google ADK Agents 定义](https://github.com/google/adk-python/blob/main/src/google/adk/agents/)
263+
::
264+
265+
## 多智能体协作
266+
267+
使用 VeADK 可以构建多 Agent 协作, 主 Agent 通过 `sub_agents` 机制协调多个子 Agent 完成复杂任务。

docs/nuxt.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ export default {
33
extends: ['docus'],
44
app: {
55
baseURL: '/veadk-python/'
6+
},
7+
image: {
8+
provider: 'none' // 禁用 IPX 图片优化
69
}
710
}
42.5 KB
Loading

0 commit comments

Comments
 (0)