Fix Fireworks AI 429 error mapping to use RateLimitError instead of BadRequestError

This commit is contained in:
openhands 2025-04-05 21:06:48 +00:00
parent 7262606411
commit cf8d75b7fd
2 changed files with 61 additions and 0 deletions

View file

@ -20,6 +20,15 @@ class FireworksAIMixin:
def get_error_class(
self, error_message: str, status_code: int, headers: Union[dict, Headers]
) -> BaseLLMException:
# Check if it's a rate limit error (status code 429)
if status_code == 429:
from litellm.exceptions import RateLimitError
return RateLimitError(
message=f"Fireworks_aiException - {error_message}",
llm_provider="fireworks_ai",
model="", # This will be set later in the exception mapping
response=None, # This will be set later in the exception mapping
)
return FireworksAIException(
status_code=status_code,
message=error_message,