mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 18:25:00 +00:00
refactor: Simplify send_completion method by removing extra_params argument
This commit is contained in:
parent
6de6fb1932
commit
faa438bc51
1 changed files with 9 additions and 4 deletions
|
@ -531,24 +531,29 @@ class Model(ModelSettings):
|
||||||
map_tokens = max(map_tokens, 1024)
|
map_tokens = max(map_tokens, 1024)
|
||||||
return map_tokens
|
return map_tokens
|
||||||
|
|
||||||
def send_completion(self, messages, functions, stream, temperature=0, extra_params=None):
|
def send_completion(self, messages, functions, stream, temperature=0):
|
||||||
if os.environ.get("AIDER_SANITY_CHECK_TURNS"):
|
if os.environ.get("AIDER_SANITY_CHECK_TURNS"):
|
||||||
sanity_check_messages(messages)
|
sanity_check_messages(messages)
|
||||||
|
|
||||||
if "deepseek-reasoner" in self.name:
|
if "deepseek-reasoner" in self.name:
|
||||||
messages = ensure_alternating_roles(messages)
|
messages = ensure_alternating_roles(messages)
|
||||||
|
|
||||||
kwargs = dict(
|
kwargs = dict(
|
||||||
model=self.name,
|
model=self.name,
|
||||||
messages=messages,
|
messages=messages,
|
||||||
stream=stream,
|
stream=stream,
|
||||||
)
|
)
|
||||||
if temperature is not None:
|
|
||||||
|
if self.use_temperature:
|
||||||
kwargs["temperature"] = temperature
|
kwargs["temperature"] = temperature
|
||||||
|
|
||||||
if functions is not None:
|
if functions is not None:
|
||||||
function = functions[0]
|
function = functions[0]
|
||||||
kwargs["tools"] = [dict(type="function", function=function)]
|
kwargs["tools"] = [dict(type="function", function=function)]
|
||||||
kwargs["tool_choice"] = {"type": "function", "function": {"name": function["name"]}}
|
kwargs["tool_choice"] = {"type": "function", "function": {"name": function["name"]}}
|
||||||
if extra_params is not None:
|
if self.extra_params:
|
||||||
kwargs.update(extra_params)
|
kwargs.update(self.extra_params)
|
||||||
|
|
||||||
key = json.dumps(kwargs, sort_keys=True).encode()
|
key = json.dumps(kwargs, sort_keys=True).encode()
|
||||||
# dump(kwargs)
|
# dump(kwargs)
|
||||||
hash_object = hashlib.sha1(key)
|
hash_object = hashlib.sha1(key)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue