fix: accept Ollama reasoning field in OpenAI Chat deltas#36068
Open
twhittock wants to merge 2 commits into
Open
fix: accept Ollama reasoning field in OpenAI Chat deltas#36068twhittock wants to merge 2 commits into
twhittock wants to merge 2 commits into
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: I found a related PR that appears to be addressing the same issue: PR #35284: This PR appears to be directly related to the current PR #36068 since both are working on accepting the
Additionally, PR #34283: |
CreatorGhost
added a commit
to CreatorGhost/TheCode
that referenced
this pull request
Jul 12, 2026
Ported from upstream anomalyco#36068.
CreatorGhost
added a commit
to CreatorGhost/TheCode
that referenced
this pull request
Jul 12, 2026
Ported from upstream anomalyco#36068.
Ollama's /v1/chat/completions endpoint emits reasoning output in a `reasoning` field (both streaming deltas and non-streaming messages), not `reasoning_content` which is the DeepSeek/LM Studio convention. Effect's Schema.Struct strips unknown keys, so the reasoning content was silently discarded - producing empty responses for thinking models like glm-5.2 via Ollama Cloud. Adds `reasoning` as a fallback alongside `reasoning_content` in the delta schema, message schema, and helper function, matching how other OpenAI-compatible clients already handle this. Refs: ollama/ollama#16853, RightNow-AI/openfang#805
aa72711 to
0bdc839
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.
Ollama's /v1/chat/completions endpoint emits reasoning output in a
reasoningfield (both streaming deltas and non-streaming messages), notreasoning_contentwhich is the DeepSeek/LM Studio convention. Effect's Schema.Struct strips unknown keys, so the reasoning content was silently discarded - producing empty responses for thinking models like glm-5.2 via Ollama Cloud.Adds
reasoningas a fallback alongsidereasoning_contentin the delta schema, message schema, and helper function, matching how other OpenAI-compatible clients already handle this.Refs: ollama/ollama#16853, RightNow-AI/openfang#805
Issue for this PR
Closes #34798
Type of change
What does this PR do?
Extends "OpenAI compatible" schema shape to include Ollama's
reasoningfield alongside the existingreasoning_content.How did you verify your code works?
Build & run locally, observed GLM-5.2 responses from ollama cloud are now working.
Screenshots / recordings
N/A
Checklist
If you do not follow this template your PR will be automatically rejected.