-
Notifications
You must be signed in to change notification settings - Fork 3.6k
add proxy support for TavilySearchProvider #779
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,6 +129,7 @@ func (p *BraveSearchProvider) Search(ctx context.Context, query string, count in | |
| type TavilySearchProvider struct { | ||
| apiKey string | ||
| baseURL string | ||
| proxy string | ||
| } | ||
|
|
||
| func (p *TavilySearchProvider) Search(ctx context.Context, query string, count int) (string, error) { | ||
|
|
@@ -160,7 +161,10 @@ func (p *TavilySearchProvider) Search(ctx context.Context, query string, count i | |
| req.Header.Set("Content-Type", "application/json") | ||
| req.Header.Set("User-Agent", userAgent) | ||
|
|
||
| client := &http.Client{Timeout: 10 * time.Second} | ||
| client, err := createHTTPClient(p.proxy, 10*time.Second) | ||
| if err != nil { | ||
| return "", fmt.Errorf("failed to create http client: %w", err) | ||
| } | ||
| resp, err := client.Do(req) | ||
| if err != nil { | ||
| return "", fmt.Errorf("request failed: %w", err) | ||
|
|
@@ -420,6 +424,7 @@ func NewWebSearchTool(opts WebSearchToolOptions) *WebSearchTool { | |
| provider = &TavilySearchProvider{ | ||
| apiKey: opts.TavilyAPIKey, | ||
| baseURL: opts.TavilyBaseURL, | ||
| proxy: opts.Proxy, | ||
| } | ||
|
Comment on lines
424
to
428
|
||
| if opts.TavilyMaxResults > 0 { | ||
| maxResults = opts.TavilyMaxResults | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.