mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
refactor: Separate raw thinking token retrieval and fix self access
This commit is contained in:
parent
a4c9c10029
commit
96aa77288b
1 changed files with 7 additions and 2 deletions
|
@ -688,11 +688,11 @@ class Model(ModelSettings):
|
||||||
else:
|
else:
|
||||||
self.extra_params["thinking"] = {"type": "enabled", "budget_tokens": num_tokens}
|
self.extra_params["thinking"] = {"type": "enabled", "budget_tokens": num_tokens}
|
||||||
|
|
||||||
def get_thinking_tokens(self, model):
|
def get_raw_thinking_tokens(self):
|
||||||
"""Get formatted thinking token budget if available"""
|
"""Get formatted thinking token budget if available"""
|
||||||
budget = None
|
budget = None
|
||||||
|
|
||||||
if model.extra_params:
|
if self.extra_params:
|
||||||
# Check for OpenRouter reasoning format
|
# Check for OpenRouter reasoning format
|
||||||
if (
|
if (
|
||||||
"reasoning" in model.extra_params
|
"reasoning" in model.extra_params
|
||||||
|
@ -706,6 +706,11 @@ class Model(ModelSettings):
|
||||||
):
|
):
|
||||||
budget = model.extra_params["thinking"]["budget_tokens"]
|
budget = model.extra_params["thinking"]["budget_tokens"]
|
||||||
|
|
||||||
|
return budget
|
||||||
|
|
||||||
|
def get_thinking_tokens(self):
|
||||||
|
budget = self.get_raw_thinking_tokens()
|
||||||
|
|
||||||
if budget is not None:
|
if budget is not None:
|
||||||
# Format as xx.yK for thousands, xx.yM for millions
|
# Format as xx.yK for thousands, xx.yM for millions
|
||||||
if budget >= 1024 * 1024:
|
if budget >= 1024 * 1024:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue