Fix reasoningContent always null on OpenAiChatModel call path#6382
Open
jewoodev wants to merge 1 commit into
Open
Fix reasoningContent always null on OpenAiChatModel call path#6382jewoodev wants to merge 1 commit into
reasoningContent always null on OpenAiChatModel call path#6382jewoodev wants to merge 1 commit into
Conversation
On 1.1.x the blocking call() path in OpenAiChatModel omits the
reasoningContent entry from the generation metadata map, while the
streaming path already populates it from
ChatCompletionMessage#reasoningContent. Providers served through the
OpenAI-compatible API (for example deepseek-reasoner) return
reasoning_content on the wire, but
message.getMetadata().get("reasoningContent") is always null on the
call() path.
Mirror the streaming path by adding the same entry to the call()
metadata map, and add a regression test driving the call() path
through MockRestServiceServer with a reasoning_content payload.
See spring-projects#6375
Signed-off-by: jewoodev <jewoos15@naver.com>
3864fcd to
35f4f59
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On the 1.1.x line,
OpenAiChatModelpopulates thereasoningContentmessage metadata only on the streaming path. The blockingcall()path omits the entry from its metadata map, so reasoning models served through the OpenAI-compatible API (for exampledeepseek-reasoner) returnreasoning_contenton the wire whilemessage.getMetadata().get("reasoningContent")staysnull— the literal-nullvariant of the symptom discussed in #6375. The gap is specific to 1.1.x: onmainthe call path has populated this key since 2.0.0-RC1, and the streaming side — which the #6375 reporter has since confirmed as their actual case (2.0.0-RC2,stream()) — is addressed by #6373.The fix mirrors the existing streaming entry into the
call()metadata map. The regression test drives thecall()path throughMockRestServiceServerwith areasoning_contentpayload; it fails without the change (the key is absent from the metadata) and passes with it.Verified with
./mvnw package -pl models/spring-ai-openai.See #6375