Description
Hi Spring AI team,
I am integrating Doubao (Volcengine) models via their OpenAI-compatible endpoint. The API accepts a non-standard parameter in the request body, for example:
{
"model": "doubao-seed-1-6-250615",
"messages": [
{
"role": "user",
"content": [
{ "type": "text", "text": "研究深度思考模型与非深度思考模型区别" }
]
}
],
"thinking": { "type": "disabled" }
}
Currently in Spring AI:
ChatClient
only accepts aPrompt
plus*ChatOptions
(OpenAiChatOptions
,AzureOpenAiChatOptions
, etc.).- There doesn’t seem to be a way to pass arbitrary JSON fields like
thinking
into the request body. - Older issues/PRs mentioned
extra_body
orcustomOptions
, but in1.0.x
API these methods are not exposed.
Question
Is there currently a recommended way to add custom request options for provider-specific fields (like thinking
for Doubao, or any other vendor extension)?
- Should I implement my own
ChatModel
wrapper to inject the field? - Or is there a plan to support
extraBody
/customOptions
in the official*ChatOptions
classes?
Expected Behavior
Ability to do something like:
Prompt prompt = new Prompt(
"my user question",
OpenAiChatOptions.builder()
.model("doubao-seed-1-6-250615")
.extraBody(Map.of("thinking", Map.of("type", "disabled")))
.build()
);
which would serialize into the request body as expected.
Environment
- Spring AI version: 1.0.1
- Using Doubao (Volcengine) via OpenAI-compatible API
Would love guidance on whether this is already possible, and if not, whether support for extraBody
/customOptions
is planned. Thanks!
Comment From: Cyclones-Y
I had the same problem as you. Could you tell me if you have solved it?