fix: Update test_exceptions.py to provide required arguments for litellm exceptions

This commit is contained in:
Paul Gauthier (aider) 2024-11-08 10:00:30 -08:00
parent 86d9275375
commit c472e6e160

View file

@ -21,7 +21,7 @@ def test_get_ex_info():
# Test with a known exception type
from litellm import AuthenticationError
auth_error = AuthenticationError()
auth_error = AuthenticationError(message="Invalid API key", llm_provider="openai", model="gpt-4")
ex_info = ex.get_ex_info(auth_error)
assert isinstance(ex_info, ExInfo)
assert ex_info.name == "AuthenticationError"
@ -45,7 +45,7 @@ def test_rate_limit_error():
ex = LiteLLMExceptions()
from litellm import RateLimitError
rate_error = RateLimitError()
rate_error = RateLimitError(message="Rate limit exceeded", llm_provider="openai", model="gpt-4")
ex_info = ex.get_ex_info(rate_error)
assert ex_info.retry is True
assert "rate limited" in ex_info.description.lower()
@ -56,6 +56,6 @@ def test_context_window_error():
ex = LiteLLMExceptions()
from litellm import ContextWindowExceededError
ctx_error = ContextWindowExceededError()
ctx_error = ContextWindowExceededError(message="Context length exceeded", model="gpt-4", llm_provider="openai")
ex_info = ex.get_ex_info(ctx_error)
assert ex_info.retry is False