Skip to content

Commit

Permalink
stop retrying on all exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
rbren committed Jan 30, 2025
1 parent fd73f42 commit cc0bf44
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions openhands/llm/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@
from litellm import completion as litellm_completion
from litellm import completion_cost as litellm_completion_cost
from litellm.exceptions import (
APIConnectionError,
APIError,
InternalServerError,
RateLimitError,
ServiceUnavailableError,
)
from litellm.types.utils import CostPerToken, ModelResponse, Usage
from litellm.utils import create_pretrained_tokenizer
Expand All @@ -42,15 +39,7 @@
__all__ = ['LLM']

# tuple of exceptions to retry on
LLM_RETRY_EXCEPTIONS: tuple[type[Exception], ...] = (
APIConnectionError,
# FIXME: APIError is useful on 502 from a proxy for example,
# but it also retries on other errors that are permanent
APIError,
InternalServerError,
RateLimitError,
ServiceUnavailableError,
)
LLM_RETRY_EXCEPTIONS: tuple[type[Exception], ...] = (RateLimitError,)

# cache prompt supporting models
# remove this when we gemini and deepseek are supported
Expand Down

0 comments on commit cc0bf44

Please sign in to comment.