Skip to content

Commit

Permalink
refactor: update retry exceptions to use openai instead of litellm
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-gauthier committed Oct 28, 2024
1 parent 8e2a4b4 commit 54d55c8
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions aider/sendchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,32 @@

def retry_exceptions():
import httpx
import openai

return (
# httpx
httpx.ConnectError,
httpx.RemoteProtocolError,
httpx.ReadTimeout,
# litellm
litellm.exceptions.AuthenticationError,
litellm.exceptions.PermissionDeniedError,
litellm.exceptions.NotFoundError,
litellm.exceptions.UnprocessableEntityError,
litellm.exceptions.RateLimitError,
litellm.exceptions.InternalServerError,
litellm.exceptions.ContextWindowExceededError,
litellm.exceptions.ContentPolicyViolationError,
litellm.exceptions.APIConnectionError,
litellm.exceptions.APIError,
litellm.exceptions.ServiceUnavailableError,
litellm.exceptions.Timeout,
#
# litellm exceptions inherit from openai exceptions
# https://docs.litellm.ai/docs/exception_mapping
#
# openai.BadRequestError,
# litellm.ContextWindowExceededError,
# litellm.ContentPolicyViolationError,
#
# openai.AuthenticationError,
# openai.PermissionDeniedError,
# openai.NotFoundError,
#
openai.APITimeoutError,
openai.UnprocessableEntityError,
openai.RateLimitError,
openai.APIConnectionError,
openai.APIError,
openai.APIStatusError,
openai.InternalServerError,
)


Expand All @@ -63,8 +70,6 @@ def send_completion(
temperature=0,
extra_params=None,
):
from aider.llm import litellm

kwargs = dict(
model=model_name,
messages=messages,
Expand Down

0 comments on commit 54d55c8

Please sign in to comment.