Skip to content

Conversation

@liuzengh
Copy link
Contributor

No description provided.

maxURLs = 20
)

// Option configures the WebFetch tool.
Copy link
Contributor Author

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

Copy link
Contributor Author

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
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 95.20548% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.33912%. Comparing base (42a1bba) to head (d4f29da).

Files with missing lines Patch % Lines
tool/webfetch/httpfetch/fetch.go 95.65217% 4 Missing and 3 partials ⚠️
tool/webfetch/geminifetch/fetch.go 93.50649% 3 Missing and 2 partials ⚠️
tool/webfetch/internal/urlfilter/filter.go 96.29630% 1 Missing and 1 partial ⚠️
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     
Flag Coverage Δ
unittests 87.33912% <95.20548%> (+0.05838%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@liuzengh liuzengh changed the title WIP(tool): add web fetch tool: add web fetch Nov 24, 2025
"strings"
)

// URLFilter is a function that determines if a URL should be allowed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文件名改为url_filter.go

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor Author

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

文档,example看看

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@liuzengh liuzengh requested a review from hyprh November 24, 2025 13:37
// WithHTTPClient sets the HTTP client.
func WithHTTPClient(c *http.Client) Option {
return func(cfg *config) {
cfg.httpClient = c
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我们一些工具的http client,有必要接入内网的http不

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以考虑接入,当作一个 feture,再另外的 PR 里面来修改 http client

Copy link
Contributor Author

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 == "" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

genminifetch 和 claudefetch 需要抽象一个接口吗,方便后续其他组件,比如knowledge 复用

Copy link
Contributor Author

@liuzengh liuzengh Nov 25, 2025

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 并不相同,上层统一的表示的话,要么会丢失一些各个模型特有的东西,要么会导致统一的表示过于臃肿。

Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs 下的中英文档也可以更新

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants