XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

~ | Update models list

07063b0f
abc <98614666+xtekky@users.noreply.github.com>
提交于

代码差异

2 个文件 +17 -10
Modified testing/test_providers.py +1 -0
@@ -37,6 +37,7 @@ def get_providers() -> list[type[BaseProvider]]:
37 37 ignore_names = [
38 38 "annotations",
39 39 "base_provider",
40 "retry_provider",
40 41 "BaseProvider",
41 42 "AsyncProvider",
42 43 "AsyncGeneratorProvider"
Modified tool/readme_table.py +16 -10
@@ -8,6 +8,7 @@ sys.path.append(str(Path(__file__).parent.parent))
8 8 import asyncio
9 9 from g4f import models
10 10 from g4f.Provider.base_provider import AsyncProvider, BaseProvider
11 from g4f.Provider.retry_provider import RetryProvider
11 12 from testing.test_providers import get_providers
12 13
13 14 logging = False
@@ -20,6 +21,7 @@ def print_imports():
20 21 for _provider in get_providers():
21 22 if _provider.working:
22 23 print(f" {_provider.__name__},")
24
23 25 print(")")
24 26 print("# Usage:")
25 27 print("response = g4f.ChatCompletion.create(..., provider=ProviderName)")
@@ -72,26 +74,30 @@ def print_providers():
72 74 ]
73 75
74 76 providers = get_providers()
75 responses = asyncio.run(test_async_list(providers))
77 #responses = asyncio.run(test_async_list(providers))
76 78
77 79 for is_working in (True, False):
78 80 for idx, _provider in enumerate(providers):
79 81 if is_working != _provider.working:
80 82 continue
83 if _provider == RetryProvider:
84 continue
85
81 86 netloc = urlparse(_provider.url).netloc
82 87 website = f"[{netloc}]({_provider.url})"
83 88
84 provider_name = f"g4f.provider.{_provider.__name__}"
89 provider_name = f"`g4f.Provider.{_provider.__name__}`"
85 90
86 91 has_gpt_35 = "✔️" if _provider.supports_gpt_35_turbo else "❌"
87 92 has_gpt_4 = "✔️" if _provider.supports_gpt_4 else "❌"
88 93 stream = "✔️" if _provider.supports_stream else "❌"
89 94 can_async = "✔️" if issubclass(_provider, AsyncProvider) else "❌"
90 95 if _provider.working:
91 if responses[idx]:
92 status = '![Active](https://img.shields.io/badge/Active-brightgreen)'
93 else:
94 status = '![Unknown](https://img.shields.io/badge/Unknown-grey)'
96 status = '![Active](https://img.shields.io/badge/Active-brightgreen)'
97 # if responses[idx]:
98 # status = '![Active](https://img.shields.io/badge/Active-brightgreen)'
99 # else:
100 # status = '![Unknown](https://img.shields.io/badge/Unknown-grey)'
95 101 else:
96 102 status = '![Inactive](https://img.shields.io/badge/Inactive-red)'
97 103 auth = "✔️" if _provider.needs_auth else "❌"
@@ -145,8 +151,8 @@ def get_models():
145 151
146 152
147 153 if __name__ == "__main__":
148 print_imports()
149 print_async()
154 # print_imports()
155 # print_async()
150 156 print_providers()
151 print("\n", "-" * 50, "\n")
152 print_models()
157 # print("\n", "-" * 50, "\n")
158 # print_models()