fix(palm.py): exception mapping bad requests / filtered responses

This commit is contained in:
Krrish Dholakia 2023-11-14 11:53:06 -08:00
parent e1a567a353
commit e9e86cac79
3 changed files with 24 additions and 7 deletions

View file

@ -3445,6 +3445,15 @@ def exception_type(
llm_provider="palm",
response=original_exception.response
)
if hasattr(original_exception, "status_code"):
if original_exception.status_code == 400:
exception_mapping_worked = True
raise BadRequestError(
message=f"PalmException - {error_str}",
model=model,
llm_provider="palm",
response=original_exception.response
)
# Dailed: Error occurred: 400 Request payload size exceeds the limit: 20000 bytes
elif custom_llm_provider == "cohere": # Cohere
if (