summaryrefslogtreecommitdiffstats
path: root/g4f/__init__.py
diff options
context:
space:
mode:
authorHeiner Lohaus <heiner@lohaus.eu>2023-09-21 20:10:59 +0200
committerHeiner Lohaus <heiner@lohaus.eu>2023-09-21 20:10:59 +0200
commite9f96ced9c534f313fd2d3b82b2464cd8424281a (patch)
tree5cf9db5b89d61f5e6c582d6e1129d7269669ed97 /g4f/__init__.py
parentFix create_event_loop function (diff)
downloadgpt4free-e9f96ced9c534f313fd2d3b82b2464cd8424281a.tar
gpt4free-e9f96ced9c534f313fd2d3b82b2464cd8424281a.tar.gz
gpt4free-e9f96ced9c534f313fd2d3b82b2464cd8424281a.tar.bz2
gpt4free-e9f96ced9c534f313fd2d3b82b2464cd8424281a.tar.lz
gpt4free-e9f96ced9c534f313fd2d3b82b2464cd8424281a.tar.xz
gpt4free-e9f96ced9c534f313fd2d3b82b2464cd8424281a.tar.zst
gpt4free-e9f96ced9c534f313fd2d3b82b2464cd8424281a.zip
Diffstat (limited to '')
-rw-r--r--g4f/__init__.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/g4f/__init__.py b/g4f/__init__.py
index e42be8a8..8fdfe21f 100644
--- a/g4f/__init__.py
+++ b/g4f/__init__.py
@@ -14,13 +14,7 @@ def get_model_and_provider(model: Union[models.Model, str], provider: type[BaseP
raise Exception(f'The model: {model} does not exist')
if not provider:
- if isinstance(model.best_provider, list):
- if stream:
- provider = random.choice([p for p in model.best_provider if p.supports_stream])
- else:
- provider = random.choice(model.best_provider)
- else:
- provider = model.best_provider
+ provider = model.best_provider
if not provider:
raise Exception(f'No provider found for model: {model}')
@@ -70,7 +64,7 @@ class ChatCompletion:
model, provider = get_model_and_provider(model, provider, False)
- if not issubclass(provider, AsyncProvider):
+ if not issubclass(type(provider), AsyncProvider):
raise Exception(f"Provider: {provider.__name__} doesn't support create_async")
return await provider.create_async(model.name, messages, **kwargs)