From bb473beceb2deeb9f97049dcf5617ae1b54e7a8e Mon Sep 17 00:00:00 2001 From: pratik2315 Date: Sat, 9 Sep 2023 17:41:44 +0530 Subject: [PATCH 1/3] modified the exception mapping table --- docs/my-website/docs/exception_mapping.md | 65 ++++++++++++----------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/docs/my-website/docs/exception_mapping.md b/docs/my-website/docs/exception_mapping.md index 41513da00..24ef51f1f 100644 --- a/docs/my-website/docs/exception_mapping.md +++ b/docs/my-website/docs/exception_mapping.md @@ -40,39 +40,40 @@ To see how it's implemented - [check out the code](https://github.com/BerriAI/li Base case - we return the original exception. -| LLM Provider | Initial Status Code / Initial Error Message | Returned Exception | Returned Status Code | -|----------------------|------------------------|-----------------|-----------------| -| Anthropic | prompt is too long | ContextWindowExceededError | 400 | -| Anthropic | 401 | AuthenticationError | 401 | -| Anthropic | Could not resolve authentication method. Expected either api_key or auth_token to be set. | AuthenticationError | 401 | -| Anthropic | 400 | InvalidRequestError | 400 | -| Anthropic | 429 | RateLimitError | 429 | -| OpenAI | This model's maximum context length is | ContextWindowExceededError | 400 | -| Replicate | input is too long | ContextWindowExceededError | 400 | -| Replicate | Incorrect authentication token | AuthenticationError | 401 | -| Replicate | ModelError | InvalidRequestError | 400 | -| Replicate | Request was throttled | RateLimitError | 429 | -| Replicate | ReplicateError | ServiceUnavailableError | 500 | -| Cohere | invalid api token | AuthenticationError | 401 | -| Cohere | too many tokens | ContextWindowExceededError | 400 | -| Cohere | CohereConnectionError | RateLimitError | 429 | -| Huggingface | length limit exceeded | ContextWindowExceededError | 400 | -| Huggingface | 400 | InvalidRequestError | 400 | -| Huggingface | 401 | AuthenticationError | 401 | -| Huggingface | 429 | RateLimitError | 429 | -| Openrouter | 413 | ContextWindowExceededError | 400 | -| Openrouter | 401 | AuthenticationError | 401 | -| Openrouter | 429 | RateLimitError | 429 | -| AI21 | Prompt has too many tokens | ContextWindowExceededError | 400 | -| AI21 | 422 | InvalidRequestError | 400 | -| AI21 | 401 | AuthenticationError | 401 | -| AI21 | 429 | RateLimitError | 429 | -| TogetherAI | inputs` tokens + `max_new_tokens` must be <= | ContextWindowExceededError | 400 | -| TogetherAI | INVALID_ARGUMENT | InvalidRequestError | 400 | -| TogetherAI | "error_type": "validation" | InvalidRequestError | 400 | -| TogetherAI | invalid private key | AuthenticationError | 401 | -| TogetherAI | 429 | RateLimitError | 429 | +| LLM Provider | Returned Status Code | +| ------------- | --------------------- | +| Anthropic | 400 | +| Anthropic | 401 | +| Anthropic | 401 | +| Anthropic | 400 | +| Anthropic | 429 | +| OpenAI | 400 | +| Replicate | 400 | +| Replicate | 401 | +| Replicate | 400 | +| Replicate | 429 | +| Replicate | 500 | +| Cohere | 401 | +| Cohere | 400 | +| Cohere | 429 | +| Huggingface | 400 | +| Huggingface | 400 | +| Huggingface | 401 | +| Huggingface | 429 | +| Openrouter | 400 | +| Openrouter | 401 | +| Openrouter | 429 | +| AI21 | 400 | +| AI21 | 400 | +| AI21 | 401 | +| AI21 | 429 | +| TogetherAI | 400 | +| TogetherAI | 400 | +| TogetherAI | 400 | +| TogetherAI | 401 | +| TogetherAI | 429 | +> For a deeper understanding of these exceptions, you can check out [this](https://github.com/BerriAI/litellm/blob/d7e58d13bf9ba9edbab2ab2f096f3de7547f35fa/litellm/utils.py#L1544) implementation for additional insights. The `ContextWindowExceededError` is a sub-class of `InvalidRequestError`. It was introduced to provide more granularity for exception-handling scenarios. Please refer to [this issue to learn more](https://github.com/BerriAI/litellm/issues/228). From 011e976d24df9526188bff55e88a599a1e513bc4 Mon Sep 17 00:00:00 2001 From: pratik2315 Date: Sun, 10 Sep 2023 23:27:53 +0530 Subject: [PATCH 2/3] made correction in column names --- docs/my-website/docs/exception_mapping.md | 64 +++++++++++------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/docs/my-website/docs/exception_mapping.md b/docs/my-website/docs/exception_mapping.md index 24ef51f1f..d0c92a2b9 100644 --- a/docs/my-website/docs/exception_mapping.md +++ b/docs/my-website/docs/exception_mapping.md @@ -40,38 +40,38 @@ To see how it's implemented - [check out the code](https://github.com/BerriAI/li Base case - we return the original exception. -| LLM Provider | Returned Status Code | -| ------------- | --------------------- | -| Anthropic | 400 | -| Anthropic | 401 | -| Anthropic | 401 | -| Anthropic | 400 | -| Anthropic | 429 | -| OpenAI | 400 | -| Replicate | 400 | -| Replicate | 401 | -| Replicate | 400 | -| Replicate | 429 | -| Replicate | 500 | -| Cohere | 401 | -| Cohere | 400 | -| Cohere | 429 | -| Huggingface | 400 | -| Huggingface | 400 | -| Huggingface | 401 | -| Huggingface | 429 | -| Openrouter | 400 | -| Openrouter | 401 | -| Openrouter | 429 | -| AI21 | 400 | -| AI21 | 400 | -| AI21 | 401 | -| AI21 | 429 | -| TogetherAI | 400 | -| TogetherAI | 400 | -| TogetherAI | 400 | -| TogetherAI | 401 | -| TogetherAI | 429 | +| LLM Provider | Returned Exception | +|---------------|-----------------------------| +| Anthropic | ContextWindowExceededError | +| Anthropic | AuthenticationError | +| Anthropic | AuthenticationError | +| Anthropic | InvalidRequestError | +| Anthropic | RateLimitError | +| OpenAI | ContextWindowExceededError | +| Replicate | ContextWindowExceededError | +| Replicate | AuthenticationError | +| Replicate | InvalidRequestError | +| Replicate | RateLimitError | +| Replicate | ServiceUnavailableError | +| Cohere | AuthenticationError | +| Cohere | ContextWindowExceededError | +| Cohere | RateLimitError | +| Huggingface | ContextWindowExceededError | +| Huggingface | InvalidRequestError | +| Huggingface | AuthenticationError | +| Huggingface | RateLimitError | +| Openrouter | ContextWindowExceededError | +| Openrouter | AuthenticationError | +| Openrouter | RateLimitError | +| AI21 | ContextWindowExceededError | +| AI21 | InvalidRequestError | +| AI21 | AuthenticationError | +| AI21 | RateLimitError | +| TogetherAI | ContextWindowExceededError | +| TogetherAI | InvalidRequestError | +| TogetherAI | InvalidRequestError | +| TogetherAI | AuthenticationError | +| TogetherAI | RateLimitError | > For a deeper understanding of these exceptions, you can check out [this](https://github.com/BerriAI/litellm/blob/d7e58d13bf9ba9edbab2ab2f096f3de7547f35fa/litellm/utils.py#L1544) implementation for additional insights. From 22f5f7859f103db025954279733fc761410fcba7 Mon Sep 17 00:00:00 2001 From: Krish Dholakia Date: Mon, 11 Sep 2023 13:42:42 -0700 Subject: [PATCH 3/3] Update exception_mapping.md --- docs/my-website/docs/exception_mapping.md | 43 ++++++----------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/docs/my-website/docs/exception_mapping.md b/docs/my-website/docs/exception_mapping.md index d0c92a2b9..e59c0d4c3 100644 --- a/docs/my-website/docs/exception_mapping.md +++ b/docs/my-website/docs/exception_mapping.md @@ -40,38 +40,17 @@ To see how it's implemented - [check out the code](https://github.com/BerriAI/li Base case - we return the original exception. -| LLM Provider | Returned Exception | -|---------------|-----------------------------| -| Anthropic | ContextWindowExceededError | -| Anthropic | AuthenticationError | -| Anthropic | AuthenticationError | -| Anthropic | InvalidRequestError | -| Anthropic | RateLimitError | -| OpenAI | ContextWindowExceededError | -| Replicate | ContextWindowExceededError | -| Replicate | AuthenticationError | -| Replicate | InvalidRequestError | -| Replicate | RateLimitError | -| Replicate | ServiceUnavailableError | -| Cohere | AuthenticationError | -| Cohere | ContextWindowExceededError | -| Cohere | RateLimitError | -| Huggingface | ContextWindowExceededError | -| Huggingface | InvalidRequestError | -| Huggingface | AuthenticationError | -| Huggingface | RateLimitError | -| Openrouter | ContextWindowExceededError | -| Openrouter | AuthenticationError | -| Openrouter | RateLimitError | -| AI21 | ContextWindowExceededError | -| AI21 | InvalidRequestError | -| AI21 | AuthenticationError | -| AI21 | RateLimitError | -| TogetherAI | ContextWindowExceededError | -| TogetherAI | InvalidRequestError | -| TogetherAI | InvalidRequestError | -| TogetherAI | AuthenticationError | -| TogetherAI | RateLimitError | +| | ContextWindowExceededError | AuthenticationError | InvalidRequestError | RateLimitError | ServiceUnavailableError | +|---------------|----------------------------|---------------------|---------------------|---------------|-------------------------| +| Anthropic | ✅ | ✅ | ✅ | ✅ | | +| OpenAI | ✅ | ✅ |✅ |✅ |✅ | +| Replicate | ✅ | ✅ | ✅ | ✅ | ✅ | +| Cohere | ✅ | ✅ | | ✅ | | +| Huggingface | ✅ | ✅ | ✅ | ✅ | | +| Openrouter | ✅ | ✅ | | ✅ | | +| AI21 | ✅ | ✅ | ✅ | ✅ | | +| TogetherAI | ✅ | ✅ | ✅ | ✅ | | + > For a deeper understanding of these exceptions, you can check out [this](https://github.com/BerriAI/litellm/blob/d7e58d13bf9ba9edbab2ab2f096f3de7547f35fa/litellm/utils.py#L1544) implementation for additional insights.