The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(utils.py): map cohere timeout error
Krrish Dholakiabd68714f51b2
diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.pyindex 6e26c28c8d8..99542a9a202 100644--- a/litellm/tests/test_completion.py+++ b/litellm/tests/test_completion.py@@ -719,6 +719,8 @@ def test_completion_cohere_command_r_plus_function_call():force_single_step=True,)print(second_response)+ except litellm.Timeout:+ passexcept Exception as e:pytest.fail(f"Error occurred: {e}")diff --git a/litellm/utils.py b/litellm/utils.pyindex fe65e415b28..02ec7415a9d 100644--- a/litellm/utils.py+++ b/litellm/utils.py@@ -7328,6 +7328,13 @@ def exception_type(model=model,response=original_exception.response,)+ elif original_exception.status_code == 408:+ exception_mapping_worked = True+ raise Timeout(+ message=f"CohereException - {original_exception.message}",+ llm_provider="cohere",+ model=model,+ )elif original_exception.status_code == 500:exception_mapping_worked = Trueraise ServiceUnavailableError(