Skip to content

Commit e4b0695

Browse files
authored
chore(builder): compatible with adk tool parsing (#232)
1 parent e2ec10b commit e4b0695

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

docs/content/3.agent/3.agent-builder.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ sub_agent_1:
2424
type: Agent
2525
name: weather_reporter
2626
tools:
27-
- module: veadk.tools.demo_tools # tool 所在的模块
28-
func: get_city_weather # tool 的函数名称
27+
- name: veadk.tools.demo_tools.get_city_weather # tool 所在的模块及函数名称
2928
```
3029
3130
```python [agent.py]

veadk/agent_builder.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ def _build(self, agent_config: dict) -> BaseAgent:
5252
tools = []
5353
if agent_config.get("tools", []):
5454
for tool in agent_config["tools"]:
55-
module_name = tool["module"]
56-
func_name = tool["func"]
57-
55+
name = tool["name"]
56+
module_name, func_name = name.rsplit(".", 1)
5857
module = importlib.import_module(module_name)
5958
func = getattr(module, func_name)
6059

0 commit comments

Comments
 (0)