feat: support verbosity in model_family (#5821)
This commit is contained in:
@@ -223,18 +223,14 @@ impl ModelClient {
|
|||||||
|
|
||||||
let input_with_instructions = prompt.get_formatted_input();
|
let input_with_instructions = prompt.get_formatted_input();
|
||||||
|
|
||||||
let verbosity = match &self.config.model_family.family {
|
let verbosity = if self.config.model_family.support_verbosity {
|
||||||
family if family == "gpt-5" => self.config.model_verbosity,
|
self.config.model_verbosity
|
||||||
_ => {
|
} else {
|
||||||
if self.config.model_verbosity.is_some() {
|
warn!(
|
||||||
warn!(
|
"model_verbosity is set but ignored as the model does not support verbosity: {}",
|
||||||
"model_verbosity is set but ignored for non-gpt-5 model family: {}",
|
self.config.model_family.family
|
||||||
self.config.model_family.family
|
);
|
||||||
);
|
None
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Only include `text.verbosity` for GPT-5 family models
|
// Only include `text.verbosity` for GPT-5 family models
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ pub struct ModelFamily {
|
|||||||
/// This is applied when computing the effective context window seen by
|
/// This is applied when computing the effective context window seen by
|
||||||
/// consumers.
|
/// consumers.
|
||||||
pub effective_context_window_percent: i64,
|
pub effective_context_window_percent: i64,
|
||||||
|
|
||||||
|
/// If the model family supports setting the verbosity level when using Responses API.
|
||||||
|
pub support_verbosity: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! model_family {
|
macro_rules! model_family {
|
||||||
@@ -73,6 +76,7 @@ macro_rules! model_family {
|
|||||||
base_instructions: BASE_INSTRUCTIONS.to_string(),
|
base_instructions: BASE_INSTRUCTIONS.to_string(),
|
||||||
experimental_supported_tools: Vec::new(),
|
experimental_supported_tools: Vec::new(),
|
||||||
effective_context_window_percent: 95,
|
effective_context_window_percent: 95,
|
||||||
|
support_verbosity: false,
|
||||||
};
|
};
|
||||||
// apply overrides
|
// apply overrides
|
||||||
$(
|
$(
|
||||||
@@ -128,6 +132,7 @@ pub fn find_family_for_model(slug: &str) -> Option<ModelFamily> {
|
|||||||
"test_sync_tool".to_string(),
|
"test_sync_tool".to_string(),
|
||||||
],
|
],
|
||||||
supports_parallel_tool_calls: true,
|
supports_parallel_tool_calls: true,
|
||||||
|
support_verbosity: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Internal models.
|
// Internal models.
|
||||||
@@ -144,6 +149,7 @@ pub fn find_family_for_model(slug: &str) -> Option<ModelFamily> {
|
|||||||
"read_file".to_string(),
|
"read_file".to_string(),
|
||||||
],
|
],
|
||||||
supports_parallel_tool_calls: true,
|
supports_parallel_tool_calls: true,
|
||||||
|
support_verbosity: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Production models.
|
// Production models.
|
||||||
@@ -154,12 +160,14 @@ pub fn find_family_for_model(slug: &str) -> Option<ModelFamily> {
|
|||||||
reasoning_summary_format: ReasoningSummaryFormat::Experimental,
|
reasoning_summary_format: ReasoningSummaryFormat::Experimental,
|
||||||
base_instructions: GPT_5_CODEX_INSTRUCTIONS.to_string(),
|
base_instructions: GPT_5_CODEX_INSTRUCTIONS.to_string(),
|
||||||
apply_patch_tool_type: Some(ApplyPatchToolType::Freeform),
|
apply_patch_tool_type: Some(ApplyPatchToolType::Freeform),
|
||||||
|
support_verbosity: true,
|
||||||
)
|
)
|
||||||
} else if slug.starts_with("gpt-5") {
|
} else if slug.starts_with("gpt-5") {
|
||||||
model_family!(
|
model_family!(
|
||||||
slug, "gpt-5",
|
slug, "gpt-5",
|
||||||
supports_reasoning_summaries: true,
|
supports_reasoning_summaries: true,
|
||||||
needs_special_apply_patch_instructions: true,
|
needs_special_apply_patch_instructions: true,
|
||||||
|
support_verbosity: true,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@@ -179,5 +187,6 @@ pub fn derive_default_model_family(model: &str) -> ModelFamily {
|
|||||||
base_instructions: BASE_INSTRUCTIONS.to_string(),
|
base_instructions: BASE_INSTRUCTIONS.to_string(),
|
||||||
experimental_supported_tools: Vec::new(),
|
experimental_supported_tools: Vec::new(),
|
||||||
effective_context_window_percent: 95,
|
effective_context_window_percent: 95,
|
||||||
|
support_verbosity: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user