mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
refactor: update retry exceptions to use openai instead of litellm
This commit is contained in:
parent
8e2a4b47d6
commit
54d55c857b
1 changed files with 20 additions and 15 deletions
|
@ -18,25 +18,32 @@ RETRY_TIMEOUT = 60
|
||||||
|
|
||||||
def retry_exceptions():
|
def retry_exceptions():
|
||||||
import httpx
|
import httpx
|
||||||
|
import openai
|
||||||
|
|
||||||
return (
|
return (
|
||||||
# httpx
|
# httpx
|
||||||
httpx.ConnectError,
|
httpx.ConnectError,
|
||||||
httpx.RemoteProtocolError,
|
httpx.RemoteProtocolError,
|
||||||
httpx.ReadTimeout,
|
httpx.ReadTimeout,
|
||||||
# litellm
|
#
|
||||||
litellm.exceptions.AuthenticationError,
|
# litellm exceptions inherit from openai exceptions
|
||||||
litellm.exceptions.PermissionDeniedError,
|
# https://docs.litellm.ai/docs/exception_mapping
|
||||||
litellm.exceptions.NotFoundError,
|
#
|
||||||
litellm.exceptions.UnprocessableEntityError,
|
# openai.BadRequestError,
|
||||||
litellm.exceptions.RateLimitError,
|
# litellm.ContextWindowExceededError,
|
||||||
litellm.exceptions.InternalServerError,
|
# litellm.ContentPolicyViolationError,
|
||||||
litellm.exceptions.ContextWindowExceededError,
|
#
|
||||||
litellm.exceptions.ContentPolicyViolationError,
|
# openai.AuthenticationError,
|
||||||
litellm.exceptions.APIConnectionError,
|
# openai.PermissionDeniedError,
|
||||||
litellm.exceptions.APIError,
|
# openai.NotFoundError,
|
||||||
litellm.exceptions.ServiceUnavailableError,
|
#
|
||||||
litellm.exceptions.Timeout,
|
openai.APITimeoutError,
|
||||||
|
openai.UnprocessableEntityError,
|
||||||
|
openai.RateLimitError,
|
||||||
|
openai.APIConnectionError,
|
||||||
|
openai.APIError,
|
||||||
|
openai.APIStatusError,
|
||||||
|
openai.InternalServerError,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,8 +70,6 @@ def send_completion(
|
||||||
temperature=0,
|
temperature=0,
|
||||||
extra_params=None,
|
extra_params=None,
|
||||||
):
|
):
|
||||||
from aider.llm import litellm
|
|
||||||
|
|
||||||
kwargs = dict(
|
kwargs = dict(
|
||||||
model=model_name,
|
model=model_name,
|
||||||
messages=messages,
|
messages=messages,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue