Skip to content

Commit dc71b88

Browse files
committed
openai: responses API model checks and add tests
Extend model checks to include gpt-5.2-codex and gpt-5.2-pro. Signed-off-by: Yusuke Shimizu <stm1051212@gmail.com>
1 parent 4d49fd5 commit dc71b88

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

crates/goose/src/providers/openai.rs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@ impl OpenAiProvider {
200200
}
201201

202202
fn uses_responses_api(model_name: &str) -> bool {
203-
model_name.starts_with("gpt-5-codex") || model_name.starts_with("gpt-5.1-codex")
203+
model_name.starts_with("gpt-5-codex")
204+
|| model_name.starts_with("gpt-5.1-codex")
205+
|| model_name.starts_with("gpt-5.2-codex")
206+
|| model_name.starts_with("gpt-5.2-pro")
204207
}
205208

206209
async fn post(
@@ -520,3 +523,25 @@ impl EmbeddingCapable for OpenAiProvider {
520523
.collect())
521524
}
522525
}
526+
527+
#[cfg(test)]
528+
mod tests {
529+
use super::*;
530+
531+
#[test]
532+
fn uses_responses_api_for_supported_models() {
533+
assert!(OpenAiProvider::uses_responses_api("gpt-5-codex"));
534+
assert!(OpenAiProvider::uses_responses_api("gpt-5-codex-2025-12-11"));
535+
assert!(OpenAiProvider::uses_responses_api("gpt-5.1-codex"));
536+
assert!(OpenAiProvider::uses_responses_api(
537+
"gpt-5.1-codex-2025-12-11"
538+
));
539+
assert!(OpenAiProvider::uses_responses_api("gpt-5.2-codex"));
540+
assert!(OpenAiProvider::uses_responses_api(
541+
"gpt-5.2-codex-2025-12-11"
542+
));
543+
assert!(OpenAiProvider::uses_responses_api("gpt-5.2-pro"));
544+
assert!(OpenAiProvider::uses_responses_api("gpt-5.2-pro-2025-12-11"));
545+
assert!(!OpenAiProvider::uses_responses_api("gpt-4o"));
546+
}
547+
}

0 commit comments

Comments
 (0)