File size: 394 Bytes
6059138 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | from __future__ import annotations
RATE_LIMIT_MESSAGE = "Mistral API rate limit exceeded. Please wait a few seconds and try again."
def is_rate_limit_error(error: Exception) -> bool:
text = str(error).lower()
return (
"429" in text
or "rate limit" in text
or "rate_limited" in text
or '"code":"1300"' in text
or "'code': '1300'" in text
)
|