mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 00:05:01 +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:
|
||||
raise ValueError(f"{var} is in litellm but not in aider's exceptions list")
|
||||
|
||||
ex = getattr(litellm, var)
|
||||
dump(var, ex)
|
||||
self.exceptions[ex] = self.exception_info[var]
|
||||
for var in self.exception_info:
|
||||
ex = getattr(litellm, var)
|
||||
dump(var, ex)
|
||||
self.exceptions[ex] = self.exception_info[var]
|
||||
|
||||
def exceptions_tuple(self):
|
||||
return tuple(self.exceptions)
|
||||
|
|
|
@ -613,6 +613,7 @@ class Model(ModelSettings):
|
|||
if "deepseek-reasoner" in self.name:
|
||||
messages = ensure_alternating_roles(messages)
|
||||
retry_delay = 0.125
|
||||
|
||||
while True:
|
||||
try:
|
||||
kwargs = {
|
||||
|
@ -620,6 +621,7 @@ class Model(ModelSettings):
|
|||
"functions": None,
|
||||
"stream": False,
|
||||
}
|
||||
|
||||
_hash, response = self.send_completion(**kwargs)
|
||||
if not response or not hasattr(response, "choices") or not response.choices:
|
||||
return None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue