Skip to content

Commit

Permalink
refactor: Make use_temperature support both bool and float types
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-gauthier committed Feb 4, 2025
1 parent e07fddb commit 495a27c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aider/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import time
from dataclasses import dataclass, fields
from pathlib import Path
from typing import Optional
from typing import Optional, Union

import json5
import yaml
Expand Down Expand Up @@ -102,7 +102,7 @@ class ModelSettings:
cache_control: bool = False
caches_by_default: bool = False
use_system_prompt: bool = True
use_temperature: bool = True # how can i make this a bool or a float? ai!
use_temperature: Union[bool, float] = True
streaming: bool = True
editor_model_name: Optional[str] = None
editor_edit_format: Optional[str] = None
Expand Down Expand Up @@ -551,7 +551,7 @@ def send_completion(self, messages, functions, stream, temperature=None):

if self.use_temperature is not False:
if temperature is None:
if self.use_temperature in (True, None):
if isinstance(self.use_temperature, bool):
temperature = 0
else:
temperature = float(self.use_temperature)
Expand Down

0 comments on commit 495a27c

Please sign in to comment.