summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/HuggingChat.py
diff options
context:
space:
mode:
Diffstat (limited to 'g4f/Provider/HuggingChat.py')
-rw-r--r--g4f/Provider/HuggingChat.py16
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,