@@ -115,17 +115,12 @@ func (lt *ListTodoTool) InvokableRun(ctx context.Context, argumentsInJSON string
115
115
116
116
``` go
117
117
import (
118
- " github.com/bytedance/eino-ext/components/tool/googlesearch "
118
+ " github.com/bytedance/eino-ext/components/tool/duckduckgo "
119
119
)
120
120
121
121
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 {})
129
124
if err != nil {
130
125
log.Fatal (err)
131
126
}
@@ -198,7 +193,7 @@ func main() {
198
193
}
199
194
200
195
// 构建完整的处理链
201
- chain := compose.NewChain [*schema.Message , []*schema.Message ]()
196
+ chain := compose.NewChain [[] *schema.Message , []*schema.Message ]()
202
197
chain.
203
198
AppendChatModel (chatModel, compose.WithNodeName (" chat_model" )).
204
199
AppendToolsNode (todoToolsNode, compose.WithNodeName (" tools" ))
@@ -210,8 +205,11 @@ func main() {
210
205
}
211
206
212
207
// 运行示例
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
+ },
215
213
})
216
214
if err != nil {
217
215
log.Fatal (err)
0 commit comments