mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-09-12 00:29:27 -04:00
Check supports_stream in best_providers list
This commit is contained in:
parent
3b8dfff974
commit
78bee08527
@ -16,14 +16,17 @@ class ChatCompletion:
|
|||||||
auth : Union[str, None] = None, **kwargs: Any) -> Union[CreateResult, str]:
|
auth : Union[str, None] = None, **kwargs: Any) -> Union[CreateResult, str]:
|
||||||
|
|
||||||
if isinstance(model, str):
|
if isinstance(model, str):
|
||||||
try:
|
if model in models.ModelUtils.convert:
|
||||||
model = models.ModelUtils.convert[model]
|
model = models.ModelUtils.convert[model]
|
||||||
except KeyError:
|
else:
|
||||||
raise Exception(f'The model: {model} does not exist')
|
raise Exception(f'The model: {model} does not exist')
|
||||||
|
|
||||||
if not provider:
|
if not provider:
|
||||||
if isinstance(model.best_provider, list):
|
if isinstance(model.best_provider, list):
|
||||||
provider = random.choice(model.best_provider)
|
if stream:
|
||||||
|
provider = random.choice([p for p in model.best_provider if p.supports_stream])
|
||||||
|
else:
|
||||||
|
provider = random.choice(model.best_provider)
|
||||||
else:
|
else:
|
||||||
provider = model.best_provider
|
provider = model.best_provider
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ from .Provider import (
|
|||||||
CodeLinkAva,
|
CodeLinkAva,
|
||||||
ChatgptAi,
|
ChatgptAi,
|
||||||
ChatBase,
|
ChatBase,
|
||||||
Yqcloud,
|
|
||||||
Vercel,
|
Vercel,
|
||||||
DeepAi,
|
DeepAi,
|
||||||
Aivvm,
|
Aivvm,
|
||||||
@ -32,7 +31,7 @@ gpt_35_turbo = Model(
|
|||||||
name = 'gpt-3.5-turbo',
|
name = 'gpt-3.5-turbo',
|
||||||
base_provider = 'openai',
|
base_provider = 'openai',
|
||||||
best_provider = [
|
best_provider = [
|
||||||
Yqcloud, DeepAi, CodeLinkAva, ChatgptLogin, ChatgptAi, ChatBase, Aivvm
|
DeepAi, CodeLinkAva, ChatgptLogin, ChatgptAi, ChatBase, Aivvm
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user