-
Notifications
You must be signed in to change notification settings - Fork 55
tool: add web fetch #722
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
base: main
Are you sure you want to change the base?
tool: add web fetch #722
Conversation
| maxURLs = 20 | ||
| ) | ||
|
|
||
| // Option configures the WebFetch 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.
这边再加一个 domain filter 功能,应该就差不多了 https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-fetch-tool#how-to-use-web-fetch
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.
已增加url filter 功能,该功能是 domain filter 的超集
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #722 +/- ##
===================================================
+ Coverage 87.28073% 87.33912% +0.05838%
===================================================
Files 276 279 +3
Lines 35914 36206 +292
===================================================
+ Hits 31346 31622 +276
- Misses 2987 2996 +9
- Partials 1581 1588 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tool/webfetch/urlfilter.go
Outdated
| "strings" | ||
| ) | ||
|
|
||
| // URLFilter is a function that determines if a URL should be allowed. |
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.
文件名改为url_filter.go
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.
fixed
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.
重构下目前的文档结构:后面可以增加 LLM Server-Side 的 WebFetch
webfetch
├── README.md
├── claudefetch
│ └── go.mod
├── geminifetch
│ └── go.mod
├── httpfetch
│ ├── fetch.go
│ ├── fetch_real_test.go
│ ├── fetch_test.go
│ ├── go.mod
│ └── go.sum
└── internal
└── urlfilter
├── filter.go
└── filter_test.go
| @@ -0,0 +1,362 @@ | |||
| // | |||
| // Tencent is pleased to support the open source community by making trpc-agent-go available. | |||
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.
文档,example看看
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.
added
| // WithHTTPClient sets the HTTP client. | ||
| func WithHTTPClient(c *http.Client) Option { | ||
| return func(cfg *config) { | ||
| cfg.httpClient = c |
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.
我们一些工具的http client,有必要接入内网的http不
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.
可以考虑接入,当作一个 feture,再另外的 PR 里面来修改 http client
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.
| // This tool uses Gemini's URL Context feature to fetch and process web content. | ||
| // modelName: the Gemini model-id to use. | ||
| func NewTool(modelName string, opts ...Option) (tool.CallableTool, error) { | ||
| if modelName == "" { |
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.
genminifetch 和 claudefetch 需要抽象一个接口吗,方便后续其他组件,比如knowledge 复用
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.
knowledge 那边需要什么样的接口?目前设计 genminifetch , claudefetch, httpfetch 为独立的三个工具,因为genminifetch 和 claudefetch 的模型 API 并不相同,上层统一的表示的话,要么会丢失一些各个模型特有的东西,要么会导致统一的表示过于臃肿。
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,可以先这样,不暴露fetch的接口
| @@ -0,0 +1,59 @@ | |||
| module trpc.group/trpc-go/trpc-agent-go/examples/tool/webfetch/geminifetch | |||
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.
docs 下的中英文档也可以更新
No description provided.