You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains 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
-if model in self.user_message_only_models or get_settings().config.custom_reasoning_model:+if model in self.user_message_only_models or (hasattr(get_settings(), 'config') and get_settings().config.custom_reasoning_model):
Apply this suggestion
Suggestion importance[1-10]: 7
__
Why: The suggestion adds important defensive programming by checking for the existence of the config attribute before accessing it, which could prevent runtime errors if the settings object is not properly initialized.
Medium
Add consistent null check
Apply the same null check pattern for the second occurrence of config access to maintain consistency and prevent potential crashes
-if model not in self.no_support_temperature_models and not get_settings().config.custom_reasoning_model:+if model not in self.no_support_temperature_models and not (hasattr(get_settings(), 'config') and get_settings().config.custom_reasoning_model):
Apply this suggestion
Suggestion importance[1-10]: 7
__
Why: This suggestion maintains consistency with the first fix and adds the same defensive programming pattern to prevent potential null pointer exceptions in another similar code location.
The condition for handling temperature settings should be inverted - if a model doesn't support temperature or is a custom reasoning model, temperature should be excluded, not included.
-if model not in self.no_support_temperature_models or get_settings().config.custom_reasoning_model:+if model not in self.no_support_temperature_models and not get_settings().config.custom_reasoning_model:
kwargs["temperature"] = temperature
[Suggestion has been applied]
Suggestion importance[1-10]: 10
__
Why: The current logic is incorrect and would add temperature to models that don't support it. The suggested fix correctly excludes temperature for both unsupported models and custom reasoning models, preventing potential API errors.
if model in self.user_message_only_models or get_settings().config.custom_reasoning_model:
+ if get_settings().config.custom_reasoning_model:+ get_logger().warning("Custom reasoning model enabled: bypassing system message and temperature settings")
user = f"{system}\n\n\n{user}"
system = ""
get_logger().info(f"Using model {model}, combining system and user prompts")
messages = [{"role": "user", "content": user}]
Suggestion importance[1-10]: 7
__
Why: Adding a warning log when custom_reasoning_model is enabled provides better observability and helps track when important model settings are being bypassed, making it easier to debug and monitor system behavior.
Medium
✅ Clarify configuration comment documentation
Improve the configuration comment to clearly explain the implications of enabling custom_reasoning_model.
-custom_reasoning_model = false # when true, no system message and not temperature will be used+custom_reasoning_model = false # when true, disables system messages and temperature controls for models that don't support chat-style inputs
[Suggestion has been applied]
Suggestion importance[1-10]: 6
__
Why: The improved comment provides clearer and more precise documentation about the implications of enabling custom_reasoning_model, helping users better understand its impact on chat-style inputs.
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.
User description
#1540
PR Type
Enhancement, Documentation
Description
Added support for custom reasoning models in AI handler.
Updated logic to handle models without temperature or chat-style inputs.
Documented configuration for custom reasoning models in usage guide.
Introduced a new configuration option
custom_reasoning_model
.Changes walkthrough 📝
litellm_ai_handler.py
Enhance AI handler to support custom reasoning models
pr_agent/algo/ai_handlers/litellm_ai_handler.py
models.
changing_a_model.md
Update usage guide for custom reasoning models
docs/docs/usage-guide/changing_a_model.md
chat-style inputs.
configuration.toml
Add configuration for custom reasoning models
pr_agent/settings/configuration.toml
custom_reasoning_model
configuration option.