diff options
Diffstat (limited to 'g4f/models.py')
-rw-r--r-- | g4f/models.py | 187 |
1 files changed, 31 insertions, 156 deletions
diff --git a/g4f/models.py b/g4f/models.py index 0a7eed35..8825242f 100644 --- a/g4f/models.py +++ b/g4f/models.py @@ -2,8 +2,6 @@ from __future__ import annotations from dataclasses import dataclass -from .Provider.not_working import Ai4Chat - from .Provider import IterListProvider, ProviderType from .Provider import ( AIChatFree, @@ -19,12 +17,10 @@ from .Provider import ( DDG, DeepInfraChat, Free2GPT, - FreeGpt, FreeNetfly, + GigaChat, Gemini, GeminiPro, - GizAI, - GigaChat, HuggingChat, HuggingFace, Liaobots, @@ -42,7 +38,6 @@ from .Provider import ( Upstage, ) - @dataclass(unsafe_hash=True) class Model: """ @@ -62,7 +57,6 @@ class Model: """Returns a list of all model names.""" return _all_models - ### Default ### default = Model( name = "", @@ -85,8 +79,6 @@ default = Model( ]) ) - - ############ ### Text ### ############ @@ -115,29 +107,15 @@ gpt_4o_mini = Model( gpt_4_turbo = Model( name = 'gpt-4-turbo', base_provider = 'OpenAI', - best_provider = IterListProvider([ChatGpt, Airforce, Liaobots, Bing]) + best_provider = IterListProvider([Liaobots, Bing]) ) gpt_4 = Model( name = 'gpt-4', base_provider = 'OpenAI', - best_provider = IterListProvider([Mhystical, Chatgpt4Online, ChatGpt, Bing, OpenaiChat, gpt_4_turbo.best_provider, gpt_4o.best_provider, gpt_4o_mini.best_provider]) + best_provider = IterListProvider([Chatgpt4Online, Bing, OpenaiChat, DDG, Liaobots, Airforce]) ) -# o1 -o1 = Model( - name = 'o1', - base_provider = 'OpenAI', - best_provider = None -) - -o1_mini = Model( - name = 'o1-mini', - base_provider = 'OpenAI', - best_provider = None -) - - ### GigaChat ### gigachat = Model( name = 'GigaChat:latest', @@ -145,7 +123,6 @@ gigachat = Model( best_provider = GigaChat ) - ### Meta ### meta = Model( name = "meta-ai", @@ -157,13 +134,13 @@ meta = Model( llama_2_7b = Model( name = "llama-2-7b", base_provider = "Meta Llama", - best_provider = IterListProvider([Cloudflare, Airforce]) + best_provider = Cloudflare ) # llama 3 llama_3_8b = Model( name = "llama-3-8b", base_provider = "Meta Llama", - best_provider = IterListProvider([Cloudflare]) + best_provider = Cloudflare ) # llama 3.1 @@ -198,13 +175,6 @@ llama_3_2_11b = Model( best_provider = IterListProvider([HuggingChat, HuggingFace]) ) -### Mistral ### -mistral_7b = Model( - name = "mistral-7b", - base_provider = "Mistral", - best_provider = IterListProvider([Free2GPT]) -) - mixtral_8x7b = Model( name = "mixtral-8x7b", base_provider = "Mistral", @@ -217,27 +187,12 @@ mistral_nemo = Model( best_provider = IterListProvider([HuggingChat, HuggingFace]) ) - -### NousResearch ### -hermes_2_pro = Model( - name = "hermes-2-pro", - base_provider = "NousResearch", - best_provider = Airforce -) - -hermes_2_dpo = Model( - name = "hermes-2-dpo", - base_provider = "NousResearch", - best_provider = Airforce -) - hermes_3 = Model( name = "hermes-3", base_provider = "NousResearch", best_provider = IterListProvider([HuggingChat, HuggingFace]) ) - ### Microsoft ### phi_2 = Model( name = "phi-2", @@ -256,13 +211,13 @@ phi_3_5_mini = Model( gemini_pro = Model( name = 'gemini-pro', base_provider = 'Google DeepMind', - best_provider = IterListProvider([GeminiPro, Blackbox, AIChatFree, FreeGpt, Liaobots]) + best_provider = IterListProvider([GeminiPro, Blackbox, AIChatFree, Liaobots]) ) gemini_flash = Model( name = 'gemini-flash', base_provider = 'Google DeepMind', - best_provider = IterListProvider([Blackbox, GizAI, Liaobots]) + best_provider = IterListProvider([Blackbox, Liaobots]) ) gemini = Model( @@ -278,7 +233,6 @@ gemma_2b = Model( best_provider = ReplicateHome ) - ### Anthropic ### claude_2_1 = Model( name = 'claude-2.1', @@ -290,13 +244,13 @@ claude_2_1 = Model( claude_3_opus = Model( name = 'claude-3-opus', base_provider = 'Anthropic', - best_provider = IterListProvider([Liaobots]) + best_provider = Liaobots ) claude_3_sonnet = Model( name = 'claude-3-sonnet', base_provider = 'Anthropic', - best_provider = IterListProvider([Liaobots]) + best_provider = Liaobots ) claude_3_haiku = Model( @@ -312,7 +266,6 @@ claude_3_5_sonnet = Model( best_provider = IterListProvider([Blackbox, Liaobots]) ) - ### Reka AI ### reka_core = Model( name = 'reka-core', @@ -320,7 +273,6 @@ reka_core = Model( best_provider = Reka ) - ### Blackbox AI ### blackboxai = Model( name = 'blackboxai', @@ -341,7 +293,6 @@ command_r_plus = Model( best_provider = HuggingChat ) - ### Qwen ### # qwen 1_5 qwen_1_5_7b = Model( @@ -477,7 +428,6 @@ german_7b = Model( best_provider = Airforce ) - ### HuggingFaceH4 ### zephyr_7b = Model( name = 'zephyr-7b', @@ -492,8 +442,6 @@ neural_7b = Model( best_provider = Airforce ) - - ############# ### Image ### ############# @@ -527,66 +475,55 @@ flux = Model( name = 'flux', base_provider = 'Flux AI', best_provider = IterListProvider([Blackbox, AIUncensored, Airforce]) - ) flux_pro = Model( name = 'flux-pro', base_provider = 'Flux AI', - best_provider = IterListProvider([Airforce]) - + best_provider = Airforce ) flux_realism = Model( name = 'flux-realism', base_provider = 'Flux AI', - best_provider = IterListProvider([Airforce]) - + best_provider = Airforce ) flux_anime = Model( name = 'flux-anime', base_provider = 'Flux AI', best_provider = Airforce - ) flux_3d = Model( name = 'flux-3d', base_provider = 'Flux AI', best_provider = Airforce - ) flux_disney = Model( name = 'flux-disney', base_provider = 'Flux AI', best_provider = Airforce - ) flux_pixel = Model( name = 'flux-pixel', base_provider = 'Flux AI', best_provider = Airforce - ) flux_4o = Model( name = 'flux-4o', base_provider = 'Flux AI', best_provider = Airforce - ) - - ### Other ### any_dark = Model( name = 'any-dark', base_provider = '', best_provider = Airforce - ) class ModelUtils: @@ -596,13 +533,15 @@ class ModelUtils: Attributes: convert (dict[str, Model]): Dictionary mapping model string identifiers to Model instances. """ - convert: dict[str, Model] = { - + convert: dict[str, Model] = { ############ ### Text ### ############ - + ### OpenAI ### + # gpt-3 + 'gpt-3': gpt_35_turbo, + # gpt-3.5 'gpt-3.5-turbo': gpt_35_turbo, @@ -612,11 +551,6 @@ class ModelUtils: 'gpt-4': gpt_4, 'gpt-4-turbo': gpt_4_turbo, - # o1 - 'o1': o1, - 'o1-mini': o1_mini, - - ### Meta ### "meta-ai": meta, @@ -636,32 +570,25 @@ class ModelUtils: 'llama-3.2-11b': llama_3_2_11b, ### Mistral ### - 'mistral-7b': mistral_7b, 'mixtral-8x7b': mixtral_8x7b, 'mistral-nemo': mistral_nemo, - - + ### NousResearch ### - 'hermes-2-pro': hermes_2_pro, - 'hermes-2-dpo': hermes_2_dpo, 'hermes-3': hermes_3, - - + ### Microsoft ### 'phi-2': phi_2, 'phi-3.5-mini': phi_3_5_mini, - ### Google ### # gemini 'gemini': gemini, 'gemini-pro': gemini_pro, 'gemini-flash': gemini_flash, - + # gemma 'gemma-2b': gemma_2b, - ### Anthropic ### 'claude-2.1': claude_2_1, @@ -672,115 +599,64 @@ class ModelUtils: # claude 3.5 'claude-3.5-sonnet': claude_3_5_sonnet, - - + ### Reka AI ### 'reka-core': reka_core, - - + ### Blackbox AI ### 'blackboxai': blackboxai, 'blackboxai-pro': blackboxai_pro, - - + ### CohereForAI ### 'command-r+': command_r_plus, - ### GigaChat ### 'gigachat': gigachat, - - - - ### Qwen ### - # qwen 1.5 - 'qwen-1.5-7b': qwen_1_5_7b, - # qwen 2 + 'qwen-1.5-7b': qwen_1_5_7b, 'qwen-2-72b': qwen_2_72b, - - # qwen 2.5 - 'qwen-2.5-coder-32b': qwen_2_5_coder_32b, - ### Upstage ### - 'solar-mini': solar_mini, 'solar-pro': solar_pro, - ### Inflection ### 'pi': pi, - - ### DeepSeek ### - 'deepseek-coder': deepseek_coder, - - ### Yorickvp ### 'llava-13b': llava_13b, - ### WizardLM ### 'wizardlm-2-8x22b': wizardlm_2_8x22b, - - + ### OpenChat ### 'openchat-3.5': openchat_3_5, - - + ### x.ai ### 'grok-2': grok_2, 'grok-2-mini': grok_2_mini, 'grok-beta': grok_beta, - - + ### Perplexity AI ### 'sonar-online': sonar_online, 'sonar-chat': sonar_chat, - - + ### TheBloke ### 'german-7b': german_7b, - - + ### Nvidia ### 'nemotron-70b': nemotron_70b, - - ### Teknium ### - 'openhermes-2.5': openhermes_2_5, - - - ### Liquid ### - 'lfm-40b': lfm_40b, - - - ### DiscoResearch ### - 'german-7b': german_7b, - - - ### HuggingFaceH4 ### - 'zephyr-7b': zephyr_7b, - - - ### Inferless ### - 'neural-7b': neural_7b, - - - ############# ### Image ### ############# - + ### Stability AI ### 'sdxl': sdxl, 'sd-3': sd_3, - - + ### Playground ### 'playground-v2.5': playground_v2_5, - ### Flux AI ### 'flux': flux, 'flux-pro': flux_pro, @@ -791,9 +667,8 @@ class ModelUtils: 'flux-pixel': flux_pixel, 'flux-4o': flux_4o, - ### Other ### 'any-dark': any_dark, } -_all_models = list(ModelUtils.convert.keys()) +_all_models = list(ModelUtils.convert.keys())
\ No newline at end of file |