fix(#2414): honor ModelCreationContext.stream in OllamaChatModel [FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH] - #2417
Closed
waterWang wants to merge 1 commit into
Closed
Conversation
…hatModel [FaaFyfxR9WAQrL7FcAgEHJvztd8cVMxvjHRS55rw1nwH]
Collaborator
|
fixed in: #2415 |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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.
What
OllamaChatModel.doStream() previously ignored the streaming setting and always passed
truetostreamWithHttpClient(). When a caller creates the model withstream=false(viaModelCreationContext.stream) and consumes the result withblockLast(), they received empty content — the Ollama done marker carries nomessage.content.Why it matters
ModelCreationContext.streamis never consulted, so the per-call streaming preference is lost.ollama:xxxwithstream=falseandblockLast()yields an empty response body.Changes (4 touch points)
OllamaChatModel.java:private boolean stream = trueto preserve existing streaming default (backward compatible).setStream(boolean)setter (andisStream()getter) on the model.private boolean stream = truefield toBuilderplus a publicBuilder stream(boolean)method.Builder.build()now passes the flag to the model viamodel.setStream(stream).doStream(...)now dispatches on the effective stream value (instance field, overridable per-call viaGenerateOptions.stream) instead of the hardcodedtrue.OllamaModelProvider.java:applyAdvancedOptions(...)now readscontext.getStream()and forwards it tobuilder.stream(...)when present.Verification
true).streamWithHttpClient(..., boolean stream)already handles both paths correctly; this fix only passes the correct boolean.Closes #2414