diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-04-22 01:35:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-22 01:35:07 +0200 |
commit | 4b4d1f08b5c75c8c8932b5edfbb0d020f8e029a7 (patch) | |
tree | 6ed0cfc6cd53a3ab32565d6199a929ac1ea6ad80 /etc | |
parent | Merge pull request #1869 from hlohaus/carst (diff) | |
parent | Add vision models to readme (diff) | |
download | gpt4free-0.3.0.4.tar gpt4free-0.3.0.4.tar.gz gpt4free-0.3.0.4.tar.bz2 gpt4free-0.3.0.4.tar.lz gpt4free-0.3.0.4.tar.xz gpt4free-0.3.0.4.tar.zst gpt4free-0.3.0.4.zip |
Diffstat (limited to 'etc')
-rw-r--r-- | etc/tool/readme_table.py | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/etc/tool/readme_table.py b/etc/tool/readme_table.py index 895b515f..439b17fa 100644 --- a/etc/tool/readme_table.py +++ b/etc/tool/readme_table.py @@ -14,6 +14,8 @@ async def test_async(provider: ProviderType): return False messages = [{"role": "user", "content": "Hello Assistant!"}] try: + if "webdriver" in provider.get_parameters(): + return False response = await asyncio.wait_for(ChatCompletion.create_async( model=models.default, messages=messages, @@ -88,7 +90,7 @@ def print_models(): "huggingface": "Huggingface", "anthropic": "Anthropic", "inflection": "Inflection", - "meta": "Meta" + "meta": "Meta", } provider_urls = { "google": "https://gemini.google.com/", @@ -96,7 +98,7 @@ def print_models(): "huggingface": "https://huggingface.co/", "anthropic": "https://www.anthropic.com/", "inflection": "https://inflection.ai/", - "meta": "https://llama.meta.com/" + "meta": "https://llama.meta.com/", } lines = [ @@ -108,6 +110,8 @@ def print_models(): if name not in ("gpt-3.5-turbo", "gpt-4", "gpt-4-turbo"): continue name = re.split(r":|/", model.name)[-1] + if model.base_provider not in base_provider_names: + continue base_provider = base_provider_names[model.base_provider] if not isinstance(model.best_provider, BaseRetryProvider): provider_name = f"g4f.Provider.{model.best_provider.__name__}" @@ -121,7 +125,26 @@ def print_models(): print("\n".join(lines)) +def print_image_models(): + lines = [ + "| Label | Provider | Image Model | Vision Model | Website |", + "| ----- | -------- | ----------- | ------------ | ------- |", + ] + from g4f.gui.server.api import Api + for image_model in Api.get_image_models(): + provider_url = image_model["url"] + netloc = urlparse(provider_url).netloc.replace("www.", "") + website = f"[{netloc}]({provider_url})" + label = image_model["provider"] if image_model["label"] is None else image_model["label"] + if image_model["vision_model"] is None: + image_model["vision_model"] = "❌" + lines.append(f'| {label} | `g4f.Provider.{image_model["provider"]}` | {image_model["image_model"]}| {image_model["vision_model"]} | {website} |') + + print("\n".join(lines)) + if __name__ == "__main__": - print_providers() + #print_providers() + #print("\n", "-" * 50, "\n") + #print_models() print("\n", "-" * 50, "\n") - print_models()
\ No newline at end of file + print_image_models()
\ No newline at end of file |