send context window with task started (#2752)

- Send context window with task started
- Accounting for changing the model per turn
This commit is contained in:
Ahmed Ibrahim
2025-08-27 00:04:21 -07:00
committed by GitHub
parent 4b6c6ce98f
commit d0e06f74e2
7 changed files with 44 additions and 10 deletions

View File

@@ -35,6 +35,7 @@ use crate::flags::CODEX_RS_SSE_FIXTURE;
use crate::model_family::ModelFamily;
use crate::model_provider_info::ModelProviderInfo;
use crate::model_provider_info::WireApi;
use crate::openai_model_info::get_model_info;
use crate::openai_tools::create_tools_json_for_responses_api;
use crate::protocol::TokenUsage;
use crate::user_agent::get_codex_user_agent;
@@ -90,6 +91,12 @@ impl ModelClient {
}
}
pub fn get_model_context_window(&self) -> Option<u64> {
self.config
.model_context_window
.or_else(|| get_model_info(&self.config.model_family).map(|info| info.context_window))
}
/// Dispatches to either the Responses or Chat implementation depending on
/// the provider config. Public callers always invoke `stream()` the
/// specialised helpers are private to avoid accidental misuse.