summaryrefslogtreecommitdiffstats
path: root/g4f/Provider/HuggingChat.py
diff options
context:
space:
mode:
authorH Lohaus <hlohaus@users.noreply.github.com>2024-11-16 13:19:51 +0100
committerGitHub <noreply@github.com>2024-11-16 13:19:51 +0100
commit6ce493d4dfc2884832ff5b5be4479a55818b2fe7 (patch)
tree92e9efce62f7832ebe56969c120d8e92e75881a3 /g4f/Provider/HuggingChat.py
parentUpdate internet.py (diff)
downloadgpt4free-6ce493d4dfc2884832ff5b5be4479a55818b2fe7.tar
gpt4free-6ce493d4dfc2884832ff5b5be4479a55818b2fe7.tar.gz
gpt4free-6ce493d4dfc2884832ff5b5be4479a55818b2fe7.tar.bz2
gpt4free-6ce493d4dfc2884832ff5b5be4479a55818b2fe7.tar.lz
gpt4free-6ce493d4dfc2884832ff5b5be4479a55818b2fe7.tar.xz
gpt4free-6ce493d4dfc2884832ff5b5be4479a55818b2fe7.tar.zst
gpt4free-6ce493d4dfc2884832ff5b5be4479a55818b2fe7.zip
Diffstat (limited to 'g4f/Provider/HuggingChat.py')
-rw-r--r--g4f/Provider/HuggingChat.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/g4f/Provider/HuggingChat.py b/g4f/Provider/HuggingChat.py
index d4a4b497..509a7f16 100644
--- a/g4f/Provider/HuggingChat.py
+++ b/g4f/Provider/HuggingChat.py
@@ -3,8 +3,13 @@ from __future__ import annotations
import json
import requests
-from curl_cffi import requests as cf_reqs
+try:
+ from curl_cffi import requests as cf_reqs
+ has_curl_cffi = True
+except ImportError:
+ has_curl_cffi = False
from ..typing import CreateResult, Messages
+from ..errors import MissingRequirementsError
from .base_provider import ProviderModelMixin, AbstractProvider
from .helper import format_prompt
@@ -55,6 +60,8 @@ class HuggingChat(AbstractProvider, ProviderModelMixin):
stream: bool,
**kwargs
) -> CreateResult:
+ if not has_curl_cffi:
+ raise MissingRequirementsError('Install "curl_cffi" package | pip install -U curl_cffi')
model = cls.get_model(model)
if model in cls.models: