Uh oh!
There was an error while loading. Please reload this page.
fix: accept Ollama reasoning field in OpenAI Chat deltas - #36068
fix: accept Ollama reasoning field in OpenAI Chat deltas#36068twhittock wants to merge 2 commits into
Conversation
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: |
Ported from upstream anomalyco#36068.
aa72711 to
0bdc839Compareaa18e0b to
73fd534Compare73fd534 to
8247198Comparebe240e6 to
125b02dCompare2fdd4b3 to
5935528CompareOllama'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
5935528 to
a9659f8CompareAutomated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
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.