Skip to content

fix(llm): improve reasoning support and provider stability#420

Merged
JeanMertz merged 3 commits intomainfrom
provider-fixes
Mar 6, 2026
Merged

fix(llm): improve reasoning support and provider stability#420
JeanMertz merged 3 commits intomainfrom
provider-fixes

Conversation

@JeanMertz
Copy link
Collaborator

This commit addresses several issues across different LLM providers related to reasoning handling and API compatibility.

For llamacpp, reasoning is now explicitly controlled via the reasoning_format and chat_template_kwargs fields, ensuring the server handles template formatting instead of manually wrapping content in tags. It also adds support for standard parameters like temperature and max tokens, and ensures reasoning is flushed before tool calls.

For ollama, the think parameter is now explicitly set to false when reasoning is disabled, preventing models from defaulting to active reasoning.

For openrouter, the reasoning configuration is now always sent to the API. When disabled, it uses a combination of minimal effort and exclusion to avoid errors with models that reject disabled reasoning. Additionally, the ToolCall type was converted to a struct to improve deserialization compatibility across different underlying providers.

This commit addresses several issues across different LLM providers
related to reasoning handling and API compatibility.

For `llamacpp`, reasoning is now explicitly controlled via the
`reasoning_format` and `chat_template_kwargs` fields, ensuring the
server handles template formatting instead of manually wrapping content
in tags. It also adds support for standard parameters like temperature
and max tokens, and ensures reasoning is flushed before tool calls.

For `ollama`, the `think` parameter is now explicitly set to false when
reasoning is disabled, preventing models from defaulting to active
reasoning.

For `openrouter`, the reasoning configuration is now always sent to the
API. When disabled, it uses a combination of minimal effort and
exclusion to avoid errors with models that reject disabled reasoning.
Additionally, the `ToolCall` type was converted to a struct to improve
deserialization compatibility across different underlying providers.

Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
@JeanMertz JeanMertz merged commit f98f3b8 into main Mar 6, 2026
11 checks passed
@JeanMertz JeanMertz deleted the provider-fixes branch March 6, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant