async-openai icon indicating copy to clipboard operation
async-openai copied to clipboard

Add extra_body to CreateChatCompletionRequest

Open jfolz opened this issue 5 months ago • 1 comments

OpenAI's Python library allows adding extra arguments to the request body via the extra_body kwarg. This is useful to, e.g., control thinking modes for Qwen. This PR adds the extra_body field to CreateChatCompletionRequest to accomplish the same.

jfolz avatar Jun 04 '25 09:06 jfolz

This can be achieved with byot feature:

pub struct CustomCreateChatCompletionRequest {
    #[serde(flatten)]
    pub request: CreateChatCompletionRequest,
    #[serde(flatten)]
    pub extra_body: Option<Map<String, Value>>,
}

64bit avatar Jun 07 '25 18:06 64bit

Please consider using byot https://github.com/64bit/async-openai?tab=readme-ov-file#bring-your-own-types , hence closing

64bit avatar Nov 18 '25 22:11 64bit