Add is_reasoning_model config flag for non-OpenAI thinking models#448
Open
MateoTTR wants to merge 2 commits intoalgorithmicsuperintelligence:mainfrom
Open
Add is_reasoning_model config flag for non-OpenAI thinking models#448MateoTTR wants to merge 2 commits intoalgorithmicsuperintelligence:mainfrom
MateoTTR wants to merge 2 commits intoalgorithmicsuperintelligence:mainfrom
Conversation
Extract OPENAI_REASONING_MODEL_PREFIXES to module-level constant and is_reasoning_model() to a standalone function. Add is_reasoning_model field to LLMModelConfig with 3-state logic: True (force reasoning), False (force standard), None (auto-detect via OpenAI prefixes). This allows users of non-OpenAI providers (Gemini, DeepSeek, etc.) to explicitly mark models as reasoning models via config, without relying on fragile prefix-based detection. Closes #2 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…t-oss coverage - Remove redundant dash-prefixes (o1-, o3-, gpt-5-) already covered by base prefixes - Replace gpt-oss-120b/gpt-oss-20b full names with gpt-oss- prefix - Rewrite test_openai_model_detection.py to use real is_reasoning_model() function instead of duplicating logic with a non-existent api_base check - Add test coverage for gpt-oss-* model family - Add comment explaining intentional omission of is_reasoning_model from shared_config Co-Authored-By: Claude Opus 4.6 (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.
Summary
OPENAI_REASONING_MODEL_PREFIXESfrom local variable insidegenerate_with_context()to a module-level constantis_reasoning_model()as a standalone, importable function with 3-state logicis_reasoning_model: Optional[bool] = Nonefield toLLMModelConfigMotivation
Users of non-OpenAI providers (Gemini 2.5 thinking models, DeepSeek-R1, Qwen thinking, etc.) cannot currently configure their models as reasoning models. The hardcoded prefix list only covers OpenAI models, and expanding it with non-OpenAI prefixes is fragile:
gemini-2.5-flash) can run with or without thinkinggemini-2.5-flash-liteshares thegemini-2.5-prefix but is NOT a thinking modelSolution
A per-model config flag with auto-detection fallback:
True→ force reasoning model conventions (max_completion_tokens, no temperature/top_p)False→ force standard conventionsNone(default) → auto-detect via OpenAI prefix list (fully backward-compatible)Additional cleanup
o1-,o3-,gpt-5-) already covered by base prefixes (o1,o3,gpt-5)gpt-oss-120b/gpt-oss-20bwithgpt-oss-prefixtest_openai_model_detection.pyto import and test the realis_reasoning_model()function instead of duplicating detection logic with a non-existentapi_baseguardTest plan
test_reasoning_model_detection.py(3-state logic, auto-detect, explicit override, case insensitivity, backward compat)test_openai_model_detection.pyto use real function + added gpt-oss coverage🤖 Generated with Claude Code