diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-01-23 09:31:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-23 09:31:02 +0100 |
commit | c10f49de5ffd3cb020fc94c390ea3331fa58413d (patch) | |
tree | b2bfafba1f5856ecd911f210767c448fd971ec5b /g4f/Provider/HuggingChat.py | |
parent | Merge pull request #1504 from hlohaus/sort (diff) | |
parent | Check for comments in copilot (diff) | |
download | gpt4free-c10f49de5ffd3cb020fc94c390ea3331fa58413d.tar gpt4free-c10f49de5ffd3cb020fc94c390ea3331fa58413d.tar.gz gpt4free-c10f49de5ffd3cb020fc94c390ea3331fa58413d.tar.bz2 gpt4free-c10f49de5ffd3cb020fc94c390ea3331fa58413d.tar.lz gpt4free-c10f49de5ffd3cb020fc94c390ea3331fa58413d.tar.xz gpt4free-c10f49de5ffd3cb020fc94c390ea3331fa58413d.tar.zst gpt4free-c10f49de5ffd3cb020fc94c390ea3331fa58413d.zip |
Diffstat (limited to 'g4f/Provider/HuggingChat.py')
-rw-r--r-- | g4f/Provider/HuggingChat.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/g4f/Provider/HuggingChat.py b/g4f/Provider/HuggingChat.py index 4a42b3c8..3b4a520c 100644 --- a/g4f/Provider/HuggingChat.py +++ b/g4f/Provider/HuggingChat.py @@ -8,14 +8,23 @@ from ..typing import AsyncResult, Messages from .base_provider import AsyncGeneratorProvider from .helper import format_prompt, get_cookies -map = { - "openchat/openchat_3.5": "openchat/openchat-3.5-1210", -} class HuggingChat(AsyncGeneratorProvider): url = "https://huggingface.co/chat" working = True - model = "meta-llama/Llama-2-70b-chat-hf" + default_model = "meta-llama/Llama-2-70b-chat-hf" + models = [ + "mistralai/Mixtral-8x7B-Instruct-v0.1", + "meta-llama/Llama-2-70b-chat-hf", + "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO", + "codellama/CodeLlama-34b-Instruct-hf", + "mistralai/Mistral-7B-Instruct-v0.2", + "openchat/openchat-3.5-0106" + ] + model_map = { + "openchat/openchat_3.5": "openchat/openchat-3.5-1210", + "mistralai/Mixtral-8x7B-Instruct-v0.1": "mistralai/Mistral-7B-Instruct-v0.2" + } @classmethod async def create_async_generator( @@ -29,9 +38,11 @@ class HuggingChat(AsyncGeneratorProvider): **kwargs ) -> AsyncResult: if not model: - model = cls.model - elif model in map: - model = map[model] + model = cls.default_model + elif model in cls.model_map: + model = cls.model_map[model] + elif model not in cls.models: + raise ValueError(f"Model is not supported: {model}") if not cookies: cookies = get_cookies(".huggingface.co") |