mirror of
https://github.com/openai/codex.git
synced 2026-11-22 23:16:05 +00:00
Add max context window model metadata (#18382)
Adds max_context_window to model metadata and routes core context-window reads through resolved model info. Config model_context_window overrides are clamped to max_context_window when present; without an override, the model context_window is used.
This commit is contained in:
1 parent
e9c70fff3f
commit
5bb193aa88
17 files changed
+330
-6
No files matched your search
@@ -43,3 +43,32 @@ fn reasoning_summaries_override_false_is_noop_when_model_is_false() {
|
||||
|
||||
assert_eq!(updated, model);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn model_context_window_override_clamps_to_max_context_window() {
|
||||
let mut model = model_info_from_slug("unknown-model");
|
||||
model.context_window = Some(273_000);
|
||||
model.max_context_window = Some(400_000);
|
||||
let config = ModelsManagerConfig {
|
||||
model_context_window: Some(500_000),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let updated = with_config_overrides(model.clone(), &config);
|
||||
let mut expected = model;
|
||||
expected.context_window = Some(400_000);
|
||||
|
||||
assert_eq!(updated, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn model_context_window_uses_model_value_without_override() {
|
||||
let mut model = model_info_from_slug("unknown-model");
|
||||
model.context_window = Some(273_000);
|
||||
model.max_context_window = Some(400_000);
|
||||
let config = ModelsManagerConfig::default();
|
||||
|
||||
let updated = with_config_overrides(model.clone(), &config);
|
||||
|
||||
assert_eq!(updated, model);
|
||||
}
|
||||
Reference in new issue
Block a user