"""FastGPT Client Exceptions.""" class FastGPTError(Exception): """Base exception for all FastGPT errors.""" def __init__(self, message: str, status_code: int = None, response_data: dict = None): self.message = message self.status_code = status_code self.response_data = response_data or {} super().__init__(self.message) class APIError(FastGPTError): """General API error (4xx, 5xx responses).""" pass class AuthenticationError(FastGPTError): """Authentication failed (401).""" pass class RateLimitError(FastGPTError): """Rate limit exceeded (429).""" def __init__(self, message: str, retry_after: str = None, status_code: int = None, response_data: dict = None): super().__init__(message, status_code, response_data) self.retry_after = retry_after class ValidationError(FastGPTError): """Invalid request parameters (422).""" pass class StreamParseError(FastGPTError): """Error parsing streaming response.""" pass