summaryrefslogtreecommitdiffstats
path: root/g4f
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-04-06 21:12:02 +0200
committerGitHub <noreply@github.com>2024-04-06 21:12:02 +0200
commit393be6be6b27cdfc9ae29da47c806361db72b683 (patch)
tree466188e7268861a8c5455a649a079004d56e4b38 /g4f
parentUpdate helper.py (diff)
downloadgpt4free-393be6be6b27cdfc9ae29da47c806361db72b683.tar
gpt4free-393be6be6b27cdfc9ae29da47c806361db72b683.tar.gz
gpt4free-393be6be6b27cdfc9ae29da47c806361db72b683.tar.bz2
gpt4free-393be6be6b27cdfc9ae29da47c806361db72b683.tar.lz
gpt4free-393be6be6b27cdfc9ae29da47c806361db72b683.tar.xz
gpt4free-393be6be6b27cdfc9ae29da47c806361db72b683.tar.zst
gpt4free-393be6be6b27cdfc9ae29da47c806361db72b683.zip
Diffstat (limited to '')
-rw-r--r--g4f/client/async.py22
1 files changed, 4 insertions, 18 deletions
diff --git a/g4f/client/async.py b/g4f/client/async.py
index bcd1a502..96c715d4 100644
--- a/g4f/client/async.py
+++ b/g4f/client/async.py
@@ -6,6 +6,7 @@ import time
import random
import string
+from .types import Client as BaseClient
from .types import BaseProvider, ProviderType, FinishReason
from .stubs import ChatCompletion, ChatCompletionChunk, Image, ImagesResponse
from ..typing import Union, Iterator, Messages, ImageType, AsyncIerator
@@ -61,30 +62,15 @@ async def iter_append_model_and_provider(response: AsyncIterResponse) -> IterRes
chunk.provider = last_provider.get("name")
yield chunk
-class Client():
+class Client(BaseClient):
def __init__(
self,
- api_key: str = None,
- proxies: Proxies = None,
- provider: ProviderType = None,
- image_provider: ImageProvider = None,
**kwargs
- ) -> None:
- self.api_key: str = api_key
- self.proxies: Proxies = proxies
+ ):
+ super().__init__(**kwargs)
self.chat: Chat = Chat(self, provider)
self.images: Images = Images(self, image_provider)
- 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"]
-
def filter_none(**kwargs):
for key in list(kwargs.keys()):
if kwargs[key] is None: