gpt4free/g4f/errors.py
hlohaus bf4ed09ab9 feat: Refactor extra_body handling and update model error handling
- Changed the default value of `extra_body` from an empty dictionary to `None` in `ImageLabs` and `PollinationsAI` classes.
- Added a check to initialize `extra_body` to an empty dictionary if it is `None` in the `ImageLabs` class.
- Removed the `extra_image_models` list from the `PollinationsAI` class.
- Updated the way image models are combined in the `PollinationsAI` class to avoid duplicates.
- Changed the error handling for unsupported models from `ModelNotSupportedError` to `ModelNotFoundError` in multiple classes including `OpenaiChat`, `HuggingFaceAPI`, and `HuggingFaceInference`.
- Updated the `save_response_media` function to handle both string and bytes responses.
- Adjusted the handling of audio data in the `PollinationsAI` class to ensure proper processing of audio responses.
2025-06-12 02:29:41 +02:00

56 lines
No EOL
1 KiB
Python

class ProviderNotFoundError(Exception):
...
class ProviderNotWorkingError(Exception):
...
class StreamNotSupportedError(Exception):
...
class ModelNotFoundError(Exception):
...
class ModelNotAllowedError(Exception):
...
class RetryProviderError(Exception):
...
class RetryNoProviderError(Exception):
...
class VersionNotFoundError(Exception):
...
class MissingRequirementsError(Exception):
...
class NestAsyncioError(MissingRequirementsError):
...
class MissingAuthError(Exception):
...
class PaymentRequiredError(Exception):
...
class NoMediaResponseError(Exception):
...
class ResponseError(Exception):
...
class ResponseStatusError(Exception):
...
class RateLimitError(ResponseStatusError):
...
class NoValidHarFileError(Exception):
...
class TimeoutError(Exception):
"""Raised for timeout errors during API requests."""
class ConversationLimitError(Exception):
"""Raised for conversation limit during API requests to AI endpoint."""