fix testing exception mapping

This commit is contained in:
Ishaan Jaff 2024-07-13 11:10:13 -07:00
parent d0dbc0742b
commit bcc89a2c3a
3 changed files with 27 additions and 1 deletions

View file

@ -479,7 +479,7 @@ def mock_completion(
if isinstance(mock_response, Exception):
if isinstance(mock_response, openai.APIError):
raise mock_response
raise litellm.APIError(
raise litellm.MockException(
status_code=getattr(mock_response, "status_code", 500), # type: ignore
message=getattr(mock_response, "text", str(mock_response)),
llm_provider=getattr(mock_response, "llm_provider", custom_llm_provider or "openai"), # type: ignore