Skip to content

Commit 9e58076

Browse files
authored
chore: read model field off of Config instead of maintaining the parallel field (#1525)
#1524 introduced the new `config` field on `ModelClient`, so this does the post-PR cleanup to remove the now-unnecessary `model` field.
1 parent 8a424fc commit 9e58076

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

codex-rs/core/src/client.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ use std::sync::Arc;
4242
#[derive(Clone)]
4343
pub struct ModelClient {
4444
config: Arc<Config>,
45-
model: String,
4645
client: reqwest::Client,
4746
provider: ModelProviderInfo,
4847
effort: ReasoningEffortConfig,
@@ -56,10 +55,8 @@ impl ModelClient {
5655
effort: ReasoningEffortConfig,
5756
summary: ReasoningSummaryConfig,
5857
) -> Self {
59-
let model = config.model.clone();
6058
Self {
6159
config,
62-
model: model.to_string(),
6360
client: reqwest::Client::new(),
6461
provider,
6562
effort,
@@ -75,9 +72,13 @@ impl ModelClient {
7572
WireApi::Responses => self.stream_responses(prompt).await,
7673
WireApi::Chat => {
7774
// Create the raw streaming connection first.
78-
let response_stream =
79-
stream_chat_completions(prompt, &self.model, &self.client, &self.provider)
80-
.await?;
75+
let response_stream = stream_chat_completions(
76+
prompt,
77+
&self.config.model,
78+
&self.client,
79+
&self.provider,
80+
)
81+
.await?;
8182

8283
// Wrap it with the aggregation adapter so callers see *only*
8384
// the final assistant message per turn (matching the
@@ -111,11 +112,11 @@ impl ModelClient {
111112
return stream_from_fixture(path).await;
112113
}
113114

114-
let full_instructions = prompt.get_full_instructions(&self.model);
115-
let tools_json = create_tools_json_for_responses_api(prompt, &self.model)?;
115+
let full_instructions = prompt.get_full_instructions(&self.config.model);
116+
let tools_json = create_tools_json_for_responses_api(prompt, &self.config.model)?;
116117
let reasoning = create_reasoning_param_for_request(&self.config, self.effort, self.summary);
117118
let payload = ResponsesApiRequest {
118-
model: &self.model,
119+
model: &self.config.model,
119120
instructions: &full_instructions,
120121
input: &prompt.input,
121122
tools: &tools_json,

0 commit comments

Comments
 (0)