mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-12-23 19:11:48 +03:00
Update types.py
This commit is contained in:
parent
393be6be6b
commit
c9a83e53b7
@ -5,7 +5,18 @@ ImageProvider = Union[BaseProvider, object]
|
||||
Proxies = Union[dict, str]
|
||||
IterResponse = Iterator[Union[ChatCompletion, ChatCompletionChunk]]
|
||||
|
||||
class Client():
|
||||
class ClientProxyMixin():
|
||||
def get_proxy(self) -> Union[str, None]:
|
||||
if isinstance(self.proxies, str):
|
||||
return self.proxies
|
||||
elif self.proxies is None:
|
||||
return os.environ.get("G4F_PROXY")
|
||||
elif "all" in self.proxies:
|
||||
return self.proxies["all"]
|
||||
elif "https" in self.proxies:
|
||||
return self.proxies["https"]
|
||||
|
||||
class Client(ClientProxyMixin):
|
||||
def __init__(
|
||||
self,
|
||||
api_key: str = None,
|
||||
@ -16,5 +27,3 @@ class Client():
|
||||
) -> None:
|
||||
self.api_key: str = api_key
|
||||
self.proxies: Proxies = proxies
|
||||
self.chat: Chat = Chat(self, provider)
|
||||
self.images: Images = Images(self, image_provider)
|
||||
|
Loading…
Reference in New Issue
Block a user