Skip to content

Commit e4e0e63

Browse files
fix quick start code
Change-Id: I93764e48c401f01ab12169938b7c54070fc46a90
1 parent 420e3e0 commit e4e0e63

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

content/zh/docs/eino/quick_start/agent_llm_with_tools.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,12 @@ func (lt *ListTodoTool) InvokableRun(ctx context.Context, argumentsInJSON string
115115

116116
```go
117117
import (
118-
"github.com/bytedance/eino-ext/components/tool/googlesearch"
118+
"github.com/bytedance/eino-ext/components/tool/duckduckgo"
119119
)
120120

121121
func main() {
122-
// 创建 Google Search 工具
123-
searchTool, err := googlesearch.NewGoogleSearchTool(ctx, &googlesearch.Config{
124-
APIKey: os.Getenv("GOOGLE_API_KEY"), // Google API Key
125-
SearchEngineID: os.Getenv("GOOGLE_SEARCH_ENGINE_ID"), // 自定义搜索引擎 ID
126-
Num: 5, // 每次返回的结果数量
127-
Lang: "zh-CN", // 搜索结果的语言
128-
})
122+
// 创建 duckduckgo Search 工具
123+
searchTool, err := duckduckgo.NewTool(ctx, &duckduckgo.Config{})
129124
if err != nil {
130125
log.Fatal(err)
131126
}
@@ -198,7 +193,7 @@ func main() {
198193
}
199194

200195
// 构建完整的处理链
201-
chain := compose.NewChain[*schema.Message, []*schema.Message]()
196+
chain := compose.NewChain[[]*schema.Message, []*schema.Message]()
202197
chain.
203198
AppendChatModel(chatModel, compose.WithNodeName("chat_model")).
204199
AppendToolsNode(todoToolsNode, compose.WithNodeName("tools"))
@@ -210,8 +205,11 @@ func main() {
210205
}
211206

212207
// 运行示例
213-
resp, err := agent.Invoke(context.Background(), &schema.Message{
214-
Content: "帮我创建一个明天下午3点截止的待办事项:准备Eino项目演示文稿",
208+
resp, err := agent.Invoke(context.Background(), []*schema.Message{
209+
{
210+
Role: schema.User,
211+
Content: "添加一个学习 Eino 的 TODO,同时搜索一下 cloudwego/eino 的仓库地址",
212+
},
215213
})
216214
if err != nil {
217215
log.Fatal(err)

0 commit comments

Comments
 (0)