feat(client): per-request reasoning_effort passthrough#57
Merged
Conversation
Add OpenAIOptions.ReasoningEffort, attached to every chat-completion request as
the OpenAI-standard "reasoning_effort" field (Ask, CreateChatCompletion,
CreateChatCompletionStream). Mirrors the existing Metadata passthrough.
Why: Metadata ({"enable_thinking":"false"}) only disables thinking when the
model's chat template honors that flag. Reasoning models whose GGUF template has
no enable_thinking toggle (e.g. LFM2.5) ignore it and keep reasoning — but they
DO honor reasoning_effort:"none". This gives callers the portable lever to
silence reasoning regardless of the template. Unset = field omitted (no behavior
change).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Adds
OpenAIOptions.ReasoningEffort, attached to every chat-completion request as the OpenAI-standardreasoning_effortfield (inAsk,CreateChatCompletion, andCreateChatCompletionStream). Mirrors the existingMetadatapassthrough.Why
Metadata({"enable_thinking":"false"}) only disables thinking when the model's chat template honors that flag. Reasoning models whose GGUF chat template has noenable_thinkingtoggle — e.g. LFM2.5 — ignore it and keep emitting<think>blocks. Those same models do honorreasoning_effort: "none"(LocalAI/llama.cpp translate it into the empty-think prefill). This gives callers the portable, OpenAI-standard lever to silence reasoning regardless of the template.Verified against a live LocalAI + LFM2.5:
metadata.enable_thinking:false→ still thinking;reasoning_effort:"none"→ thinking off.Behavior
ReasoningEffort→ field omitted, no change to existing requests.go-openaialready has the nativeReasoningEffortfield, so this is a one-line set at each request site.Tests
ReasoningEffortreaches the wire asreasoning_effort(real httptest server)🤖 Generated with Claude Code