diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-01-23 20:08:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-23 20:08:41 +0100 |
commit | 2b140a32554c1e94d095c55599a2f93e86f957cf (patch) | |
tree | e2770d97f0242a0b99a3af68ea4fcf25227dfcc8 /g4f/Provider/Liaobots.py | |
parent | ~ (diff) | |
parent | Add ProviderModelMixin for model selection (diff) | |
download | gpt4free-2b140a32554c1e94d095c55599a2f93e86f957cf.tar gpt4free-2b140a32554c1e94d095c55599a2f93e86f957cf.tar.gz gpt4free-2b140a32554c1e94d095c55599a2f93e86f957cf.tar.bz2 gpt4free-2b140a32554c1e94d095c55599a2f93e86f957cf.tar.lz gpt4free-2b140a32554c1e94d095c55599a2f93e86f957cf.tar.xz gpt4free-2b140a32554c1e94d095c55599a2f93e86f957cf.tar.zst gpt4free-2b140a32554c1e94d095c55599a2f93e86f957cf.zip |
Diffstat (limited to 'g4f/Provider/Liaobots.py')
-rw-r--r-- | g4f/Provider/Liaobots.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/g4f/Provider/Liaobots.py b/g4f/Provider/Liaobots.py index 88f0c4ff..5151c115 100644 --- a/g4f/Provider/Liaobots.py +++ b/g4f/Provider/Liaobots.py @@ -5,7 +5,7 @@ import uuid from aiohttp import ClientSession from ..typing import AsyncResult, Messages -from .base_provider import AsyncGeneratorProvider +from .base_provider import AsyncGeneratorProvider, ProviderModelMixin models = { "gpt-4": { @@ -70,13 +70,17 @@ models = { } } - -class Liaobots(AsyncGeneratorProvider): +class Liaobots(AsyncGeneratorProvider, ProviderModelMixin): url = "https://liaobots.site" working = True supports_message_history = True supports_gpt_35_turbo = True supports_gpt_4 = True + default_model = "gpt-3.5-turbo" + models = [m for m in models] + model_aliases = { + "claude-v2": "claude-2" + } _auth_code = None _cookie_jar = None @@ -89,7 +93,6 @@ class Liaobots(AsyncGeneratorProvider): proxy: str = None, **kwargs ) -> AsyncResult: - model = model if model in models else "gpt-3.5-turbo" headers = { "authority": "liaobots.com", "content-type": "application/json", @@ -122,7 +125,7 @@ class Liaobots(AsyncGeneratorProvider): data = { "conversationId": str(uuid.uuid4()), - "model": models[model], + "model": models[cls.get_model(model)], "messages": messages, "key": "", "prompt": kwargs.get("system_message", "You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully."), |