-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Problem
When using ollamaChatModel.call(), the "thinking" metadata field is correctly returned.
However, when using the streaming API (ollamaChatModel.stream()), the "thinking" field always comes as null.
Code Snippet
Non-streaming version (works):
ChatResponse response = ollamaChatModel.call(...);
String thinking = response.getResult().getMetadata().get("thinking"); // WorksStreaming version (not working):
Flux<ChatResponse> stream = ollamaChatModel.stream(
new Prompt(
"Hi",
OllamaChatOptions.builder()
.model("gpt-oss:20b")
.enableThinking()
.thinkHigh()
.build()
)
);
stream.subscribe(response -> {
String thinking = response.getResult().getMetadata().get("thinking"); //always null
String content = response.getResult().getOutput().getText();
System.out.println("[Thinking] " + thinking); //it's null
System.out.println("[Response] " + content);
});The thinking field is coming as null.
If I’m missing something or need to enable any additional setting for streaming to return the thinking data, please let me know.
From what I can see, in the non-streaming path
internalCall()
the "thinking" metadata is being extracted and added to the response.
But in the streaming path
internalStream()
that logic seems to be missing, so the thinking field may not be populated.
I’m not sure if this is handled elsewhere — just guessing here.
If its working for others, please let me know.