feat: support reasoning effort and budget #6369
Draft
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.
Describe Your Changes
This pull request introduces enhanced support for "reasoning" capabilities in models, focusing on both backend and frontend integration. The changes include adding new properties to model configurations, updating capability detection logic, and improving the user interface to allow toggling and configuring reasoning effort for models that support it. Additionally, the capability detection logic is generalized and refactored for better extensibility.
Backend enhancements for reasoning capabilities:
reasoning_budget
andchat_template_kwargs
properties to theLlamacppConfig
type, and ensured these are passed as command-line arguments when starting the model inllamacpp_extension
. This enables dynamic configuration of reasoning features for supported models. [1] [2] [3]isToolSupported
method with a more genericisModelCapabilitySupported
, allowing detection of various capabilities (including reasoning and reasoning_effort) for models. This change is reflected across engine, service, and provider layers. [1] [2] [3] [4] [5] [6]Frontend improvements for reasoning configuration:
ChatInput.tsx
to allow users to toggle the reasoning budget and select reasoning effort (low/medium/high) for models with reasoning capability. This includes new popover and icon components, and ensures the model is restarted with new settings when changed. [1] [2]IconAtom
toIconBrain
for better clarity in both capability lists and chat input controls. [1] [2] [3]Capability and model configuration logic:
REASONING
to theModelCapabilities
enum for consistent capability handling throughout the codebase.Fixes Issues
Self Checklist
Important
Add reasoning capabilities to models, updating backend configurations and frontend UI for enhanced reasoning support.
reasoning_budget
andchat_template_kwargs
toLlamacppConfig
inindex.ts
.llamacpp_extension
.isToolSupported
withisModelCapabilitySupported
inAIEngine.ts
andindex.ts
.ChatInput.tsx
to toggle reasoning budget and select reasoning effort.IconAtom
toIconBrain
inCapabilities.tsx
andChatInput.tsx
.providers.ts
.REASONING
toModelCapabilities
enum inmodels.ts
.This description was created by
for dce5af4. You can customize this summary. It will automatically update as commits are pushed.