Skip to content

Regression: reasoning_content dropped in streaming after migrating to openai-java SDK #6230

@freshman-wang

Description

@freshman-wang

Version

2.0.0-M8 (regression from 1.1.4)

Summary

In 1.1.4, OpenAiApi.ChatCompletionMessage had an explicit reasoningContent field, and OpenAiStreamFunctionCallingHelper preserved it during streaming chunk merging.

In 2.0.0-M8, migrating to the official openai-java SDK removed both ChatCompletionMessage.reasoningContent and OpenAiStreamFunctionCallingHelper. The SDK places reasoning_content into Delta._additionalProperties, but MessageAggregator never reads it, and AssistantMessage has no field to store it.

Root cause

  • 1.1.4: ChatCompletionMessage.reasoningContent + OpenAiStreamFunctionCallingHelper handled it explicitly
  • 2.0.0-M8: SDK puts reasoning in _additionalProperties but MessageAggregator only reads content + toolCalls + media
  • Even after patching Delta to include a native reasoningContent field, reasoning-only chunks (delta with reasoning_content, no content, no tool_calls) are merged into adjacent chunks before reaching ToolCallAdvisor. Every incoming chunk already carries combined text and tool calls. Separate reasoning deltas never exist in the pipeline.

Workaround

Manual ReAct loop + OkHttp NetworkInterceptor. The interceptor tees the raw SSE byte stream before SDK deserialization, extracts reasoning_content from each data line, and emits thinking SSE events directly. This bypasses both the SDK deserialization (which drops unknown fields) and the ChatClient chunk merging (which collapses intermediate deltas).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopenai

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions