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 )