fix(server): route reasoning_format to split thinking into reasoning_content - #1305
Draft
RemiliaForever (RemiliaForever) wants to merge 2 commits into
Draft
fix(server): route reasoning_format to split thinking into reasoning_content#1305RemiliaForever (RemiliaForever) wants to merge 2 commits into
RemiliaForever (RemiliaForever) wants to merge 2 commits into
Conversation
…content geniex serve always inlined a thinking model's chain-of-thought in message.content with no way to separate it. Honor the per-request reasoning_format body param: deepseek / deepseek-legacy / auto move the chain-of-thought into message.reasoning_content, while "" / none keep it inline (default, unchanged). Reasoning splitting reuses the shared token FSM extracted into internal/thinkfsm (also used by geniex infer/run). Closes #1294 Signed-off-by: RemiliaForever <remilia@koumakan.cc>
Add the reasoning_format usage to the local-server guide (CN/EN) and a pointer under geniex serve in the CLI reference. Signed-off-by: RemiliaForever <remilia@koumakan.cc>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Contributor
Author
|
still too complex, need refactor |
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.
Summary
geniex servealways emitted a thinking model's chain-of-thought insidemessage.content, with no way to disable it or move it to the OpenAI-ecosystem-standardreasoning_contentfield (#1294).This honors the per-request
reasoning_formatbody param (mirroring the llama.cpp backend that already understands it):""/none— keep thinking inline incontent(default, behavior unchanged).deepseek/deepseek-legacy/auto— move the chain-of-thought intomessage.reasoning_content(blocking) ordelta.reasoning_content(streaming).Tool-call requests ignore the flag, since tool parsing needs the raw
<think>-tagged text.The reasoning split reuses the token FSM that
geniex infer/runalready render with, extracted into a new dependency-freecli/internal/thinkfsmpackage so both the terminal and the server drive one transition table.reasoning_contentis not a field inopenai-go(no version has it — it is a DeepSeek-originated de-facto standard), so the separated responses use small local structs; the default inline path still serializes the exactopenai.ChatCompletionshape byte-for-byte.Test plan
bazelisk test //cli/internal/thinkfsm:thinkfsm_test— FSM split across plain / inline-think / gpt-oss / gemma / unterminated inputs.bazelisk test //cli/server/handler:handler_test—reasoningSeparatedmapping andreasoningSinkrouting (separation on/off).bazelisk build //cli— full CLI builds.gofmtclean on all touched Go files.Closes #1294