mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
refactor: Simplify exception handling and remove redundant validation in LiteLLMExceptions
This commit is contained in:
parent
b9e15a1340
commit
46058c275c
2 changed files with 6 additions and 3 deletions
|
@ -65,9 +65,10 @@ class LiteLLMExceptions:
|
||||||
if var not in self.exception_info:
|
if var not in self.exception_info:
|
||||||
raise ValueError(f"{var} is in litellm but not in aider's exceptions list")
|
raise ValueError(f"{var} is in litellm but not in aider's exceptions list")
|
||||||
|
|
||||||
ex = getattr(litellm, var)
|
for var in self.exception_info:
|
||||||
dump(var, ex)
|
ex = getattr(litellm, var)
|
||||||
self.exceptions[ex] = self.exception_info[var]
|
dump(var, ex)
|
||||||
|
self.exceptions[ex] = self.exception_info[var]
|
||||||
|
|
||||||
def exceptions_tuple(self):
|
def exceptions_tuple(self):
|
||||||
return tuple(self.exceptions)
|
return tuple(self.exceptions)
|
||||||
|
|
|
@ -613,6 +613,7 @@ class Model(ModelSettings):
|
||||||
if "deepseek-reasoner" in self.name:
|
if "deepseek-reasoner" in self.name:
|
||||||
messages = ensure_alternating_roles(messages)
|
messages = ensure_alternating_roles(messages)
|
||||||
retry_delay = 0.125
|
retry_delay = 0.125
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
kwargs = {
|
kwargs = {
|
||||||
|
@ -620,6 +621,7 @@ class Model(ModelSettings):
|
||||||
"functions": None,
|
"functions": None,
|
||||||
"stream": False,
|
"stream": False,
|
||||||
}
|
}
|
||||||
|
|
||||||
_hash, response = self.send_completion(**kwargs)
|
_hash, response = self.send_completion(**kwargs)
|
||||||
if not response or not hasattr(response, "choices") or not response.choices:
|
if not response or not hasattr(response, "choices") or not response.choices:
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue