-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: impl duckduckgo search tool #5
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
license-eye has totally checked 53 files.
Valid | Invalid | Ignored | Fixed |
---|---|---|---|
39 | 14 | 0 | 0 |
Click to see the invalid file list
- components/tool/duckduckgo/ddgsearch/cache.go
- components/tool/duckduckgo/ddgsearch/client.go
- components/tool/duckduckgo/ddgsearch/client_test.go
- components/tool/duckduckgo/ddgsearch/doc.go
- components/tool/duckduckgo/ddgsearch/errors.go
- components/tool/duckduckgo/ddgsearch/search_news.go
- components/tool/duckduckgo/ddgsearch/search_news_test.go
- components/tool/duckduckgo/ddgsearch/search_text.go
- components/tool/duckduckgo/ddgsearch/types.go
- components/tool/duckduckgo/ddgsearch/utils.go
- components/tool/duckduckgo/ddgsearch/utils_test.go
- components/tool/duckduckgo/example/main.go
- components/tool/duckduckgo/search.go
- components/tool/duckduckgo/search_test.go
2ea8f5e
to
1be3206
Compare
components/tool/duckduckgo/README.md
Outdated
|
||
English | [简体中文](README_zh.md) | ||
|
||
A DuckDuckGo search tool implementation for [Eino](https://github.com/cloudwego/eino). This tool implements the `InvokableTool` interface, allowing it to be used with Eino's ChatModel interaction system with `ToolsNode`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这一段让模型帮忙改写下吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
虽然就是模型写的 😂,感觉不通顺吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥会有 ddgsearch 这个东西?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为 ddgsearch 比较复杂,预计后面不仅提供 Search text 的 tool,还有其他的,因此把实现统一封装到 ddgsearch 中,对标 langchain 中的 ddg_search 包
components/tool/duckduckgo/search.go
Outdated
return nil | ||
} | ||
|
||
func NewDDGS(ctx context.Context, config *Config) (*DDGS, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥定一个 NewDDGS,不直接合并到 NewTool 里面
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1,这个包不应该暴露,用户不应该看到这个函数
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那看放哪儿合适?按理这应该是一个三方实现,此处仅做简单封装即可,但目前 golang 中没有比较通用的 duckduckgo 的实现,因此需要自己实现。
之前准备放 internal 中,但也不大合适,对于 Config ,直接引用比自己重新封装一层更简单直接。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果完全放到当前包下并不暴露,则有点把 duckduckgo search 的实现和 tool 绑定太深了,也不利于复用。
如上一个 comment 中所说,duckduckgo 的调用实现比较复杂,而且 duckduckgo 不仅仅支持 text search 的能力,还有 news、image 等等的搜索、ai chat 等能力,把 duckduckgo 的能力聚合到其本身而不是 tool 中会更好
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
刚刚误解你们的意思了,理解成了 ddgsearch 这个目录要不暴露。func NewDDGS 已经改成了 newDDGS, 还是按照当前组件下仅暴露组件的创建和使用接口
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok,先按照 tool 的核心职责仅暴露必要的内容。 至于底层的通用函数,再根据实际需求到来时,再决定是否对外暴露。
components/tool/duckduckgo/search.go
Outdated
Retries int `json:"retries"` // default: 3 | ||
Timeout int `json:"timeout"` // max timeout in seconds, default: 10 | ||
MaxResults int `json:"max_results"` // default: 10 | ||
Proxy string `json:"proxy"` // default: "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个该咋用
ff6c4c7
to
62761b2
Compare
|
62761b2
to
93fcf86
Compare
go-test-coverage report:
|
@@ -0,0 +1,77 @@ | |||
// Copyright 2024 CloudWeGo Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个怎么不过来找我问一下, 使用统一的格式呀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a27fee7
to
9dabdc5
Compare
components/tool/duckduckgo/go.mod
Outdated
@@ -0,0 +1,48 @@ | |||
module github.com/cloudwego/eino-ext/components/tool/duckduckgo | |||
|
|||
go 1.21 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有必要这么高吗
9dabdc5
to
0ea0afe
Compare
0ea0afe
to
2a901b1
Compare
What type of PR is this?
feat
Check the PR title.
PR Title: feat(tool): add DuckDuckGo search tool implementation
Translate the PR title into Chinese.
feat(tool): 添加 DuckDuckGo 搜索工具实现
More detailed description for this PR
en:
This PR adds a DuckDuckGo search tool implementation that integrates with Eino's tool system. The implementation includes:
ddgsearch
package)zh:
本 PR 添加了一个与 Eino 工具系统集成的 DuckDuckGo 搜索工具实现。该实现包括:
ddgsearch
包)Which issue(s) this PR fixes:
N/A
The PR that updates user documentation:
Documentation is included in this PR with comprehensive README files in both English and Chinese.