diff options
author | kqlio67 <kqlio67@users.noreply.github.com> | 2024-11-04 14:37:04 +0100 |
---|---|---|
committer | kqlio67 <kqlio67@users.noreply.github.com> | 2024-11-04 14:37:04 +0100 |
commit | 8c7791aae38ef364182fc8676d2e7349f9341a4c (patch) | |
tree | 226fe36a867beb214b66e54fd35a3b5ae10a7aba | |
parent | Merge pull request #3 from rkihacker/main (diff) | |
download | gpt4free-8c7791aae38ef364182fc8676d2e7349f9341a4c.tar gpt4free-8c7791aae38ef364182fc8676d2e7349f9341a4c.tar.gz gpt4free-8c7791aae38ef364182fc8676d2e7349f9341a4c.tar.bz2 gpt4free-8c7791aae38ef364182fc8676d2e7349f9341a4c.tar.lz gpt4free-8c7791aae38ef364182fc8676d2e7349f9341a4c.tar.xz gpt4free-8c7791aae38ef364182fc8676d2e7349f9341a4c.tar.zst gpt4free-8c7791aae38ef364182fc8676d2e7349f9341a4c.zip |
-rw-r--r-- | docs/providers-and-models.md | 11 | ||||
-rw-r--r-- | g4f/Provider/GizAI.py | 120 | ||||
-rw-r--r-- | g4f/models.py | 30 |
3 files changed, 36 insertions, 125 deletions
diff --git a/docs/providers-and-models.md b/docs/providers-and-models.md index 1c56244c..51f49f0c 100644 --- a/docs/providers-and-models.md +++ b/docs/providers-and-models.md @@ -30,7 +30,7 @@ This document provides an overview of various AI providers and models, including |[openchat.team](https://openchat.team/)|`g4f.Provider.Aura`|✔|❌|❌|?|![Cloudflare](https://img.shields.io/badge/Cloudflare-f48d37)![Disabled](https://img.shields.io/badge/Disabled-red)|❌| |[bing.com](https://bing.com/chat)|`g4f.Provider.Bing`|`gpt-4`|✔|`gpt-4-vision`|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌+✔| |[bing.com/images](https://www.bing.com/images/create)|`g4f.Provider.BingCreateImages`|`❌|✔|❌|❌|![Active](https://img.shields.io/badge/Active-brightgreen)|✔| -|[blackbox.ai](https://www.blackbox.ai)|`g4f.Provider.Blackbox`|`blackboxai, blackboxai-pro, gemini-flash, llama-3.1-8b, llama-3.1-70b, gpt-4o, gemini-pro, claude-3.5-sonnet`|`flux`|✔|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌| +|[blackbox.ai](https://www.blackbox.ai)|`g4f.Provider.Blackbox`|`blackboxai, blackboxai-pro, gemini-flash, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b, gpt-4o, gemini-pro, claude-3.5-sonnet`|`flux`|`blackboxai, gemini-flash, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b, gpt-4o, gemini-pro`|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌| |[chatgot.one](https://www.chatgot.one/)|`g4f.Provider.ChatGot`|`gemini-pro`|❌|❌|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌| |[chatgpt.com](https://chatgpt.com)|`g4f.Provider.ChatGpt`|`?`|`?`|`?`|?|![Unknown](https://img.shields.io/badge/Unknown-grey) |❌| |[chatgpt.es](https://chatgpt.es)|`g4f.Provider.ChatGptEs`|`gpt-4o, gpt-4o-mini`|❌|❌|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌| @@ -53,7 +53,7 @@ This document provides an overview of various AI providers and models, including |[free.netfly.top](https://free.netfly.top)|`g4f.Provider.FreeNetfly`|✔|❌|❌|?|![Disabled](https://img.shields.io/badge/Disabled-red)![Cloudflare](https://img.shields.io/badge/Cloudflare-f48d37)|❌| |[gemini.google.com](https://gemini.google.com)|`g4f.Provider.Gemini`|✔|❌|❌|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|✔| |[ai.google.dev](https://ai.google.dev)|`g4f.Provider.GeminiPro`|✔|❌|✔|?|![Active](https://img.shields.io/badge/Active-brightgreen)|✔| -|[app.giz.ai](https://app.giz.ai/assistant/)|`g4f.Provider.GizAI`|`gemini-flash, gemini-pro, gpt-4o-mini, gpt-4o, claude-3.5-sonnet, claude-3-haiku, llama-3.1-70b, llama-3.1-8b, mistral-large`|`sdxl, sd-1.5, sd-3.5, dalle-3, flux-schnell, flux1-pro`|❌|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌| +|[app.giz.ai](https://app.giz.ai/assistant/)|`g4f.Provider.GizAI`|`gemini-flash`|❌|❌|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌| |[developers.sber.ru](https://developers.sber.ru/gigachat)|`g4f.Provider.GigaChat`|✔|❌|❌|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|✔| |[gprochat.com](https://gprochat.com)|`g4f.Provider.GPROChat`|`gemini-pro`|❌|❌|✔|![Active](https://img.shields.io/badge/Active-brightgreen)|❌| |[console.groq.com/playground](https://console.groq.com/playground)|`g4f.Provider.Groq`|✔|❌|❌|?|![Active](https://img.shields.io/badge/Active-brightgreen)|✔| @@ -112,8 +112,8 @@ This document provides an overview of various AI providers and models, including |gpt-4-turbo|OpenAI|3+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4)| |gpt-4o|OpenAI|10+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4o)| |gpt-4o-mini|OpenAI|14+ Providers|[platform.openai.com](https://platform.openai.com/docs/models/gpt-4o-mini)| -|o1|OpenAI|1+ Providers|[platform.openai.com](https://openai.com/index/introducing-openai-o1-preview/)| -|o1-mini|OpenAI|2+ Providers|[platform.openai.com](https://openai.com/index/openai-o1-mini-advancing-cost-efficient-reasoning/)| +|o1|OpenAI|0+ Providers|[platform.openai.com](https://openai.com/index/introducing-openai-o1-preview/)| +|o1-mini|OpenAI|0+ Providers|[platform.openai.com](https://openai.com/index/openai-o1-mini-advancing-cost-efficient-reasoning/)| |llama-2-7b|Meta Llama|1+ Providers|[huggingface.co](https://huggingface.co/meta-llama/Llama-2-7b)| |llama-2-13b|Meta Llama|1+ Providers|[llama.com](https://www.llama.com/llama2/)| |llama-3-8b|Meta Llama|4+ Providers|[ai.meta.com](https://ai.meta.com/blog/meta-llama-3/)| @@ -207,7 +207,6 @@ This document provides an overview of various AI providers and models, including |sdxl-turbo|Stability AI|1+ Providers|[huggingface.co](https://huggingface.co/stabilityai/sdxl-turbo)| |sd-1.5|Stability AI|1+ Providers|[huggingface.co](https://huggingface.co/runwayml/stable-diffusion-v1-5)| |sd-3|Stability AI|1+ Providers|[huggingface.co](https://huggingface.co/docs/diffusers/main/en/api/pipelines/stable_diffusion/stable_diffusion_3)| -|sd-3.5|Stability AI|1+ Providers|[stability.ai](https://stability.ai/news/introducing-stable-diffusion-3-5)| |playground-v2.5|Playground AI|1+ Providers|[huggingface.co](https://huggingface.co/playgroundai/playground-v2.5-1024px-aesthetic)| |flux|Black Forest Labs|2+ Providers|[github.com/black-forest-labs/flux](https://github.com/black-forest-labs/flux)| |flux-pro|Black Forest Labs|2+ Providers|[github.com/black-forest-labs/flux](https://github.com/black-forest-labs/flux)| @@ -235,7 +234,7 @@ This document provides an overview of various AI providers and models, including ### Providers and vision models | Provider | Base Provider | | Vision Models | Status | Auth | |-------|---------------|-----------|---------|---------|---------| -| `g4f.Provider.Blackbox` | Blackbox AI | | `blackboxai, blackboxai-pro, gemini-flash, llama-3.1-8b, llama-3.1-70b, gpt-4o, gemini-pro, claude-3.5-sonnet` | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ | +| `g4f.Provider.Blackbox` | Blackbox AI | | `blackboxai, gemini-flash, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b, gpt-4o, gemini-pro` | ![Active](https://img.shields.io/badge/Active-brightgreen) | ❌ | ## Conclusion and Usage Tips This document provides a comprehensive overview of various AI providers and models available for text generation, image generation, and vision tasks. **When choosing a provider or model, consider the following factors:** diff --git a/g4f/Provider/GizAI.py b/g4f/Provider/GizAI.py index 127edc9e..a5ce0ec2 100644 --- a/g4f/Provider/GizAI.py +++ b/g4f/Provider/GizAI.py @@ -1,62 +1,24 @@ from __future__ import annotations -import json from aiohttp import ClientSession from ..typing import AsyncResult, Messages -from ..image import ImageResponse from .base_provider import AsyncGeneratorProvider, ProviderModelMixin from .helper import format_prompt + class GizAI(AsyncGeneratorProvider, ProviderModelMixin): - url = "https://app.giz.ai/assistant/" + url = "https://app.giz.ai" api_endpoint = "https://app.giz.ai/api/data/users/inferenceServer.infer" working = True - + supports_stream = False supports_system_message = True supports_message_history = True - # Chat models default_model = 'chat-gemini-flash' - chat_models = [ - default_model, - 'chat-gemini-pro', - 'chat-gpt4m', - 'chat-gpt4', - 'claude-sonnet', - 'claude-haiku', - 'llama-3-70b', - 'llama-3-8b', - 'mistral-large', - 'chat-o1-mini' - ] - - # Image models - image_models = [ - 'flux1', - 'sdxl', - 'sd', - 'sd35', - ] - - models = [*chat_models, *image_models] + models = [default_model] - model_aliases = { - # Chat model aliases - "gemini-flash": "chat-gemini-flash", - "gemini-pro": "chat-gemini-pro", - "gpt-4o-mini": "chat-gpt4m", - "gpt-4o": "chat-gpt4", - "claude-3.5-sonnet": "claude-sonnet", - "claude-3-haiku": "claude-haiku", - "llama-3.1-70b": "llama-3-70b", - "llama-3.1-8b": "llama-3-8b", - "o1-mini": "chat-o1-mini", - # Image model aliases - "sd-1.5": "sd", - "sd-3.5": "sd35", - "flux-schnell": "flux1", - } + model_aliases = {"gemini-flash": "chat-gemini-flash",} @classmethod def get_model(cls, model: str) -> str: @@ -68,10 +30,6 @@ class GizAI(AsyncGeneratorProvider, ProviderModelMixin): return cls.default_model @classmethod - def is_image_model(cls, model: str) -> bool: - return model in cls.image_models - - @classmethod async def create_async_generator( cls, model: str, @@ -87,7 +45,8 @@ class GizAI(AsyncGeneratorProvider, ProviderModelMixin): 'Cache-Control': 'no-cache', 'Connection': 'keep-alive', 'Content-Type': 'application/json', - 'Origin': 'https://app.giz.ai', + 'DNT': '1', + 'Origin': cls.url, 'Pragma': 'no-cache', 'Sec-Fetch-Dest': 'empty', 'Sec-Fetch-Mode': 'cors', @@ -97,55 +56,16 @@ class GizAI(AsyncGeneratorProvider, ProviderModelMixin): 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"Linux"' } - - async with ClientSession() as session: - if cls.is_image_model(model): - # Image generation - prompt = messages[-1]["content"] - data = { - "model": model, - "input": { - "width": "1024", - "height": "1024", - "steps": 4, - "output_format": "webp", - "batch_size": 1, - "mode": "plan", - "prompt": prompt - } - } - async with session.post( - cls.api_endpoint, - headers=headers, - data=json.dumps(data), - proxy=proxy - ) as response: - response.raise_for_status() - response_data = await response.json() - if response_data.get('status') == 'completed' and response_data.get('output'): - for url in response_data['output']: - yield ImageResponse(images=url, alt="Generated Image") - else: - # Chat completion - data = { - "model": model, - "input": { - "messages": [ - { - "type": "human", - "content": format_prompt(messages) - } - ], - "mode": "plan" - }, - "noStream": True - } - async with session.post( - cls.api_endpoint, - headers=headers, - data=json.dumps(data), - proxy=proxy - ) as response: - response.raise_for_status() - result = await response.json() - yield result.get('output', '') + async with ClientSession(headers=headers) as session: + data = { + "model": model, + "input": { + "messages": messages, + "mode": "plan" + }, + "noStream": True + } + async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response: + response.raise_for_status() + result = await response.json() + yield result['output'].strip() diff --git a/g4f/models.py b/g4f/models.py index 944c4e9c..8b258201 100644 --- a/g4f/models.py +++ b/g4f/models.py @@ -137,13 +137,13 @@ gpt_35_turbo = Model( gpt_4o = Model( name = 'gpt-4o', base_provider = 'OpenAI', - best_provider = IterListProvider([NexraChatGPT, Blackbox, ChatGptEs, DarkAI, Editee, GizAI, Airforce, Liaobots, OpenaiChat]) + best_provider = IterListProvider([Blackbox, ChatGptEs, DarkAI, Editee, NexraChatGPT, Airforce, Liaobots, OpenaiChat]) ) gpt_4o_mini = Model( name = 'gpt-4o-mini', base_provider = 'OpenAI', - best_provider = IterListProvider([DDG, ChatGptEs, FreeNetfly, Pizzagpt, MagickPen, RubiksAI, Liaobots, Airforce, GizAI, ChatgptFree, Koala, OpenaiChat, ChatGpt]) + best_provider = IterListProvider([DDG, ChatGptEs, FreeNetfly, Pizzagpt, MagickPen, RubiksAI, Liaobots, Airforce, ChatgptFree, Koala, OpenaiChat, ChatGpt]) ) gpt_4_turbo = Model( @@ -168,7 +168,7 @@ o1 = Model( o1_mini = Model( name = 'o1-mini', base_provider = 'OpenAI', - best_provider = IterListProvider([GizAI]) + best_provider = None ) @@ -217,13 +217,13 @@ llama_3_70b = Model( llama_3_1_8b = Model( name = "llama-3.1-8b", base_provider = "Meta Llama", - best_provider = IterListProvider([Blackbox, DeepInfraChat, ChatHub, Cloudflare, GizAI, Airforce, PerplexityLabs]) + best_provider = IterListProvider([Blackbox, DeepInfraChat, ChatHub, Cloudflare, Airforce, PerplexityLabs]) ) llama_3_1_70b = Model( name = "llama-3.1-70b", base_provider = "Meta Llama", - best_provider = IterListProvider([DDG, HuggingChat, Blackbox, FreeGpt, TeachAnything, Free2GPT, DeepInfraChat, DarkAI, AiMathGPT, RubiksAI, GizAI, Airforce, HuggingFace, PerplexityLabs]) + best_provider = IterListProvider([DDG, HuggingChat, Blackbox, FreeGpt, TeachAnything, Free2GPT, DeepInfraChat, DarkAI, AiMathGPT, RubiksAI, Airforce, HuggingFace, PerplexityLabs]) ) llama_3_1_405b = Model( @@ -312,7 +312,7 @@ mistral_nemo = Model( mistral_large = Model( name = "mistral-large", base_provider = "Mistral", - best_provider = IterListProvider([Editee, GizAI]) + best_provider = IterListProvider([Editee]) ) @@ -360,7 +360,7 @@ phi_3_5_mini = Model( gemini_pro = Model( name = 'gemini-pro', base_provider = 'Google DeepMind', - best_provider = IterListProvider([GeminiPro, Blackbox, AIChatFree, GPROChat, NexraGeminiPro, Editee, GizAI, Airforce, Liaobots]) + best_provider = IterListProvider([GeminiPro, Blackbox, AIChatFree, GPROChat, NexraGeminiPro, Editee, Airforce, Liaobots]) ) gemini_flash = Model( @@ -431,14 +431,14 @@ claude_3_sonnet = Model( claude_3_haiku = Model( name = 'claude-3-haiku', base_provider = 'Anthropic', - best_provider = IterListProvider([DDG, GizAI, Liaobots]) + best_provider = IterListProvider([DDG, Liaobots]) ) # claude 3.5 claude_3_5_sonnet = Model( name = 'claude-3.5-sonnet', base_provider = 'Anthropic', - best_provider = IterListProvider([Blackbox, Editee, GizAI, Liaobots]) + best_provider = IterListProvider([Blackbox, Editee, Liaobots]) ) @@ -777,7 +777,7 @@ sdxl = Model( sd_1_5 = Model( name = 'sd-1.5', base_provider = 'Stability AI', - best_provider = IterListProvider([NexraSD15, GizAI]) + best_provider = IterListProvider([NexraSD15]) ) @@ -788,13 +788,6 @@ sd_3 = Model( ) -sd_3_5 = Model( - name = 'sd-3.5', - base_provider = 'Stability AI', - best_provider = GizAI - -) - ### Playground ### playground_v2_5 = Model( name = 'playground-v2.5', @@ -864,7 +857,7 @@ flux_4o = Model( flux_schnell = Model( name = 'flux-schnell', base_provider = 'Flux AI', - best_provider = IterListProvider([ReplicateHome, GizAI]) + best_provider = IterListProvider([ReplicateHome]) ) @@ -1156,7 +1149,6 @@ class ModelUtils: 'sdxl-turbo': sdxl_turbo, 'sd-1.5': sd_1_5, 'sd-3': sd_3, -'sd-3.5': sd_3_5, ### Playground ### |