From 4fe49d120523f5fa80fcd4d4e84063df0e4b1e53 Mon Sep 17 00:00:00 2001 From: Hamada Salhab Date: Thu, 10 Oct 2024 18:00:24 +0300 Subject: [PATCH] feat(agents-api): Add some LiteLLM exceptions to the list of non-retryable errors (#622) Added the following exceptions: - `litellm.exceptions.NotFoundError`. - `litellm.exceptions.InvalidRequestError`. - `litellm.exceptions.AuthenticationError`. - `litellm.exceptions.ServiceUnavailableError`. - `litellm.exceptions.OpenAIError`. - `litellm.exceptions.APIError`. ---- > [!IMPORTANT] > Add LiteLLM exceptions to non-retryable errors in `tasks.py`. > > - **Exceptions**: > - Added `litellm.exceptions.NotFoundError`, `InvalidRequestError`, `AuthenticationError`, `ServiceUnavailableError`, `OpenAIError`, and `APIError` to `NON_RETRYABLE_ERROR_TYPES` in `tasks.py`. > > This description was created by [Ellipsis](https://www.ellipsis.dev?ref=julep-ai%2Fjulep&utm_source=github&utm_medium=referral) for 018360cfe4c489b62de1b6ee3eaea2cb7e3e92b4. It will automatically update as commits are pushed. --- agents-api/agents_api/common/exceptions/tasks.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/agents-api/agents_api/common/exceptions/tasks.py b/agents-api/agents_api/common/exceptions/tasks.py index 6e1df0734..8ead1e7e2 100644 --- a/agents-api/agents_api/common/exceptions/tasks.py +++ b/agents-api/agents_api/common/exceptions/tasks.py @@ -14,6 +14,7 @@ import httpx import jinja2 import jsonschema.exceptions +import litellm import pydantic import requests import temporalio.exceptions @@ -70,10 +71,12 @@ pydantic.ValidationError, requests.exceptions.InvalidURL, requests.exceptions.MissingSchema, + # # Box exceptions box.exceptions.BoxKeyError, box.exceptions.BoxTypeError, box.exceptions.BoxValueError, + # # Beartype exceptions beartype.roar.BeartypeException, beartype.roar.BeartypeDecorException, @@ -88,6 +91,14 @@ beartype.roar.BeartypeCallHintReturnViolation, beartype.roar.BeartypeDecorHintParamDefaultViolation, beartype.roar.BeartypeDoorHintViolation, + # + # LiteLLM exceptions + litellm.exceptions.NotFoundError, + litellm.exceptions.InvalidRequestError, + litellm.exceptions.AuthenticationError, + litellm.exceptions.ServiceUnavailableError, + litellm.exceptions.OpenAIError, + litellm.exceptions.APIError, ]