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
24 changes: 23 additions & 1 deletion crates/goose-providers/src/formats/openai_responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,11 @@ pub fn create_responses_request(
None
};

let store = model_config.request_param::<bool>("store").unwrap_or(false);
let mut payload = json!({
"model": model_name,
"input": input_items,
"store": false,
"store": store,
});

if let Some(effort) = reasoning_effort {
Expand Down Expand Up @@ -1412,6 +1413,27 @@ mod tests {
);
}

#[test]
fn test_request_params_override_store() {
let model_config = ModelConfig {
model_name: "o3".to_string(),
context_limit: None,
temperature: None,
max_tokens: None,
toolshim: false,
toolshim_model: None,
request_params: Some(std::collections::HashMap::from([(
"store".to_string(),
serde_json::json!(true),
)])),
reasoning: None,
};

let result = create_responses_request(&model_config, "", &[], &[]).unwrap();

assert_eq!(result["store"], true);
}

#[test]
fn test_user_image_serialized_in_responses_request() {
use crate::conversation::message::Message;
Expand Down
4 changes: 4 additions & 0 deletions crates/goose/src/config/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,10 @@ impl Config {
self.set_param("GOOSE_THINKING_EFFORT", v)
}

pub fn get_openai_store(&self) -> Option<bool> {
self.get_param::<bool>("OPENAI_STORE").ok()
}

fn legacy_thinking_effort(&self) -> Option<ThinkingEffort> {
if let Ok(value) = self.get_param::<String>("CLAUDE_THINKING_TYPE") {
if let Some(effort) = match value.to_lowercase().as_str() {
Expand Down
20 changes: 18 additions & 2 deletions crates/goose/src/model_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn model_config_from_user_config_with_session_settings(
) -> Result<ModelConfig> {
let config = Config::global();
let model = base_model_config_from_user_config(model_name.as_ref())?;
let model = materialize_model_config_inner(model, false)?
let model = materialize_model_config_inner(model, provider_name, false)?
.with_context_limit(context_limit)
.with_inherited_session_settings_from(previous, request_params)
.with_default_thinking_effort(config.get_goose_thinking_effort());
Expand All @@ -36,12 +36,13 @@ pub fn model_config_from_user_config_with_session_settings(
}

pub fn materialize_model_config(provider_name: &str, model: ModelConfig) -> Result<ModelConfig> {
let model = materialize_model_config_inner(model, true)?;
let model = materialize_model_config_inner(model, provider_name, true)?;
Ok(model.with_canonical_limits(provider_name))
}

fn materialize_model_config_inner(
mut model: ModelConfig,
provider_name: &str,
include_default_thinking_effort: bool,
) -> Result<ModelConfig> {
let config = Config::global();
Expand All @@ -62,6 +63,10 @@ fn materialize_model_config_inner(
model = model.with_default_thinking_effort(config.get_goose_thinking_effort());
}

if provider_name == goose_providers::openai::OPEN_AI_PROVIDER_NAME {
model = apply_openai_request_params(model);
}

Ok(model)
}

Expand Down Expand Up @@ -148,6 +153,17 @@ async fn provider_default_fast_model(provider_name: &str) -> Option<String> {
.and_then(|entry| entry.metadata().fast_model.clone())
}

fn apply_openai_request_params(mut model: ModelConfig) -> ModelConfig {
let config = Config::global();
if let Some(store) = config.get_openai_store() {
model = model.with_merged_request_params(HashMap::from([(
"store".to_string(),
serde_json::json!(store),
)]));
}
model
}

fn base_model_config_from_user_config(model_name: &str) -> Result<ModelConfig> {
let config = Config::global();
let mut model = ModelConfig {
Expand Down
1 change: 1 addition & 0 deletions documentation/docs/getting-started/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ Need to connect to multiple OpenAI-compatible endpoints? [Configure custom provi
| `OPENAI_ORGANIZATION` | No | Organization ID for usage tracking and governance |
| `OPENAI_PROJECT` | No | Project identifier for resource management |
| `OPENAI_CUSTOM_HEADERS` | No | Additional headers to include in the request. Can be set via environment variable, configuration file, or CLI, in the format `HEADER_A=VALUE_A,HEADER_B=VALUE_B`. |
| `OPENAI_STORE` | No | Whether to persist the generated Responses API response for later retrieval via API. Defaults to `false`. |

#### Example Configurations

Expand Down
Loading