feat(openresponses): Support reasoning blocks #8133
Merged
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.
Description
This PR adds support to the openresponses API for reasoning blocks, including:
Added a comprehensive
reasoningconfiguration section which allows to override LocalAI's defaults with the following options:disable(bool): Completely disable reasoning extractiondisable_reasoning_tag_prefill(bool): Disable automatic prepending of thinking start tokensstrip_reasoning_only(bool): Extract and remove reasoning tags but discard the reasoning textthinking_start_tokens(array of strings): Custom thinking start tokens to detect in prompts (checked before defaults)tag_pairs(array of objects): Custom tag pairs withstartandendfields for reasoning extraction (checked before defaults)The options:
disable: Whentrue, completely disables reasoning extraction. Original content is returned unchanged.disable_reasoning_tag_prefill: Whentrue, disables automatic prepending of thinking start tokens. Use this when your model already includes reasoning tags in its output format.strip_reasoning_only: When enabled:Use Case: Useful for models that include reasoning tags in their output where you want to remove those tags from the final response but don't need to store or process the reasoning content separately.
thinking_start_tokens: Allows users to specify custom tokens that indicate reasoning will start in the model output. Custom tokens are checked before default tokens, giving them priority.tag_pairs: Allows users to define custom start/end tag pairs for reasoning extraction. Custom pairs are checked before default pairs, giving them priority.Example:
Notes for Reviewers
Depends on #8132
Signed commits