feat: Allow setting OpenAI timeout from config #1819
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
OpenAI Timeout Configuration
This update introduces a configurable timeout for the OpenAI client in
crates/goose/src/providers/openai.rs.Changes Made
Added
OPENAI_TIMEOUTConfig Key:ConfigKeynamedOPENAI_TIMEOUTwas added to themetadata()function of theOpenAiProvider.false), not required (false), and defaults to 600 seconds (Some("600")).Read Timeout from Config:
from_env()function, theOPENAI_TIMEOUTvalue is read from the global configuration usingconfig.get_param("OPENAI_TIMEOUT").u64and used to set the timeout when building thereqwest::Client.How to Configure
The
OPENAI_TIMEOUTcan be configured in two ways:Environment Variable:
Set the
OPENAI_TIMEOUTenvironment variable to the desired timeout value in seconds. For example:export OPENAI_TIMEOUT=1200goose configurecommand:Use the
goose configurecommand to set theOPENAI_TIMEOUTvalue.Environment variables take precedence over the configuration file settings.
After setting the configuration, restart your Goose agent or server for the changes to take effect.