mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
feat: add thinking token budget configuration option
This commit is contained in:
parent
680dbfbf77
commit
6f99392eda
3 changed files with 21 additions and 1 deletions
|
@ -117,6 +117,11 @@ def get_parser(default_config_files, git_root):
|
|||
type=str,
|
||||
help="Set the reasoning_effort API parameter (default: not set)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--thinking-tokens",
|
||||
type=int,
|
||||
help="Set the thinking token budget for models that support it (default: not set)",
|
||||
)
|
||||
group.add_argument(
|
||||
"--verify-ssl",
|
||||
action=argparse.BooleanOptionalAction,
|
||||
|
|
|
@ -776,6 +776,10 @@ 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:
|
||||
main_model.set_reasoning_effort(args.reasoning_effort)
|
||||
|
||||
# Set thinking tokens if specified
|
||||
if args.thinking_tokens is not None:
|
||||
main_model.set_thinking_tokens(args.thinking_tokens)
|
||||
|
||||
if args.copy_paste and args.edit_format is None:
|
||||
if main_model.edit_format in ("diff", "whole"):
|
||||
|
|
|
@ -590,7 +590,18 @@ class Model(ModelSettings):
|
|||
if "extra_body" not in self.extra_params:
|
||||
self.extra_params["extra_body"] = {}
|
||||
self.extra_params["extra_body"]["reasoning_effort"] = effort
|
||||
|
||||
|
||||
def set_thinking_tokens(self, num):
|
||||
"""Set the thinking token budget for models that support it"""
|
||||
if num is not None:
|
||||
self.use_temperature = False
|
||||
if not self.extra_params:
|
||||
self.extra_params = {}
|
||||
self.extra_params["thinking"] = {
|
||||
"type": "enabled",
|
||||
"budget_tokens": num
|
||||
}
|
||||
|
||||
def is_deepseek_r1(self):
|
||||
name = self.name.lower()
|
||||
if "deepseek" not in name:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue