Skip to content

Conversation

@Jay4242
Copy link
Contributor

@Jay4242 Jay4242 commented Mar 23, 2025

OpenAI Timeout Configuration

This update introduces a configurable timeout for the OpenAI client in crates/goose/src/providers/openai.rs.

Changes Made

  1. Added OPENAI_TIMEOUT Config Key:

    • A new ConfigKey named OPENAI_TIMEOUT was added to the metadata() function of the OpenAiProvider.
    • This key allows users to specify the timeout value in seconds via configuration.
    • It is set as not secret (false), not required (false), and defaults to 600 seconds (Some("600")).
  2. Read Timeout from Config:

    • In the from_env() function, the OPENAI_TIMEOUT value is read from the global configuration using config.get_param("OPENAI_TIMEOUT").
    • If the value is not found in the config, it defaults to 600 seconds.
    • The retrieved value is parsed as a u64 and used to set the timeout when building the reqwest::Client.

How to Configure

The OPENAI_TIMEOUT can be configured in two ways:

  1. Environment Variable:

    Set the OPENAI_TIMEOUT environment variable to the desired timeout value in seconds. For example:

    export OPENAI_TIMEOUT=1200
  2. goose configure command:

    Use the goose configure command to set the OPENAI_TIMEOUT value.

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.

feat: Allow setting OpenAI timeout from config
@yingjiehe-xyz
Copy link
Contributor

run cargo fmt to fix the format?

@yingjiehe-xyz yingjiehe-xyz merged commit 0498d26 into block:main Mar 25, 2025
6 checks passed
michaelneale added a commit that referenced this pull request Mar 26, 2025
* main:
  ui: turn on extensions at startup (#1861)
  ui: models dropdown (#1860)
  fix: cli empty line (#1856)
  feat: Allow setting OpenAI timeout from config (#1819)
  feat: add retry for google (#1854)
  feat(extensions): add Java/JDK support for MCP servers (#1816)
  feat: extract `StdioProcessError(msg)` to try to display (#1855)
  fix: show window bugfix (#1840)
  fix: append the attachment path to the existing text in the input prompt (#1842)
  docs: updated docs for smart approval mode (#1853)
  styles: chat scroll interaction (#1837)
  ui: add description field  to modal (#1846)
  feat: use temp dir for extracting goose binary (#1838)
  ui: remove and update extensions (#1847)
  fix: disappearing user text when stopped (#1839)
cbruyndoncx pushed a commit to cbruyndoncx/goose that referenced this pull request Jul 20, 2025
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.

2 participants