mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-06 04:35: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
|
return
|
||||||
|
|
||||||
value = args.strip()
|
value = args.strip()
|
||||||
model.set_enable_thinking(value)
|
model.set_enable_thinking(value, self.io)
|
||||||
thinking_value = model.get_enable_thinking()
|
thinking_value = model.get_enable_thinking()
|
||||||
self.io.tool_output(f"Set enable thinking to {thinking_value}")
|
self.io.tool_output(f"Set enable thinking to {thinking_value}")
|
||||||
self.io.tool_output()
|
self.io.tool_output()
|
||||||
|
|
|
@ -14,6 +14,7 @@ from typing import Optional, Union
|
||||||
import json5
|
import json5
|
||||||
import yaml
|
import yaml
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
from pydantic import TypeAdapter, ValidationError
|
||||||
|
|
||||||
from aider.dump import dump # noqa: F401
|
from aider.dump import dump # noqa: F401
|
||||||
from aider.llm import litellm
|
from aider.llm import litellm
|
||||||
|
@ -755,14 +756,18 @@ class Model(ModelSettings):
|
||||||
self.extra_params["extra_body"] = {}
|
self.extra_params["extra_body"] = {}
|
||||||
self.extra_params["extra_body"]["reasoning_effort"] = effort
|
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"""
|
"""Set the enable thinking parameter for models that support it"""
|
||||||
if setting is not None:
|
if setting is not None:
|
||||||
if not self.extra_params:
|
if not self.extra_params:
|
||||||
self.extra_params = {}
|
self.extra_params = {}
|
||||||
if "extra_body" not in self.extra_params:
|
if "extra_body" not in self.extra_params:
|
||||||
self.extra_params["extra_body"] = {}
|
self.extra_params["extra_body"] = {}
|
||||||
|
try:
|
||||||
|
setting = TypeAdapter(bool).validate_python(setting)
|
||||||
self.extra_params["extra_body"]["enable_thinking"] = 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):
|
def parse_token_value(self, value):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue