Skip to content

[OMEGA-522] fix(providers): forward reasoning_mode in base AIProvider (fixes #402) - #403

Open
watchme35 wants to merge 1 commit into
singnet:mainfrom
watchme35:fix/reasoning-mode-openaiapi
Open

watchme35 wants to merge 1 commit into
singnet:mainfrom
watchme35:fix/reasoning-mode-openaiapi

Conversation

@watchme35

Copy link
Copy Markdown

Description

Fixes #402.

The base AIProvider.convert_request in providers/lib_llm_ext.py built the request body from model, messages, max_tokens, tools and tool_choice only, silently dropping request.reasoning_mode. As a result, the OpenAIAPI provider (and any provider delegating to the base implementation) sent no reasoning hint to OpenAI-compatible backends such as llama.cpp server, vLLM, or Strata.

Thinking-capable models then ran at the backend's default thinking level. Thinking tokens share the output budget, so long thinking chains exhaust it: finish_reason=length with empty content, and the user sees the "reasoning exceeded the token limit" message - which advises lowering reasoningMode, a setting that had no effect on this provider.

The fix forwards the mode as extra_body.reasoning_effort, the parameter these servers accept ("none" disables thinking). Plain OpenAI chat-completions endpoints ignore unknown fields, so existing users are unaffected. The OpenAI, OpenRouter and ASIonE providers already map the mode themselves:

  • OpenRouter merges the base extra_body with its own reasoning object (both keys are consistent);
  • ASIonE replaces extra_body with its thinking budget exactly as before.

Three unit tests are added for the base provider: forwarding medium and none, and omitting extra_body entirely when reasoning_mode is unset.

How Has This Been Tested?

Checklist

  • PR contains autogenerated code
  • Self-review completed
  • Test scenarios above are passed with the version of the code from PR

The base AIProvider.convert_request in providers/lib_llm_ext.py ignored
request.reasoning_mode, so the OpenAIAPI provider sent no reasoning hint
to OpenAI-compatible backends (llama.cpp server, vLLM, Strata, ...).
Thinking-capable models then ran at the server's default thinking level
and could exhaust the shared output budget, producing finish_reason=length
with empty content and the misleading "reasoning exceeded the token limit"
reply, which advises lowering a setting that had no effect.

Forward the mode as extra_body.reasoning_effort, the parameter these
servers accept ("none" disables thinking). Plain OpenAI chat-completions
endpoints ignore unknown fields. The OpenAI, OpenRouter and ASIonE
providers already map the mode themselves and are unaffected:
OpenRouter merges the base extra_body with its own reasoning object,
ASIonE replaces it with its thinking budget as before.

Adds unit tests for the base provider (forward medium/none, omit when
reasoning_mode is unset).

Fixes singnet#402
@aquashade aquashade changed the title fix(providers): forward reasoning_mode in base AIProvider (fixes #402) [OMEGA-522] fix(providers): forward reasoning_mode in base AIProvider (fixes #402) Oct 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[OMEGA-522] OpenAIAPI provider drops reasoningMode from the request body (base AIProvider.convert_request ignores request.reasoning_mode)

2 participants