From 30a4965c179477b22df5946872bd9368b60bf8e8 Mon Sep 17 00:00:00 2001
From: Yingjie He
Date: Thu, 17 Apr 2025 11:30:46 -0700
Subject: [PATCH] feat: support o4-mini model (#2247)
---
crates/goose/src/providers/formats/openai.rs | 11 +++++------
crates/goose/src/providers/google.rs | 4 ----
crates/goose/src/providers/openai.rs | 2 ++
.../settings_v2/extensions/ExtensionsSection.tsx | 2 +-
4 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/crates/goose/src/providers/formats/openai.rs b/crates/goose/src/providers/formats/openai.rs
index 6629b17d..5fc55c86 100644
--- a/crates/goose/src/providers/formats/openai.rs
+++ b/crates/goose/src/providers/formats/openai.rs
@@ -367,11 +367,10 @@ pub fn create_request(
));
}
- let is_o1 = model_config.model_name.starts_with("o1");
- let is_o3 = model_config.model_name.starts_with("o3");
+ let is_ox_model = model_config.model_name.starts_with("o");
// Only extract reasoning effort for O1/O3 models
- let (model_name, reasoning_effort) = if is_o1 || is_o3 {
+ let (model_name, reasoning_effort) = if is_ox_model {
let parts: Vec<&str> = model_config.model_name.split('-').collect();
let last_part = parts.last().unwrap();
@@ -391,7 +390,7 @@ pub fn create_request(
};
let system_message = json!({
- "role": if is_o1 || is_o3 { "developer" } else { "system" },
+ "role": if is_ox_model { "developer" } else { "system" },
"content": system
});
@@ -427,7 +426,7 @@ pub fn create_request(
.insert("tools".to_string(), json!(tools_spec));
}
// o1, o3 models currently don't support temperature
- if !is_o1 && !is_o3 {
+ if !is_ox_model {
if let Some(temp) = model_config.temperature {
payload
.as_object_mut()
@@ -438,7 +437,7 @@ pub fn create_request(
// o1 models use max_completion_tokens instead of max_tokens
if let Some(tokens) = model_config.max_tokens {
- let key = if is_o1 || is_o3 {
+ let key = if is_ox_model {
"max_completion_tokens"
} else {
"max_tokens"
diff --git a/crates/goose/src/providers/google.rs b/crates/goose/src/providers/google.rs
index 7216c185..91c50b4d 100644
--- a/crates/goose/src/providers/google.rs
+++ b/crates/goose/src/providers/google.rs
@@ -17,10 +17,6 @@ use url::Url;
pub const GOOGLE_API_HOST: &str = "https://generativelanguage.googleapis.com";
pub const GOOGLE_DEFAULT_MODEL: &str = "gemini-2.0-flash";
pub const GOOGLE_KNOWN_MODELS: &[&str] = &[
- "gemini-1.5-pro-latest",
- "gemini-1.5-pro",
- "gemini-1.5-flash-latest",
- "gemini-1.5-flash",
"gemini-2.0-flash",
"gemini-2.0-flash-lite-preview-02-05",
"gemini-2.0-flash-thinking-exp-01-21",
diff --git a/crates/goose/src/providers/openai.rs b/crates/goose/src/providers/openai.rs
index 91a12058..4bebda74 100644
--- a/crates/goose/src/providers/openai.rs
+++ b/crates/goose/src/providers/openai.rs
@@ -20,6 +20,8 @@ pub const OPEN_AI_KNOWN_MODELS: &[&str] = &[
"gpt-4-turbo",
"gpt-3.5-turbo",
"o1",
+ "o3",
+ "o4-mini",
];
pub const OPEN_AI_DOC_URL: &str = "https://platform.openai.com/docs/models";
diff --git a/ui/desktop/src/components/settings_v2/extensions/ExtensionsSection.tsx b/ui/desktop/src/components/settings_v2/extensions/ExtensionsSection.tsx
index 3aea58f6..99e28a9f 100644
--- a/ui/desktop/src/components/settings_v2/extensions/ExtensionsSection.tsx
+++ b/ui/desktop/src/components/settings_v2/extensions/ExtensionsSection.tsx
@@ -194,7 +194,7 @@ export default function ExtensionsSection({
-