mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 01:35:00 +00:00
feat: Add model setting validation for reasoning features
This commit is contained in:
parent
46863b470c
commit
77101a96a1
2 changed files with 15 additions and 1 deletions
|
@ -789,10 +789,18 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
|||
|
||||
# Set reasoning effort if specified
|
||||
if args.reasoning_effort is not None:
|
||||
if main_model.accepts_settings and "reasoning_effort" not in main_model.accepts_settings:
|
||||
io.tool_warning(
|
||||
f"Warning: The model {main_model.name} may not support the 'reasoning_effort' setting."
|
||||
)
|
||||
main_model.set_reasoning_effort(args.reasoning_effort)
|
||||
|
||||
# Set thinking tokens if specified
|
||||
if args.thinking_tokens is not None:
|
||||
if main_model.accepts_settings and "thinking_tokens" not in main_model.accepts_settings:
|
||||
io.tool_warning(
|
||||
f"Warning: The model {main_model.name} may not support the 'thinking_tokens' setting."
|
||||
)
|
||||
main_model.set_thinking_tokens(args.thinking_tokens)
|
||||
|
||||
if args.copy_paste and args.edit_format is None:
|
||||
|
|
|
@ -116,6 +116,7 @@ class ModelSettings:
|
|||
reasoning_tag: Optional[str] = None
|
||||
remove_reasoning: Optional[str] = None # Deprecated alias for reasoning_tag
|
||||
system_prompt_prefix: Optional[str] = None
|
||||
accepts_settings: Optional[list] = None
|
||||
|
||||
|
||||
# Load model settings from package resource
|
||||
|
@ -295,6 +296,10 @@ class Model(ModelSettings):
|
|||
exact_match = True
|
||||
break # Continue to apply overrides
|
||||
|
||||
# Initialize accepts_settings if it's None
|
||||
if self.accepts_settings is None:
|
||||
self.accepts_settings = []
|
||||
|
||||
model = model.lower()
|
||||
|
||||
# If no exact match, try generic settings
|
||||
|
@ -358,7 +363,7 @@ class Model(ModelSettings):
|
|||
self.examples_as_sys_msg = True
|
||||
self.use_temperature = False
|
||||
self.reasoning_tag = "think"
|
||||
self.reasoning_tag = "think"
|
||||
self.accepts_settings = ["reasoning_effort", "thinking_tokens"]
|
||||
return # <--
|
||||
|
||||
if ("llama3" in model or "llama-3" in model) and "70b" in model:
|
||||
|
@ -389,6 +394,7 @@ class Model(ModelSettings):
|
|||
self.use_repo_map = True
|
||||
self.examples_as_sys_msg = True
|
||||
self.reminder = "user"
|
||||
self.accepts_settings = ["reasoning_effort"]
|
||||
return # <--
|
||||
|
||||
if model.startswith("o1-") or "/o1-" in model:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue