返回提交历史
Modified
README.md
+41
-52
Modified
g4f/Provider/EasyChat.py
+1
-1
Modified
g4f/Provider/Equing.py
+3
-3
Modified
g4f/Provider/GetGpt.py
+1
-1
Modified
g4f/Provider/Liaobots.py
+1
-1
Modified
g4f/Provider/Wuguokai.py
+3
-8
Modified
g4f/__init__.py
+11
-2
Modified
g4f/models.py
+13
-8
Modified
testing/test_chat_completion.py
+3
-8
Modified
tool/readme_table.py
+45
-12
XFEstudio/gpt4free
Disable not working providers: EasyChat, Equing, GetGpt, Liaobots and Wuguokai No and random best provider for a model Update providers in Readme
618addd0
代码差异
10 个文件
+122
-96
@@ -194,9 +194,6 @@ from g4f.Provider import (
194
194
ChatgptLogin,
195
195
CodeLinkAva,
196
196
DeepAi,
197
EasyChat,
198
Equing,
199
GetGpt,
200
197
H2o,
201
198
HuggingChat,
202
199
Opchatgpts,
@@ -207,7 +204,6 @@ from g4f.Provider import (
207
204
Vercel,
208
205
Vitalentum,
209
206
Wewordle,
210
Wuguokai,
211
207
Ylokh,
212
208
You,
213
209
Yqcloud,
@@ -218,7 +214,8 @@ response = g4f.ChatCompletion.create(..., provider=ProviderName)
218
214
219
215
##### Cookies Required:
220
216
221
Cookies are essential for the proper functioning of many service providers. When using Bing, it's necessary to have a session where you have successfully passed the captcha. For other providers, logging into your account is a prerequisite.
217
Cookies are essential for the proper functioning of some service providers.
218
It is imperative to maintain an active session, typically achieved by logging into your account.
222
219
223
220
When running the g4f package locally, the package automatically retrieves cookies from your web browser using the `get_cookies` function. However, if you're not running it locally, you'll need to provide the cookies manually by passing them as parameters using the `cookies` parameter.
224
221
@@ -227,11 +224,9 @@ import g4f
227
224
from g4f.Provider import (
228
225
Bard,
229
226
Bing,
230
H2o,
231
227
HuggingChat,
232
228
OpenAssistant,
233
229
OpenaiChat,
234
You,
235
230
)
236
231
# Usage:
237
232
response = g4f.ChatCompletion.create(
@@ -258,18 +253,12 @@ async def run_async():
258
253
g4f.Provider.Aichat,
259
254
g4f.Provider.Ails,
260
255
g4f.Provider.Aivvm,
261
g4f.Provider.Bard,
262
g4f.Provider.Bing,
263
256
g4f.Provider.ChatBase,
264
257
g4f.Provider.ChatgptAi,
265
258
g4f.Provider.ChatgptLogin,
266
259
g4f.Provider.CodeLinkAva,
267
260
g4f.Provider.DeepAi,
268
g4f.Provider.H2o,
269
g4f.Provider.HuggingChat,
270
261
g4f.Provider.Opchatgpts,
271
g4f.Provider.OpenAssistant,
272
g4f.Provider.OpenaiChat,
273
262
g4f.Provider.Vercel,
274
263
g4f.Provider.Vitalentum,
275
264
g4f.Provider.Wewordle,
@@ -279,7 +268,7 @@ async def run_async():
279
268
]
280
269
responses = [
281
270
provider.create_async(
282
model=None,
271
model=g4f.models.default,
283
272
messages=[{"role": "user", "content": "Hello"}],
284
273
)
285
274
for provider in _providers
@@ -338,44 +327,44 @@ if __name__ == "__main__":
338
327
339
328
### gpt-3.5 / gpt-4
340
329
341
| Website| Provider| gpt-3.5 | gpt-4 | Streaming | Status | Auth |
342
| ------ | ------- | ------- | ----- | --------- | ------ | ---- |
343
| [www.aitianhu.com](https://www.aitianhu.com) | g4f.provider.AItianhu | ✔️ | ❌ | ✔️ |  | ❌ |
344
| [chat.acytoo.com](https://chat.acytoo.com) | g4f.provider.Acytoo | ✔️ | ❌ | ✔️ |  | ❌ |
345
| [chat-gpt.org](https://chat-gpt.org/chat) | g4f.provider.Aichat | ✔️ | ❌ | ❌ |  | ❌ |
346
| [ai.ls](https://ai.ls) | g4f.provider.Ails | ✔️ | ❌ | ✔️ |  | ❌ |
347
| [chat.aivvm.com](https://chat.aivvm.com) | g4f.provider.Aivvm | ✔️ | ✔️ | ✔️ |  | ❌ |
348
| [bard.google.com](https://bard.google.com) | g4f.provider.Bard | ❌ | ❌ | ❌ |  | ✔️ |
349
| [bing.com](https://bing.com/chat) | g4f.provider.Bing | ❌ | ✔️ | ✔️ |  | ❌ |
350
| [www.chatbase.co](https://www.chatbase.co) | g4f.provider.ChatBase | ✔️ | ✔️ | ✔️ |  | ❌ |
351
| [chatgpt.ai](https://chatgpt.ai/) | g4f.provider.ChatgptAi | ✔️ | ❌ | ✔️ |  | ❌ |
352
| [opchatgpts.net](https://opchatgpts.net) | g4f.provider.ChatgptLogin | ✔️ | ❌ | ❌ |  | ❌ |
353
| [ava-ai-ef611.web.app](https://ava-ai-ef611.web.app) | g4f.provider.CodeLinkAva | ✔️ | ❌ | ✔️ |  | ❌ |
354
| [deepai.org](https://deepai.org) | g4f.provider.DeepAi | ✔️ | ❌ | ✔️ |  | ❌ |
355
| [free.easychat.work](https://free.easychat.work) | g4f.provider.EasyChat | ✔️ | ❌ | ✔️ |  | ❌ |
356
| [next.eqing.tech](https://next.eqing.tech/) | g4f.provider.Equing | ✔️ | ❌ | ✔️ |  | ❌ |
357
| [chat.getgpt.world](https://chat.getgpt.world/) | g4f.provider.GetGpt | ✔️ | ❌ | ✔️ |  | ❌ |
358
| [gpt-gm.h2o.ai](https://gpt-gm.h2o.ai) | g4f.provider.H2o | ❌ | ❌ | ✔️ |  | ❌ |
359
| [huggingface.co](https://huggingface.co/chat/) | g4f.provider.HuggingChat | ❌ | ❌ | ✔️ |  | ✔️ |
360
| [liaobots.com](https://liaobots.com) | g4f.provider.Liaobots | ✔️ | ✔️ | ✔️ |  | ❌ |
361
| [opchatgpts.net](https://opchatgpts.net) | g4f.provider.Opchatgpts | ✔️ | ❌ | ❌ |  | ❌ |
362
| [open-assistant.io](https://open-assistant.io/chat) | g4f.provider.OpenAssistant | ❌ | ❌ | ✔️ |  | ✔️ |
363
| [chat.openai.com](https://chat.openai.com) | g4f.provider.OpenaiChat | ✔️ | ❌ | ❌ |  | ✔️ |
364
| [raycast.com](https://raycast.com) | g4f.provider.Raycast | ✔️ | ✔️ | ✔️ |  | ✔️ |
365
| [theb.ai](https://theb.ai) | g4f.provider.Theb | ✔️ | ❌ | ✔️ |  | ✔️ |
366
| [sdk.vercel.ai](https://sdk.vercel.ai) | g4f.provider.Vercel | ✔️ | ❌ | ❌ |  | ❌ |
367
| [app.vitalentum.io](https://app.vitalentum.io) | g4f.provider.Vitalentum | ✔️ | ❌ | ✔️ |  | ❌ |
368
| [wewordle.org](https://wewordle.org) | g4f.provider.Wewordle | ✔️ | ❌ | ❌ |  | ❌ |
369
| [chat.wuguokai.xyz](https://chat.wuguokai.xyz) | g4f.provider.Wuguokai | ✔️ | ❌ | ❌ |  | ❌ |
370
| [chat.ylokh.xyz](https://chat.ylokh.xyz) | g4f.provider.Ylokh | ✔️ | ❌ | ✔️ |  | ❌ |
371
| [you.com](https://you.com) | g4f.provider.You | ✔️ | ❌ | ❌ |  | ❌ |
372
| [chat9.yqcloud.top](https://chat9.yqcloud.top/) | g4f.provider.Yqcloud | ✔️ | ❌ | ✔️ |  | ❌ |
373
| [aiservice.vercel.app](https://aiservice.vercel.app/) | g4f.provider.AiService | ✔️ | ❌ | ❌ |  | ❌ |
374
| [chat.dfehub.com](https://chat.dfehub.com/) | g4f.provider.DfeHub | ✔️ | ❌ | ✔️ |  | ❌ |
375
| [chat9.fastgpt.me](https://chat9.fastgpt.me/) | g4f.provider.FastGpt | ✔️ | ❌ | ✔️ |  | ❌ |
376
| [forefront.com](https://forefront.com) | g4f.provider.Forefront | ✔️ | ❌ | ✔️ |  | ❌ |
377
| [supertest.lockchat.app](http://supertest.lockchat.app) | g4f.provider.Lockchat | ✔️ | ✔️ | ✔️ |  | ❌ |
378
| [p5.v50.ltd](https://p5.v50.ltd) | g4f.provider.V50 | ✔️ | ❌ | ❌ |  | ❌ |
330
| Website| Provider| gpt-3.5 | gpt-4 | Streaming | Asynchron | Status | Auth |
331
| ------ | ------- | ------- | ----- | --------- | --------- | ------ | ---- |
332
| [www.aitianhu.com](https://www.aitianhu.com) | g4f.provider.AItianhu | ✔️ | ❌ | ✔️ | ✔️ |  | ❌ |
333
| [chat.acytoo.com](https://chat.acytoo.com) | g4f.provider.Acytoo | ✔️ | ❌ | ✔️ | ✔️ |  | ❌ |
334
| [chat-gpt.org](https://chat-gpt.org/chat) | g4f.provider.Aichat | ✔️ | ❌ | ❌ | ✔️ |  | ❌ |
335
| [ai.ls](https://ai.ls) | g4f.provider.Ails | ✔️ | ❌ | ✔️ | ✔️ |  | ❌ |
336
| [chat.aivvm.com](https://chat.aivvm.com) | g4f.provider.Aivvm | ✔️ | ✔️ | ✔️ | ✔️ |  | ❌ |
337
| [bard.google.com](https://bard.google.com) | g4f.provider.Bard | ❌ | ❌ | ❌ | ✔️ |  | ✔️ |
338
| [bing.com](https://bing.com/chat) | g4f.provider.Bing | ❌ | ✔️ | ✔️ | ✔️ |  | ❌ |
339
| [www.chatbase.co](https://www.chatbase.co) | g4f.provider.ChatBase | ✔️ | ✔️ | ✔️ | ✔️ |  | ❌ |
340
| [chatgpt.ai](https://chatgpt.ai/) | g4f.provider.ChatgptAi | ✔️ | ❌ | ✔️ | ✔️ |  | ❌ |
341
| [opchatgpts.net](https://opchatgpts.net) | g4f.provider.ChatgptLogin | ✔️ | ❌ | ❌ | ✔️ |  | ❌ |
342
| [ava-ai-ef611.web.app](https://ava-ai-ef611.web.app) | g4f.provider.CodeLinkAva | ✔️ | ❌ | ✔️ | ✔️ |  | ❌ |
343
| [deepai.org](https://deepai.org) | g4f.provider.DeepAi | ✔️ | ❌ | ✔️ | ✔️ |  | ❌ |
344
| [gpt-gm.h2o.ai](https://gpt-gm.h2o.ai) | g4f.provider.H2o | ❌ | ❌ | ✔️ | ✔️ |  | ❌ |
345
| [huggingface.co](https://huggingface.co/chat/) | g4f.provider.HuggingChat | ❌ | ❌ | ✔️ | ✔️ |  | ✔️ |
346
| [opchatgpts.net](https://opchatgpts.net) | g4f.provider.Opchatgpts | ✔️ | ❌ | ❌ | ✔️ |  | ❌ |
347
| [open-assistant.io](https://open-assistant.io/chat) | g4f.provider.OpenAssistant | ❌ | ❌ | ✔️ | ✔️ |  | ✔️ |
348
| [chat.openai.com](https://chat.openai.com) | g4f.provider.OpenaiChat | ✔️ | ❌ | ❌ | ✔️ |  | ✔️ |
349
| [raycast.com](https://raycast.com) | g4f.provider.Raycast | ✔️ | ✔️ | ✔️ | ❌ |  | ✔️ |
350
| [theb.ai](https://theb.ai) | g4f.provider.Theb | ✔️ | ❌ | ✔️ | ❌ |  | ✔️ |
351
| [sdk.vercel.ai](https://sdk.vercel.ai) | g4f.provider.Vercel | ✔️ | ❌ | ❌ | ✔️ |  | ❌ |
352
| [app.vitalentum.io](https://app.vitalentum.io) | g4f.provider.Vitalentum | ✔️ | ❌ | ✔️ | ✔️ |  | ❌ |
353
| [wewordle.org](https://wewordle.org) | g4f.provider.Wewordle | ✔️ | ❌ | ❌ | ✔️ |  | ❌ |
354
| [chat.ylokh.xyz](https://chat.ylokh.xyz) | g4f.provider.Ylokh | ✔️ | ❌ | ✔️ | ✔️ |  | ❌ |
355
| [you.com](https://you.com) | g4f.provider.You | ✔️ | ❌ | ❌ | ✔️ |  | ❌ |
356
| [chat9.yqcloud.top](https://chat9.yqcloud.top/) | g4f.provider.Yqcloud | ✔️ | ❌ | ✔️ | ✔️ |  | ❌ |
357
| [aiservice.vercel.app](https://aiservice.vercel.app/) | g4f.provider.AiService | ✔️ | ❌ | ❌ | ❌ |  | ❌ |
358
| [chat.dfehub.com](https://chat.dfehub.com/) | g4f.provider.DfeHub | ✔️ | ❌ | ✔️ | ❌ |  | ❌ |
359
| [free.easychat.work](https://free.easychat.work) | g4f.provider.EasyChat | ✔️ | ❌ | ✔️ | ❌ |  | ❌ |
360
| [next.eqing.tech](https://next.eqing.tech/) | g4f.provider.Equing | ✔️ | ❌ | ✔️ | ❌ |  | ❌ |
361
| [chat9.fastgpt.me](https://chat9.fastgpt.me/) | g4f.provider.FastGpt | ✔️ | ❌ | ✔️ | ❌ |  | ❌ |
362
| [forefront.com](https://forefront.com) | g4f.provider.Forefront | ✔️ | ❌ | ✔️ | ❌ |  | ❌ |
363
| [chat.getgpt.world](https://chat.getgpt.world/) | g4f.provider.GetGpt | ✔️ | ❌ | ✔️ | ❌ |  | ❌ |
364
| [liaobots.com](https://liaobots.com) | g4f.provider.Liaobots | ✔️ | ✔️ | ✔️ | ✔️ |  | ❌ |
365
| [supertest.lockchat.app](http://supertest.lockchat.app) | g4f.provider.Lockchat | ✔️ | ✔️ | ✔️ | ❌ |  | ❌ |
366
| [p5.v50.ltd](https://p5.v50.ltd) | g4f.provider.V50 | ✔️ | ❌ | ❌ | ❌ |  | ❌ |
367
| [chat.wuguokai.xyz](https://chat.wuguokai.xyz) | g4f.provider.Wuguokai | ✔️ | ❌ | ❌ | ❌ |  | ❌ |
379
368
380
369
381
370
### Other Models
@@ -13,7 +13,7 @@ class EasyChat(BaseProvider):
13
13
url: str = "https://free.easychat.work"
14
14
supports_stream = True
15
15
supports_gpt_35_turbo = True
16
working = True
16
working = False
17
17
18
18
@staticmethod
19
19
def create_completion(
@@ -6,12 +6,12 @@ from abc import ABC, abstractmethod
6
6
import requests
7
7
8
8
from ..typing import Any, CreateResult
9
from .base_provider import BaseProvider
9
10
10
11
11
class Equing(ABC):
12
class Equing(BaseProvider):
12
13
url: str = 'https://next.eqing.tech/'
13
working = True
14
needs_auth = False
14
working = False
15
15
supports_stream = True
16
16
supports_gpt_35_turbo = True
17
17
supports_gpt_4 = False
@@ -14,7 +14,7 @@ from .base_provider import BaseProvider
14
14
class GetGpt(BaseProvider):
15
15
url = 'https://chat.getgpt.world/'
16
16
supports_stream = True
17
working = True
17
working = False
18
18
supports_gpt_35_turbo = True
19
19
20
20
@staticmethod
@@ -31,7 +31,7 @@ models = {
31
31
32
32
class Liaobots(AsyncGeneratorProvider):
33
33
url = "https://liaobots.com"
34
working = True
34
working = False
35
35
supports_gpt_35_turbo = True
36
36
supports_gpt_4 = True
37
37
_auth_code = None
@@ -5,13 +5,13 @@ import random
5
5
import requests
6
6
7
7
from ..typing import Any, CreateResult
8
from .base_provider import BaseProvider
8
from .base_provider import BaseProvider, format_prompt
9
9
10
10
11
11
class Wuguokai(BaseProvider):
12
12
url = 'https://chat.wuguokai.xyz'
13
13
supports_gpt_35_turbo = True
14
working = True
14
working = False
15
15
16
16
@staticmethod
17
17
def create_completion(
@@ -20,11 +20,6 @@ class Wuguokai(BaseProvider):
20
20
stream: bool,
21
21
**kwargs: Any,
22
22
) -> CreateResult:
23
base = ''
24
for message in messages:
25
base += '%s: %s\n' % (message['role'], message['content'])
26
base += 'assistant:'
27
28
23
headers = {
29
24
'authority': 'ai-api.wuguokai.xyz',
30
25
'accept': 'application/json, text/plain, */*',
@@ -41,7 +36,7 @@ class Wuguokai(BaseProvider):
41
36
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'
42
37
}
43
38
data ={
44
"prompt": base,
39
"prompt": format_prompt(messages),
45
40
"options": {},
46
41
"userId": f"#/chat/{random.randint(1,99999999)}",
47
42
"usingContext": True
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
from . import models
3
3
from .Provider import BaseProvider
4
4
from .typing import Any, CreateResult, Union
5
import random
5
6
6
7
logging = False
7
8
@@ -13,14 +14,22 @@ class ChatCompletion:
13
14
provider : Union[type[BaseProvider], None] = None,
14
15
stream : bool = False,
15
16
auth : Union[str, None] = None, **kwargs: Any) -> Union[CreateResult, str]:
16
17
17
18
if isinstance(model, str):
18
19
try:
19
20
model = models.ModelUtils.convert[model]
20
21
except KeyError:
21
22
raise Exception(f'The model: {model} does not exist')
22
23
23
provider = model.best_provider if provider == None else provider
24
25
if not provider:
26
if isinstance(model.best_provider, tuple):
27
provider = random.choice(model.best_provider)
28
else:
29
provider = model.best_provider
30
31
if not provider:
32
raise Exception(f'No provider found')
24
33
25
34
if not provider.working:
26
35
raise Exception(f'{provider.__name__} is not working')
@@ -1,31 +1,37 @@
1
1
from __future__ import annotations
2
2
from dataclasses import dataclass
3
from .Provider import Bard, BaseProvider, GetGpt, H2o, Liaobots, Vercel, Equing
3
from .Provider import BaseProvider, Bard, H2o, Vercel
4
from .Provider import Aichat, Aivvm, ChatBase, ChatgptAi, ChatgptLogin, CodeLinkAva
5
from .Provider import DeepAi, Vercel, Vitalentum, Ylokh, You, Yqcloud
6
from .typing import Union
4
7
5
8
@dataclass
6
9
class Model:
7
10
name: str
8
11
base_provider: str
9
best_provider: type[BaseProvider]
12
best_provider: Union[type[BaseProvider], tuple[type[BaseProvider]]] = None
10
13
11
14
# Config for HuggingChat, OpenAssistant
12
15
# Works for Liaobots, H2o, OpenaiChat, Yqcloud, You
13
16
default = Model(
14
17
name="",
15
base_provider="huggingface",
16
best_provider=H2o,
18
base_provider="huggingface"
17
19
)
18
20
19
21
# GPT-3.5 / GPT-4
20
22
gpt_35_turbo = Model(
21
23
name = 'gpt-3.5-turbo',
22
24
base_provider = 'openai',
23
best_provider = GetGpt)
25
best_provider = (
26
Vercel, Aichat, Aivvm, ChatBase, ChatgptAi, ChatgptLogin,
27
CodeLinkAva, DeepAi, Vitalentum, Ylokh, You, Yqcloud
28
)
29
)
24
30
25
31
gpt_4 = Model(
26
32
name = 'gpt-4',
27
33
base_provider = 'openai',
28
best_provider = Liaobots)
34
)
29
35
30
36
# Bard
31
37
palm = Model(
@@ -117,8 +123,7 @@ gpt_35_turbo_16k = Model(
117
123
118
124
gpt_35_turbo_16k_0613 = Model(
119
125
name = 'openai:gpt-3.5-turbo-16k-0613',
120
base_provider = 'openai',
121
best_provider = Equing)
126
base_provider = 'openai')
122
127
123
128
gpt_4_0613 = Model(
124
129
name = 'openai:gpt-4-0613',
@@ -5,13 +5,8 @@ sys.path.append(str(Path(__file__).parent.parent))
5
5
6
6
import g4f
7
7
8
stream = False
9
8
response = g4f.ChatCompletion.create(
10
model="gpt-3.5-turbo",
11
provider=g4f.Provider.Ails,
12
messages=[{"role": "user", "content": "hello"}],
13
stream=stream,
14
active_server=5,
9
model=g4f.models.gpt_35_turbo,
10
messages=[{"role": "user", "content": "hello, are you GPT 4?"}]
15
11
)
16
17
print(response)
12
print(response)
@@ -5,9 +5,13 @@ from urllib.parse import urlparse
5
5
6
6
sys.path.append(str(Path(__file__).parent.parent))
7
7
8
import asyncio
8
9
from g4f import models
9
from g4f.Provider.base_provider import AsyncProvider
10
from testing.test_providers import test, get_providers
10
from g4f.Provider.base_provider import AsyncProvider, BaseProvider
11
from testing.test_providers import get_providers
12
13
logging = False
14
11
15
12
16
def print_imports():
13
17
print("##### Providers:")
@@ -28,21 +32,50 @@ def print_async():
28
32
print("```py")
29
33
print("_providers = [")
30
34
for _provider in get_providers():
31
if issubclass(_provider, AsyncProvider):
35
if _provider.working and issubclass(_provider, AsyncProvider):
32
36
print(f" g4f.Provider.{_provider.__name__},")
33
37
print("]")
34
38
print("```")
35
39
print()
36
40
print()
37
41
42
43
async def test_async(provider: type[BaseProvider]):
44
if not provider.working:
45
return False
46
model = models.gpt_35_turbo.name if provider.supports_gpt_35_turbo else models.default.name
47
messages = [{"role": "user", "content": "Hello Assistant!"}]
48
try:
49
if issubclass(provider, AsyncProvider):
50
response = await provider.create_async(model=model, messages=messages)
51
else:
52
response = provider.create_completion(model=model, messages=messages, stream=False)
53
return True if response else False
54
except Exception as e:
55
if logging:
56
print(f"{provider.__name__}: {e.__class__.__name__}: {e}")
57
return False
58
59
60
async def test_async_list(providers: list[type[BaseProvider]]):
61
responses: list = [
62
test_async(_provider)
63
for _provider in providers
64
]
65
return await asyncio.gather(*responses)
66
67
38
68
def print_providers():
39
69
lines = [
40
"| Website| Provider| gpt-3.5 | gpt-4 | Streaming | Status | Auth |",
41
"| ------ | ------- | ------- | ----- | --------- | ------ | ---- |",
70
"| Website| Provider| gpt-3.5 | gpt-4 | Streaming | Asynchron | Status | Auth |",
71
"| ------ | ------- | ------- | ----- | --------- | --------- | ------ | ---- |",
42
72
]
73
43
74
providers = get_providers()
75
responses = asyncio.run(test_async_list(providers))
76
44
77
for is_working in (True, False):
45
for _provider in providers:
78
for idx, _provider in enumerate(providers):
46
79
if is_working != _provider.working:
47
80
continue
48
81
netloc = urlparse(_provider.url).netloc
@@ -53,8 +86,9 @@ def print_providers():
53
86
has_gpt_35 = "✔️" if _provider.supports_gpt_35_turbo else "❌"
54
87
has_gpt_4 = "✔️" if _provider.supports_gpt_4 else "❌"
55
88
stream = "✔️" if _provider.supports_stream else "❌"
89
can_async = "✔️" if issubclass(_provider, AsyncProvider) else "❌"
56
90
if _provider.working:
57
if test(_provider):
91
if responses[idx]:
58
92
status = ''
59
93
else:
60
94
status = ''
@@ -63,7 +97,7 @@ def print_providers():
63
97
auth = "✔️" if _provider.needs_auth else "❌"
64
98
65
99
lines.append(
66
f"| {website} | {provider_name} | {has_gpt_35} | {has_gpt_4} | {stream} | {status} | {auth} |"
100
f"| {website} | {provider_name} | {has_gpt_35} | {has_gpt_4} | {stream} | {can_async} | {status} | {auth} |"
67
101
)
68
102
print("\n".join(lines))
69
103
@@ -89,17 +123,16 @@ def print_models():
89
123
90
124
_models = get_models()
91
125
for model in _models:
92
if model.best_provider.__name__ not in provider_urls:
126
if not model.best_provider or model.best_provider.__name__ not in provider_urls:
93
127
continue
94
split_name = re.split(r":|/", model.name)
95
name = split_name[-1]
96
128
129
name = re.split(r":|/", model.name)[-1]
97
130
base_provider = base_provider_names[model.base_provider]
98
131
provider_name = f"g4f.provider.{model.best_provider.__name__}"
99
100
132
provider_url = provider_urls[model.best_provider.__name__]
101
133
netloc = urlparse(provider_url).netloc
102
134
website = f"[{netloc}]({provider_url})"
135
103
136
lines.append(f"| {name} | {base_provider} | {provider_name} | {website} |")
104
137
105
138
print("\n".join(lines))