mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
refactor: Move aider.sendchat imports to the top of the file
This commit is contained in:
parent
b3db597c4b
commit
20aaf58ee9
1 changed files with 1 additions and 7 deletions
|
@ -17,6 +17,7 @@ from PIL import Image
|
||||||
|
|
||||||
from aider.dump import dump # noqa: F401
|
from aider.dump import dump # noqa: F401
|
||||||
from aider.llm import litellm
|
from aider.llm import litellm
|
||||||
|
from aider.sendchat import sanity_check_messages, ensure_alternating_roles, RETRY_TIMEOUT
|
||||||
|
|
||||||
DEFAULT_MODEL_NAME = "gpt-4o"
|
DEFAULT_MODEL_NAME = "gpt-4o"
|
||||||
ANTHROPIC_BETA_HEADER = "prompt-caching-2024-07-31,pdfs-2024-09-25"
|
ANTHROPIC_BETA_HEADER = "prompt-caching-2024-07-31,pdfs-2024-09-25"
|
||||||
|
@ -528,12 +529,8 @@ class Model(ModelSettings):
|
||||||
|
|
||||||
def send_completion(self, messages, functions, stream, temperature=0, extra_params=None):
|
def send_completion(self, messages, functions, stream, temperature=0, extra_params=None):
|
||||||
if os.environ.get("AIDER_SANITY_CHECK_TURNS"):
|
if os.environ.get("AIDER_SANITY_CHECK_TURNS"):
|
||||||
from aider.sendchat import sanity_check_messages
|
|
||||||
|
|
||||||
sanity_check_messages(messages)
|
sanity_check_messages(messages)
|
||||||
if "deepseek-reasoner" in self.name:
|
if "deepseek-reasoner" in self.name:
|
||||||
from aider.sendchat import ensure_alternating_roles
|
|
||||||
|
|
||||||
messages = ensure_alternating_roles(messages)
|
messages = ensure_alternating_roles(messages)
|
||||||
kwargs = dict(
|
kwargs = dict(
|
||||||
model=self.name,
|
model=self.name,
|
||||||
|
@ -551,14 +548,11 @@ class Model(ModelSettings):
|
||||||
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)
|
||||||
from aider.sendchat import litellm
|
|
||||||
|
|
||||||
res = litellm.completion(**kwargs)
|
res = litellm.completion(**kwargs)
|
||||||
return hash_object, res
|
return hash_object, res
|
||||||
|
|
||||||
def simple_send_with_retries(self, messages):
|
def simple_send_with_retries(self, messages):
|
||||||
from aider.exceptions import LiteLLMExceptions
|
from aider.exceptions import LiteLLMExceptions
|
||||||
from aider.sendchat import RETRY_TIMEOUT, ensure_alternating_roles
|
|
||||||
|
|
||||||
litellm_ex = LiteLLMExceptions()
|
litellm_ex = LiteLLMExceptions()
|
||||||
if "deepseek-reasoner" in self.name:
|
if "deepseek-reasoner" in self.name:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue