Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions crates/goose/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,12 @@ impl ModelConfig {
fast_model_name: &str,
provider_name: &str,
) -> Result<Self, ConfigError> {
// Create a full ModelConfig for the fast model with proper canonical lookup
let fast_config = ModelConfig::new(fast_model_name)?.with_canonical_limits(provider_name);
let name = std::env::var("GOOSE_FAST_MODEL")
.ok()
.map(|v| v.trim().to_string())
.filter(|v| !v.is_empty())
.unwrap_or_else(|| fast_model_name.to_string());
Comment on lines +295 to +299

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Trim GOOSE_FAST_MODEL before constructing fast model config

The new override path checks v.trim().is_empty() but then passes the untrimmed String into ModelConfig::new, so values like " gpt-4o-mini " are treated as non-empty yet produce a model name with embedded whitespace. In that case auxiliary fast-model calls can fail with an invalid model identifier even though the intended model is correct; trimming the value before ModelConfig::new would make this override behave consistently with the emptiness check.

Useful? React with 👍 / 👎.

let fast_config = ModelConfig::new(&name)?.with_canonical_limits(provider_name);
self.fast_model_config = Some(Box::new(fast_config));
Ok(self)
}
Expand Down
4 changes: 4 additions & 0 deletions documentation/docs/guides/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ These are the minimum required variables to get started with goose.
|----------|---------|---------|---------|
| `GOOSE_PROVIDER` | Specifies the LLM provider to use | [See available providers](/docs/getting-started/providers#available-providers) | None (must be [configured](/docs/getting-started/providers#configure-provider-and-model)) |
| `GOOSE_MODEL` | Specifies which model to use from the provider | Model name (e.g., "gpt-4", "claude-sonnet-4-20250514") | None (must be [configured](/docs/getting-started/providers#configure-provider-and-model)) |
| `GOOSE_FAST_MODEL` | Overrides the provider's default fast model used for auxiliary calls (tool-selection, classification, session titles) | Model name (e.g., "gpt-4o-mini", "google/gemini-2.5-flash") | Provider-specific default |
| `GOOSE_TEMPERATURE` | Sets the [temperature](https://medium.com/@kelseyywang/a-comprehensive-guide-to-llm-temperature-%EF%B8%8F-363a40bbc91f) for model responses | Float between 0.0 and 1.0 | Model-specific default |
| `GOOSE_MAX_TOKENS` | Sets the maximum number of tokens for each model response (truncates longer responses) | Positive integer (e.g., 4096, 8192) | Model-specific default |

Expand All @@ -29,6 +30,9 @@ export GOOSE_PROVIDER="anthropic"
export GOOSE_MODEL="claude-sonnet-4-5-20250929"
export GOOSE_TEMPERATURE=0.7

# Override the fast model used for auxiliary calls (tool-selection, classification, etc.)
export GOOSE_FAST_MODEL="gpt-4o-mini"

# Set a lower limit for shorter interactions
export GOOSE_MAX_TOKENS=4096

Expand Down