-
Notifications
You must be signed in to change notification settings - Fork 3.8k
fix(providers): support per-model request_timeout in model_list #733
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 2 commits
d4fd0ba
9e0408d
9d3f0af
01ba912
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 |
|---|---|---|
|
|
@@ -34,13 +34,27 @@ type Provider struct { | |
| httpClient *http.Client | ||
| } | ||
|
|
||
| const defaultRequestTimeout = 120 * time.Second | ||
|
|
||
| func NewProvider(apiKey, apiBase, proxy string) *Provider { | ||
| return NewProviderWithMaxTokensField(apiKey, apiBase, proxy, "") | ||
| } | ||
|
|
||
| func NewProviderWithMaxTokensField(apiKey, apiBase, proxy, maxTokensField string) *Provider { | ||
| return NewProviderWithMaxTokensFieldAndTimeout(apiKey, apiBase, proxy, maxTokensField, 0) | ||
| } | ||
|
|
||
| func NewProviderWithMaxTokensFieldAndTimeout( | ||
|
||
| apiKey, apiBase, proxy, maxTokensField string, | ||
| requestTimeoutSeconds int, | ||
| ) *Provider { | ||
| timeout := defaultRequestTimeout | ||
| if requestTimeoutSeconds > 0 { | ||
| timeout = time.Duration(requestTimeoutSeconds) * time.Second | ||
| } | ||
|
|
||
| client := &http.Client{ | ||
| Timeout: 120 * time.Second, | ||
| Timeout: timeout, | ||
| } | ||
|
|
||
| if proxy != "" { | ||
|
|
||
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.
Can I bother you with the addition of these lines into other READMEs? AI generated translation is fine.