diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-03-25 21:21:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-25 21:21:09 +0100 |
commit | cf3f8cc6bd7cf7eb0dca1afca4937066c1c1f291 (patch) | |
tree | 217e6fd1d3440d7e5fe1ce6907c2273d16567827 /g4f/Provider/HuggingChat.py | |
parent | ~ (diff) | |
parent | Update min requirements, Add pycryptodome (diff) | |
download | gpt4free-cf3f8cc6bd7cf7eb0dca1afca4937066c1c1f291.tar gpt4free-cf3f8cc6bd7cf7eb0dca1afca4937066c1c1f291.tar.gz gpt4free-cf3f8cc6bd7cf7eb0dca1afca4937066c1c1f291.tar.bz2 gpt4free-cf3f8cc6bd7cf7eb0dca1afca4937066c1c1f291.tar.lz gpt4free-cf3f8cc6bd7cf7eb0dca1afca4937066c1c1f291.tar.xz gpt4free-cf3f8cc6bd7cf7eb0dca1afca4937066c1c1f291.tar.zst gpt4free-cf3f8cc6bd7cf7eb0dca1afca4937066c1c1f291.zip |
Diffstat (limited to '')
-rw-r--r-- | g4f/Provider/HuggingChat.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/g4f/Provider/HuggingChat.py b/g4f/Provider/HuggingChat.py index 52c5ae31..5c95b679 100644 --- a/g4f/Provider/HuggingChat.py +++ b/g4f/Provider/HuggingChat.py @@ -1,7 +1,7 @@ from __future__ import annotations import json - +import requests from aiohttp import ClientSession, BaseConnector from ..typing import AsyncResult, Messages @@ -14,20 +14,28 @@ class HuggingChat(AsyncGeneratorProvider, ProviderModelMixin): working = True default_model = "meta-llama/Llama-2-70b-chat-hf" models = [ - "google/gemma-7b-it", "mistralai/Mixtral-8x7B-Instruct-v0.1", + "google/gemma-7b-it", "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", - "codellama/CodeLlama-70b-Instruct-hf" ] model_aliases = { - "openchat/openchat_3.5": "openchat/openchat-3.5-1210", + "openchat/openchat_3.5": "openchat/openchat-3.5-0106", } @classmethod + def get_models(cls): + if not cls.models: + url = f"{cls.url}/__data.json" + data = requests.get(url).json()["nodes"][0]["data"] + models = [data[key]["name"] for key in data[data[0]["models"]]] + cls.models = [data[key] for key in models] + return cls.models + + @classmethod async def create_async_generator( cls, model: str, |