mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
fixup: setting validation
This commit is contained in:
parent
8010bebb6b
commit
48a8f919b5
2 changed files with 8 additions and 3 deletions
|
@ -1601,7 +1601,7 @@ class Commands:
|
|||
return
|
||||
|
||||
value = args.strip()
|
||||
model.set_enable_thinking(value)
|
||||
model.set_enable_thinking(value, self.io)
|
||||
thinking_value = model.get_enable_thinking()
|
||||
self.io.tool_output(f"Set enable thinking to {thinking_value}")
|
||||
self.io.tool_output()
|
||||
|
|
|
@ -14,6 +14,7 @@ from typing import Optional, Union
|
|||
import json5
|
||||
import yaml
|
||||
from PIL import Image
|
||||
from pydantic import TypeAdapter, ValidationError
|
||||
|
||||
from aider.dump import dump # noqa: F401
|
||||
from aider.llm import litellm
|
||||
|
@ -755,14 +756,18 @@ class Model(ModelSettings):
|
|||
self.extra_params["extra_body"] = {}
|
||||
self.extra_params["extra_body"]["reasoning_effort"] = effort
|
||||
|
||||
def set_enable_thinking(self, setting):
|
||||
def set_enable_thinking(self, setting, io):
|
||||
"""Set the enable thinking parameter for models that support it"""
|
||||
if setting is not None:
|
||||
if not self.extra_params:
|
||||
self.extra_params = {}
|
||||
if "extra_body" not in self.extra_params:
|
||||
self.extra_params["extra_body"] = {}
|
||||
self.extra_params["extra_body"]["enable_thinking"] = setting
|
||||
try:
|
||||
setting = TypeAdapter(bool).validate_python(setting)
|
||||
self.extra_params["extra_body"]["enable_thinking"] = setting
|
||||
except ValidationError:
|
||||
io.tool_warning("Warning: the enable-thinking command expects true or false")
|
||||
|
||||
def parse_token_value(self, value):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue