fix: support hyphenated GPT 6.1 Sol effort aliases (#12689)
This commit is contained in:
@@ -1929,14 +1929,14 @@ pub(crate) fn openai_reasoning_efforts_for_model(model_name: &str) -> &'static [
|
||||
&["high"]
|
||||
} else if normalized.contains("gpt-6") {
|
||||
// GPT-6 Astra and GPT-6.1 Sol require reasoning; GPT-6 Sol and Luna may disable it.
|
||||
let is_gpt_6_1_sol = normalized
|
||||
.match_indices("gpt-6.1-sol")
|
||||
.any(|(index, name)| {
|
||||
let is_gpt_6_1_sol = ["gpt-6.1-sol", "gpt-6-1-sol"].iter().any(|needle| {
|
||||
normalized.match_indices(needle).any(|(index, name)| {
|
||||
let (prefix, rest) = normalized.split_at(index);
|
||||
let (_, suffix) = rest.split_at(name.len());
|
||||
(prefix.is_empty() || prefix.ends_with(['/', '.', '-']))
|
||||
&& (suffix.is_empty() || suffix.starts_with(['-', '@']))
|
||||
});
|
||||
})
|
||||
});
|
||||
if normalized.contains("astra") || is_gpt_6_1_sol {
|
||||
&["low", "medium", "high", "xhigh", "max"]
|
||||
} else {
|
||||
@@ -3446,6 +3446,14 @@ mod tests {
|
||||
"gpt-6.1-sol@eu",
|
||||
"openai/gpt-6.1-sol-fast",
|
||||
"openai/gpt-6.1-sol-fast-high",
|
||||
"gpt-6-1-sol",
|
||||
"gpt-6-1-sol-high",
|
||||
"goose-gpt-6-1-sol",
|
||||
"catalog.schema.goose-gpt-6-1-sol",
|
||||
"openrouter/openai/gpt-6-1-sol",
|
||||
"gpt-6-1-sol@eu",
|
||||
"openai/gpt-6-1-sol-fast-high",
|
||||
"GOOSE-GPT-6-1-SOL",
|
||||
] {
|
||||
assert_eq!(
|
||||
openai_reasoning_effort_for_thinking(model, ThinkingEffort::Off),
|
||||
@@ -3477,6 +3485,24 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_gpt6_1_sol_effort_matching_respects_model_boundaries() {
|
||||
for model in [
|
||||
"gpt-6.1-solstice",
|
||||
"gpt-6-1-solstice",
|
||||
"gpt-6.10-sol",
|
||||
"gpt-6-10-sol",
|
||||
"notgpt-6-1-sol",
|
||||
"catalog.schema.notgpt-6-1-sol",
|
||||
] {
|
||||
assert_eq!(
|
||||
openai_reasoning_effort_for_thinking(model, ThinkingEffort::Off),
|
||||
Some("none".to_string()),
|
||||
"{model} must not match GPT 6.1 Sol"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_create_request_gpt5_pro_max_effort_uses_supported_level() -> anyhow::Result<()> {
|
||||
let model_config = test_model_config("gpt-5.2-pro-2025-12-11")
|
||||
|
||||
@@ -2043,8 +2043,16 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_responses_request_gpt6_astra_off_uses_low_not_none() {
|
||||
for model_name in ["gpt-6-astra", "data_workflow_tools.goose.goose-gpt-6-astra"] {
|
||||
fn test_responses_request_always_on_gpt6_off_uses_low_not_none() {
|
||||
for model_name in [
|
||||
"gpt-6-astra",
|
||||
"data_workflow_tools.goose.goose-gpt-6-astra",
|
||||
"gpt-6.1-sol",
|
||||
"gpt-6-1-sol",
|
||||
"goose-gpt-6-1-sol",
|
||||
"catalog.schema.goose-gpt-6-1-sol",
|
||||
"openrouter/openai/gpt-6-1-sol",
|
||||
] {
|
||||
let model_config = ModelConfig::new(model_name)
|
||||
.with_thinking_effort(crate::thinking::ThinkingEffort::Off);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user