From 64b69f82aa3f7610eb8b7bc74e719f578e3c7f37 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Thu, 10 Jul 2025 14:31:37 -0700 Subject: [PATCH] chore: read model field off of Config instead of maintaining the parallel field --- codex-rs/core/src/client.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/codex-rs/core/src/client.rs b/codex-rs/core/src/client.rs index 4eccd7fa1e..a644b9f6fd 100644 --- a/codex-rs/core/src/client.rs +++ b/codex-rs/core/src/client.rs @@ -42,7 +42,6 @@ use std::sync::Arc; #[derive(Clone)] pub struct ModelClient { config: Arc, - model: String, client: reqwest::Client, provider: ModelProviderInfo, effort: ReasoningEffortConfig, @@ -56,10 +55,8 @@ impl ModelClient { effort: ReasoningEffortConfig, summary: ReasoningSummaryConfig, ) -> Self { - let model = config.model.clone(); Self { config, - model: model.to_string(), client: reqwest::Client::new(), provider, effort, @@ -76,7 +73,7 @@ impl ModelClient { WireApi::Chat => { // Create the raw streaming connection first. let response_stream = - stream_chat_completions(prompt, &self.model, &self.client, &self.provider) + stream_chat_completions(prompt, &self.config.model, &self.client, &self.provider) .await?; // Wrap it with the aggregation adapter so callers see *only* @@ -111,11 +108,11 @@ impl ModelClient { return stream_from_fixture(path).await; } - let full_instructions = prompt.get_full_instructions(&self.model); - let tools_json = create_tools_json_for_responses_api(prompt, &self.model)?; + let full_instructions = prompt.get_full_instructions(&self.config.model); + let tools_json = create_tools_json_for_responses_api(prompt, &self.config.model)?; let reasoning = create_reasoning_param_for_request(&self.config, self.effort, self.summary); let payload = ResponsesApiRequest { - model: &self.model, + model: &self.config.model, instructions: &full_instructions, input: &prompt.input, tools: &tools_json,