From 1f32a661bb5667a20c5b3286459d010abc72ac3a Mon Sep 17 00:00:00 2001 From: TanKimzeg <1964375900@qq.com> Date: Fri, 15 May 2026 17:00:16 +0800 Subject: [PATCH] feat: add `reasoning_effort` and `extra_body` field to `ChatCompletionRequest` --- src/chat.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/chat.rs b/src/chat.rs index aeba4ca..ba886a7 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -179,6 +179,13 @@ pub enum ChatCompletionMessageRole { #[builder(name = "ChatCompletionBuilder")] #[builder(setter(strip_option, into))] pub struct ChatCompletionRequest { + /// Additional JSON properties to merge into the request body. + /// + /// If a key overlaps with a typed field, the typed field value wins. + #[builder(default)] + #[serde(flatten)] + #[serde(skip_serializing_if = "Option::is_none")] + extra_body: Option>, /// ID of the model to use. Currently, only `gpt-3.5-turbo`, `gpt-3.5-turbo-0301` and `gpt-4` /// are supported. model: String, @@ -220,6 +227,10 @@ pub struct ChatCompletionRequest { #[builder(default)] #[serde(skip_serializing_if = "Option::is_none")] max_completion_tokens: Option, + /// Constrains effort on reasoning for reasoning-capable models. + #[builder(default)] + #[serde(skip_serializing_if = "Option::is_none")] + reasoning_effort: Option, /// Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. /// /// [See more information about frequency and presence penalties.](https://platform.openai.com/docs/api-reference/parameter-details)