返回提交历史
Modified
docs/providers-and-models.md
+0
-2
Deleted
g4f/Provider/ChatHub.py
+0
-84
Modified
g4f/Provider/__init__.py
+0
-1
Modified
g4f/models.py
+3
-13
XFEstudio/gpt4free
Provider removed (g4f/Provider/ChatHub.py)
75549df2
代码差异
4 个文件
+3
-100
@@ -37,7 +37,6 @@ This document provides an overview of various AI providers and models, including
37
37
|[chatgpt4online.org](https://chatgpt4online.org)|`g4f.Provider.Chatgpt4Online`|`gpt-4`|❌|❌|✔||❌|
38
38
|[chatgpt4o.one](https://chatgpt4o.one)|`g4f.Provider.Chatgpt4o`|✔|❌|❌|❌||❌|
39
39
|[chatgptfree.ai](https://chatgptfree.ai)|`g4f.Provider.ChatgptFree`|`gpt-4o-mini`|❌|❌|?||❌|
40
|[app.chathub.gg](https://app.chathub.gg)|`g4f.Provider.ChatHub`|`llama-3.1-8b, mixtral-8x7b, gemma-2, sonar-online`|❌|❌|✔||❌|
41
40
|[chatify-ai.vercel.app](https://chatify-ai.vercel.app)|`g4f.Provider.ChatifyAI`|`llama-3.1-8b`|❌|❌|✔||❌|
42
41
|[playground.ai.cloudflare.com](https://playground.ai.cloudflare.com)|`g4f.Provider.Cloudflare`|`german-7b, gemma-7b, llama-2-7b, llama-3-8b, llama-3.1-8b, llama-3.2-11b, llama-3.2-1b, llama-3.2-3b, mistral-7b, openchat-3.5, phi-2, qwen-1.5-0.5b, qwen-1.5-1.8b, qwen-1.5-14b, qwen-1.5-7b, tinyllama-1.1b, cybertron-7b`|❌|❌|✔||❌|
43
42
|[aiuncensored.info](https://www.aiuncensored.info)|`g4f.Provider.DarkAI`|`gpt-4o, gpt-3.5-turbo, llama-3-70b, llama-3-405b`|❌|❌|✔||❌|
@@ -144,7 +143,6 @@ This document provides an overview of various AI providers and models, including
144
143
|gemma-2b-9b|Google|1+ Providers|[huggingface.co](https://huggingface.co/google/gemma-2-9b)|
145
144
|gemma-2b-27b|Google|2+ Providers|[huggingface.co](https://huggingface.co/google/gemma-2-27b)|
146
145
|gemma-7b|Google|1+ Providers|[huggingface.co](https://huggingface.co/google/gemma-7b)|
147
|gemma-2|Google|2+ Providers|[huggingface.co](https://huggingface.co/blog/gemma2)|
148
146
|gemma_2_27b|Google|1+ Providers|[huggingface.co](https://huggingface.co/blog/gemma2)|
149
147
|claude-2.1|Anthropic|1+ Providers|[anthropic.com](https://www.anthropic.com/news/claude-2)|
150
148
|claude-3-haiku|Anthropic|4+ Providers|[anthropic.com](https://www.anthropic.com/news/claude-3-haiku)|
@@ -1,84 +0,0 @@
1
from __future__ import annotations
2
3
import json
4
from aiohttp import ClientSession
5
6
from ..typing import AsyncResult, Messages
7
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
8
from .helper import format_prompt
9
10
class ChatHub(AsyncGeneratorProvider, ProviderModelMixin):
11
label = "ChatHub"
12
url = "https://app.chathub.gg"
13
api_endpoint = "https://app.chathub.gg/api/v3/chat/completions"
14
working = True
15
supports_stream = True
16
supports_system_message = True
17
supports_message_history = True
18
19
default_model = 'meta/llama3.1-8b'
20
models = [
21
'meta/llama3.1-8b',
22
'mistral/mixtral-8x7b',
23
'google/gemma-2',
24
'perplexity/sonar-online',
25
]
26
27
model_aliases = {
28
"llama-3.1-8b": "meta/llama3.1-8b",
29
"mixtral-8x7b": "mistral/mixtral-8x7b",
30
"gemma-2": "google/gemma-2",
31
"sonar-online": "perplexity/sonar-online",
32
}
33
34
@classmethod
35
def get_model(cls, model: str) -> str:
36
if model in cls.models:
37
return model
38
elif model in cls.model_aliases:
39
return cls.model_aliases[model]
40
else:
41
return cls.default_model
42
43
@classmethod
44
async def create_async_generator(
45
cls,
46
model: str,
47
messages: Messages,
48
proxy: str = None,
49
**kwargs
50
) -> AsyncResult:
51
model = cls.get_model(model)
52
53
headers = {
54
'accept': '*/*',
55
'accept-language': 'en-US,en;q=0.9',
56
'content-type': 'application/json',
57
'origin': cls.url,
58
'referer': f"{cls.url}/chat/cloud-llama3.1-8b",
59
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36',
60
'x-app-id': 'web'
61
}
62
63
async with ClientSession(headers=headers) as session:
64
prompt = format_prompt(messages)
65
data = {
66
"model": model,
67
"messages": [{"role": "user", "content": prompt}],
68
"tools": []
69
}
70
71
async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response:
72
response.raise_for_status()
73
async for line in response.content:
74
if line:
75
decoded_line = line.decode('utf-8')
76
if decoded_line.startswith('data:'):
77
try:
78
data = json.loads(decoded_line[5:])
79
if data['type'] == 'text-delta':
80
yield data['textDelta']
81
elif data['type'] == 'done':
82
break
83
except json.JSONDecodeError:
84
continue
@@ -31,7 +31,6 @@ from .Chatgpt4Online import Chatgpt4Online
31
31
from .Chatgpt4o import Chatgpt4o
32
32
from .ChatGptEs import ChatGptEs
33
33
from .ChatgptFree import ChatgptFree
34
from .ChatHub import ChatHub
35
34
from .ChatifyAI import ChatifyAI
36
35
from .Cloudflare import Cloudflare
37
36
from .DarkAI import DarkAI
@@ -16,7 +16,6 @@ from .Provider import (
16
16
Chatgpt4Online,
17
17
ChatGptEs,
18
18
ChatgptFree,
19
ChatHub,
20
19
ChatifyAI,
21
20
Cloudflare,
22
21
DarkAI,
@@ -101,9 +100,7 @@ default = Model(
101
100
MagickPen,
102
101
DeepInfraChat,
103
102
Airforce,
104
ChatHub,
105
103
ChatGptEs,
106
ChatHub,
107
104
ChatifyAI,
108
105
Cloudflare,
109
106
Editee,
@@ -217,7 +214,7 @@ llama_3_70b = Model(
217
214
llama_3_1_8b = Model(
218
215
name = "llama-3.1-8b",
219
216
base_provider = "Meta Llama",
220
best_provider = IterListProvider([Blackbox, DeepInfraChat, ChatHub, Cloudflare, Airforce, PerplexityLabs])
217
best_provider = IterListProvider([Blackbox, DeepInfraChat, Cloudflare, Airforce, PerplexityLabs])
221
218
)
222
219
223
220
llama_3_1_70b = Model(
@@ -294,7 +291,7 @@ mistral_7b = Model(
294
291
mixtral_8x7b = Model(
295
292
name = "mixtral-8x7b",
296
293
base_provider = "Mistral",
297
best_provider = IterListProvider([DDG, ReplicateHome, DeepInfraChat, ChatHub, Airforce, DeepInfra])
294
best_provider = IterListProvider([DDG, ReplicateHome, DeepInfraChat, Airforce, DeepInfra])
298
295
)
299
296
300
297
mixtral_8x22b = Model(
@@ -395,12 +392,6 @@ gemma_7b = Model(
395
392
)
396
393
397
394
# gemma 2
398
gemma_2 = Model(
399
name = 'gemma-2',
400
base_provider = 'Google',
401
best_provider = ChatHub
402
)
403
404
395
gemma_2_9b = Model(
405
396
name = 'gemma-2-9b',
406
397
base_provider = 'Google',
@@ -674,7 +665,7 @@ grok_2_mini = Model(
674
665
sonar_online = Model(
675
666
name = 'sonar-online',
676
667
base_provider = 'Perplexity AI',
677
best_provider = IterListProvider([ChatHub, PerplexityLabs])
668
best_provider = IterListProvider([PerplexityLabs])
678
669
)
679
670
680
671
sonar_chat = Model(
@@ -992,7 +983,6 @@ class ModelUtils:
992
983
'gemma-7b': gemma_7b,
993
984
994
985
# gemma-2
995
'gemma-2': gemma_2,
996
986
'gemma-2-9b': gemma_2_9b,
997
987
998
988