summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/HuggingChat.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-03-25 21:06:51 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-03-25 21:06:51 +0100
commit347d3f92da458520b30e91e56bd66e472e084e70 (patch)
tree8fa21c18ce4380b89db814687483530f01fe506d /g4f/Provider/HuggingChat.py
parentMerge pull request #1744 from igeni/concat2fstr (diff)
downloadgpt4free-347d3f92da458520b30e91e56bd66e472e084e70.tar
gpt4free-347d3f92da458520b30e91e56bd66e472e084e70.tar.gz
gpt4free-347d3f92da458520b30e91e56bd66e472e084e70.tar.bz2
gpt4free-347d3f92da458520b30e91e56bd66e472e084e70.tar.lz
gpt4free-347d3f92da458520b30e91e56bd66e472e084e70.tar.xz
gpt4free-347d3f92da458520b30e91e56bd66e472e084e70.tar.zst
gpt4free-347d3f92da458520b30e91e56bd66e472e084e70.zip
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,