Skip to content

Commit

Permalink
Update g4f/Provider/DeepInfraChat.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kqlio67 committed Feb 3, 2025
1 parent 197f491 commit 95821b5
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
4 changes: 2 additions & 2 deletions docs/providers-and-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ This document provides an overview of various AI providers and models, including
|[playground.ai.cloudflare.com](https://playground.ai.cloudflare.com)|[Automatic cookies](https://playground.ai.cloudflare.com)|`g4f.Provider.Cloudflare`|`llama-2-7b, llama-3-8b, llama-3.1-8b, llama-3.2-1b, qwen-1.5-7b`||||![Error](https://img.shields.io/badge/Active-brightgreen)||
|[copilot.microsoft.com](https://copilot.microsoft.com)|Optional API key|`g4f.Provider.Copilot`|`gpt-4, gpt-4o`||||![](https://img.shields.io/badge/Active-brightgreen)|
|[duckduckgo.com/aichat](https://duckduckgo.com/aichat)|No auth required|`g4f.Provider.DDG`|`gpt-4, gpt-4o-mini, claude-3-haiku, llama-3.1-70b, mixtral-8x7b`||||![](https://img.shields.io/badge/Active-brightgreen)|
|[deepinfra.com/chat](https://deepinfra.com/chat)|No auth required|`g4f.Provider.DeepInfraChat`|`llama-3.1-8b, llama-3.1-70b, deepseek-chat, qwq-32b, wizardlm-2-8x22b, wizardlm-2-7b, qwen-2.5-72b, qwen-2.5-coder-32b, nemotron-70b`||||![](https://img.shields.io/badge/Active-brightgreen)|
|[deepinfra.com/chat](https://deepinfra.com/chat)|No auth required|`g4f.Provider.DeepInfraChat`|`llama-3.1-8b, llama-3.2-90b, llama-3.3-70b, deepseek-v3, mixtral-small-28b, deepseek-r1, phi-4, wizardlm-2-8x22b, qwen-2.5-72b`||||![](https://img.shields.io/badge/Active-brightgreen)|
|[chat10.free2gpt.xyz](https://chat10.free2gpt.xyz)|No auth required|`g4f.Provider.Free2GPT`|`mistral-7b`||||![](https://img.shields.io/badge/Active-brightgreen)|
|[freegptsnav.aifree.site](https://freegptsnav.aifree.site)|No auth required|`g4f.Provider.FreeGpt`|`gemini-1.5-pro`||||![](https://img.shields.io/badge/Active-brightgreen)|
|[app.giz.ai/assistant](https://app.giz.ai/assistant)|No auth required|`g4f.Provider.GizAI`|`gemini-1.5-flash`||||![](https://img.shields.io/badge/Active-brightgreen)|
Expand Down Expand Up @@ -149,7 +149,7 @@ This document provides an overview of various AI providers and models, including
|mixtral-small-28b|Mistral|2+ Providers|[mistral.ai](https://mistral.ai/news/mixtral-small-28b/)|
|hermes-2-dpo|NousResearch|2+ Providers|[huggingface.co](https://huggingface.co/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO)|
|phi-3.5-mini|Microsoft|1+ Providers|[huggingface.co](https://huggingface.co/microsoft/Phi-3.5-mini-instruct)|
|wizardlm-2-7b|Microsoft|1+ Providers|[wizardlm.github.io](https://wizardlm.github.io/WizardLM2/)|
|phi-4|Microsoft|1+ Providers|[techcommunity.microsoft.com](https://techcommunity.microsoft.com/blog/aiplatformblog/introducing-phi-4-microsoft%E2%80%99s-newest-small-language-model-specializing-in-comple/4357090)|
|wizardlm-2-8x22b|Microsoft|2+ Providers|[wizardlm.github.io](https://wizardlm.github.io/WizardLM2/)|
|gemini|Google DeepMind|1+|[deepmind.google](http://deepmind.google/technologies/gemini/)|
|gemini-exp|Google DeepMind|1+ Providers|[blog.google](https://blog.google/feed/gemini-exp-1206/)|
Expand Down
28 changes: 16 additions & 12 deletions g4f/Provider/DeepInfraChat.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,41 @@ class DeepInfraChat(OpenaiTemplate):

default_model = 'meta-llama/Llama-3.3-70B-Instruct-Turbo'
models = [
'meta-llama/Llama-3.3-70B-Instruct',
'meta-llama/Meta-Llama-3.1-8B-Instruct',
'meta-llama/Llama-3.2-90B-Vision-Instruct',
default_model,
'meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo',
'deepseek-ai/DeepSeek-V3',
'Qwen/QwQ-32B-Preview',
'mistralai/Mistral-Small-24B-Instruct-2501',
'deepseek-ai/DeepSeek-R1',
'deepseek-ai/DeepSeek-R1-Distill-Llama-70B',
'deepseek-ai/DeepSeek-R1-Distill-Qwen-32B',
'microsoft/phi-4',
'microsoft/WizardLM-2-8x22B',
'microsoft/WizardLM-2-7B',
'Qwen/Qwen2.5-72B-Instruct',
'Qwen/Qwen2.5-Coder-32B-Instruct',
'nvidia/Llama-3.1-Nemotron-70B-Instruct',
]
model_aliases = {
"llama-3.3-70b": "meta-llama/Llama-3.3-70B-Instruct",
"llama-3.1-8b": "meta-llama/Meta-Llama-3.1-8B-Instruct",
"llama-3.2-90b": "meta-llama/Llama-3.2-90B-Vision-Instruct",
"llama-3.3-70b": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
"llama-3.1-70b": "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
"deepseek-v3": "deepseek-ai/DeepSeek-V3",
"qwq-32b": "Qwen/QwQ-32B-Preview",
"mixtral-small-28b": "mistralai/Mistral-Small-24B-Instruct-2501",
"deepseek-r1": "deepseek-ai/DeepSeek-R1",
"deepseek-r1": "deepseek-ai/DeepSeek-R1-Distill-Llama-70B",
"deepseek-r1": "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
"phi-4": "microsoft/phi-4",
"wizardlm-2-8x22b": "microsoft/WizardLM-2-8x22B",
"wizardlm-2-7b": "microsoft/WizardLM-2-7B",
"qwen-2.5-72b": "Qwen/Qwen2.5-72B-Instruct",
"qwen-2.5-coder-32b": "Qwen/Qwen2.5-Coder-32B-Instruct",
"nemotron-70b": "nvidia/Llama-3.1-Nemotron-70B-Instruct",
}

@classmethod
async def create_async_generator(
cls,
model: str,
messages: Messages,
stream: bool = True,
top_p: float = 0.9,
temperature: float = 0.7,
max_tokens: int = None,
headers: dict = {},
**kwargs
) -> AsyncResult:
Expand Down
22 changes: 11 additions & 11 deletions g4f/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class VisionModel(Model):
llama_3_2_90b = Model(
name = "llama-3.2-90b",
base_provider = "Meta Llama",
best_provider = Jmuz
best_provider = IterListProvider([DeepInfraChat, Jmuz])
)

# llama 3.3
Expand All @@ -256,7 +256,7 @@ class VisionModel(Model):
mixtral_small_28b = Model(
name = "mixtral-small-28b",
base_provider = "Mistral",
best_provider = IterListProvider([Blackbox, BlackboxAPI])
best_provider = IterListProvider([Blackbox, BlackboxAPI, DeepInfraChat])
)

### NousResearch ###
Expand All @@ -275,13 +275,13 @@ class VisionModel(Model):
best_provider = HuggingChat
)

# wizardlm
wizardlm_2_7b = Model(
name = 'wizardlm-2-7b',
base_provider = 'Microsoft',
phi_4 = Model(
name = "phi-4",
base_provider = "Microsoft",
best_provider = DeepInfraChat
)

# wizardlm
wizardlm_2_8x22b = Model(
name = 'wizardlm-2-8x22b',
base_provider = 'Microsoft',
Expand Down Expand Up @@ -420,7 +420,7 @@ class VisionModel(Model):
qwen_2_5_coder_32b = Model(
name = 'qwen-2.5-coder-32b',
base_provider = 'Qwen',
best_provider = IterListProvider([DeepInfraChat, PollinationsAI, Jmuz, HuggingChat])
best_provider = IterListProvider([PollinationsAI, Jmuz, HuggingChat])
)
qwen_2_5_1m = Model(
name = 'qwen-2.5-1m-demo',
Expand All @@ -432,7 +432,7 @@ class VisionModel(Model):
qwq_32b = Model(
name = 'qwq-32b',
base_provider = 'Qwen',
best_provider = IterListProvider([Blackbox, BlackboxAPI, DeepInfraChat, Jmuz, HuggingChat])
best_provider = IterListProvider([Blackbox, BlackboxAPI, Jmuz, HuggingChat])
)
qvq_72b = VisionModel(
name = 'qvq-72b',
Expand Down Expand Up @@ -463,7 +463,7 @@ class VisionModel(Model):
deepseek_r1 = Model(
name = 'deepseek-r1',
base_provider = 'DeepSeek',
best_provider = IterListProvider([Blackbox, BlackboxAPI, Glider, PollinationsAI, Jmuz, CablyAI, Liaobots, HuggingChat, HuggingFace])
best_provider = IterListProvider([Blackbox, BlackboxAPI, DeepInfraChat, Glider, PollinationsAI, Jmuz, CablyAI, Liaobots, HuggingChat, HuggingFace])
)

### x.ai ###
Expand Down Expand Up @@ -496,7 +496,7 @@ class VisionModel(Model):
nemotron_70b = Model(
name = 'nemotron-70b',
base_provider = 'Nvidia',
best_provider = IterListProvider([DeepInfraChat, HuggingChat, HuggingFace])
best_provider = IterListProvider([HuggingChat, HuggingFace])
)

### Databricks ###
Expand Down Expand Up @@ -645,9 +645,9 @@ class ModelUtils:
### Microsoft ###
# phi
phi_3_5_mini.name: phi_3_5_mini,
phi_4.name: phi_4,

# wizardlm
wizardlm_2_7b.name: wizardlm_2_7b,
wizardlm_2_8x22b.name: wizardlm_2_8x22b,

### Google ###
Expand Down

0 comments on commit 95821b5

Please sign in to comment.