fix - show model group in exceptions

This commit is contained in:
Ishaan Jaff 2024-06-10 20:30:31 -07:00
parent fcd1d077f5
commit b4db464604
2 changed files with 7 additions and 0 deletions

View file

@ -337,6 +337,7 @@ class ContextWindowExceededError(BadRequestError): # type: ignore
model=self.model, # type: ignore model=self.model, # type: ignore
llm_provider=self.llm_provider, # type: ignore llm_provider=self.llm_provider, # type: ignore
response=response, response=response,
litellm_debug_info=self.litellm_debug_info,
) # Call the base class constructor with the parameters it needs ) # Call the base class constructor with the parameters it needs
def __str__(self): def __str__(self):
@ -379,6 +380,7 @@ class RejectedRequestError(BadRequestError): # type: ignore
model=self.model, # type: ignore model=self.model, # type: ignore
llm_provider=self.llm_provider, # type: ignore llm_provider=self.llm_provider, # type: ignore
response=response, response=response,
litellm_debug_info=self.litellm_debug_info,
) # Call the base class constructor with the parameters it needs ) # Call the base class constructor with the parameters it needs
def __str__(self): def __str__(self):
@ -418,6 +420,7 @@ class ContentPolicyViolationError(BadRequestError): # type: ignore
model=self.model, # type: ignore model=self.model, # type: ignore
llm_provider=self.llm_provider, # type: ignore llm_provider=self.llm_provider, # type: ignore
response=response, response=response,
litellm_debug_info=self.litellm_debug_info,
) # Call the base class constructor with the parameters it needs ) # Call the base class constructor with the parameters it needs
def __str__(self): def __str__(self):

View file

@ -55,8 +55,12 @@ async def test_content_policy_exception_azure():
except litellm.ContentPolicyViolationError as e: except litellm.ContentPolicyViolationError as e:
print("caught a content policy violation error! Passed") print("caught a content policy violation error! Passed")
print("exception", e) print("exception", e)
assert e.litellm_debug_info is not None
assert isinstance(e.litellm_debug_info, str)
assert len(e.litellm_debug_info) > 0
pass pass
except Exception as e: except Exception as e:
print()
pytest.fail(f"An exception occurred - {str(e)}") pytest.fail(f"An exception occurred - {str(e)}")