File size: 2,265 Bytes
a4b70d9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
class G4FError(Exception):
    """Base exception for all g4f-related errors."""
    pass


class ProviderNotFoundError(G4FError):
    """Raised when a provider is not found."""
    pass


class ProviderNotWorkingError(G4FError):
    """Raised when the provider is unavailable or failing."""
    pass


class StreamNotSupportedError(G4FError):
    """Raised when the requested provider does not support streaming."""
    pass


class ModelNotFoundError(G4FError):
    """Raised when a model is not found."""
    pass


class ModelNotAllowedError(G4FError):
    """Raised when a model is not allowed by configuration or policy."""
    pass


class RetryProviderError(G4FError):
    """Raised to retry with another provider."""
    pass


class RetryNoProviderError(G4FError):
    """Raised when there are no providers left to retry."""
    pass


class VersionNotFoundError(G4FError):
    """Raised when the version could not be determined."""
    pass


class MissingRequirementsError(G4FError):
    """Raised when a required dependency is missing."""
    pass


class NestAsyncioError(MissingRequirementsError):
    """Raised when 'nest_asyncio' is missing."""
    pass


class MissingAuthError(G4FError):
    """Raised when authentication details are missing."""
    pass


class PaymentRequiredError(G4FError):
    """Raised when a provider requires payment before access."""
    pass


class NoMediaResponseError(G4FError):
    """Raised when a media request returns no response."""
    pass


class ResponseError(G4FError):
    """Base class for response-related errors."""
    pass


class ResponseStatusError(ResponseError):
    """Raised when an HTTP response returns a non-success status code."""
    pass


class CloudflareError(ResponseStatusError):
    """Raised when a request is blocked by Cloudflare."""
    pass


class RateLimitError(ResponseStatusError):
    """Raised when the provider's rate limit has been exceeded."""
    pass


class NoValidHarFileError(G4FError):
    """Raised when no valid HAR file is found."""
    pass


class TimeoutError(G4FError):
    """Raised for timeout errors during API requests."""
    pass


class ConversationLimitError(G4FError):
    """Raised when a conversation limit is reached on the provider."""
    pass