Small fixes and updates around various providers (#2717)

* Update DDG.py: added Llama 3.3 Instruct and o3-mini

Duck.ai now supports o3-mini, and previous Llama 3.1 70B is now replaced by Llama 3.3 70B.

* Update DDG.py: change Llama 3.3 70B Instruct ID to "meta-llama/Llama-3.3-70B-Instruct-Turbo"

Fixed typo in full model name

* Update Cerebras.py: add "deepseek-r1-distill-llama-70b" to the models list

Cerebras now provides inference for a DeepSeek-R1 distilled to Llama 3.3 70B as well.

* Update models.py: reflect changes in DDG provider

- Removed DDG from best providers list for Llama 3.1 70B
- Added DDG to best providers list for o3-mini and Llama 3.3 70B

* A small update in HuggingFaceInference get_models() method

Previously, get_models() method was returning "TypeError: string indices must be integers, not 'str' on line 31" from time to time, possibly because of network error so the models list couldn't load and method was trying to parse this data. Now the code is updated in order to check for any potential errors first.

* Update BlackboxAPI.py: remove unused imports 

format_prompt() and JSON library are not being used here, so they may be removed safely.

* Update copilot.yml

This job is failing due to the error in JavaScript code; this commit is trying to fix it.

* Update providers-and-models.md to reflect latest changes

Updated models list and removed providers that are currently not working.
This commit is contained in:
Arken1xs 2025-02-19 15:34:30 +00:00 committed by GitHub
parent 292d5b69cd
commit 68414ece4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 41 additions and 36 deletions

View file

@ -27,14 +27,18 @@ jobs:
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr_number"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data));
if (matchArtifact) {
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data));
} else {
throw new Error('No artifact found with name "pr_number"');
}
- name: 'Unzip artifact'
run: unzip pr_number.zip
- name: Setup Python

View file

@ -37,7 +37,6 @@ This document provides an overview of various AI providers and models, including
### Providers No auth required
| Website | API Credentials | Provider | Text Models | Image Models | Vision (Image Upload) | Stream | Status |
|----------|-------------|--------------|---------------|--------|--------|------|------|
|[aichatfree.info](https://aichatfree.info)|No auth required|`g4f.Provider.AIChatFree`|`gemini-1.5-pro` _**(1+)**_|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
|[blackbox.ai](https://www.blackbox.ai)|No auth required|`g4f.Provider.Blackbox`|`blackboxai, gpt-4, gpt-4o, o3-mini, gemini-1.5-flash, gemini-1.5-pro, blackboxai-pro, llama-3.1-8b, llama-3.1-70b, llama-3-1-405b, llama-3.3-70b, mixtral-small-28b, deepseek-chat, dbrx-instruct, qwq-32b, hermes-2-dpo, deepseek-r1, gemini-2.0-flash` _**(+32)**_|`flux`|`blackboxai, gpt-4o, o3-mini, gemini-1.5-pro, gemini-1.5-flash, llama-3.1-8b, llama-3.1-70b, llama-3.1-405b, gemini-2.0-flash`|✔|![](https://img.shields.io/badge/Active-brightgreen)|
|[api.blackbox.ai](https://api.blackbox.ai)|No auth required|`g4f.Provider.BlackboxAPI`|`deepseek-v3, deepseek-r1, deepseek-chat, mixtral-small-28b, dbrx-instruct, qwq-32b, hermes-2-dpo`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
|[chatglm.cn](https://chatglm.cn)|No auth required|`g4f.Provider.ChatGLM`|`glm-4`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
@ -45,13 +44,12 @@ This document provides an overview of various AI providers and models, including
|[chatgpt.es](https://chatgpt.es)|No auth required|`g4f.Provider.ChatGptEs`|`gpt-4, gpt-4o, gpt-4o-mini`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
|[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)|
|[duckduckgo.com/aichat](https://duckduckgo.com/aichat)|No auth required|`g4f.Provider.DDG`|`o3-mini, gpt-4, gpt-4o-mini, claude-3-haiku, llama-3.3-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.2-90b, llama-3.3-70b, deepseek-v3, mixtral-small-28b, deepseek-r1, phi-4, wizardlm-2-8x22b, qwen-2.5-72b, yi-34b, qwen-2-72b, dolphin-2.6, dolphin-2.9, dbrx-instruct, airoboros-70b, lzlv-70b, wizardlm-2-7b, mixtral-8x22b, minicpm-2.5`|❌|`llama-3.2-90b, minicpm-2.5`|✔|![](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)|
|[glider.so](https://glider.so)|No auth required|`g4f.Provider.Glider`|`llama-3.1-70b, llama-3.1-8b, llama-3.2-3b, deepseek-r1`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
|[gprochat.com](https://gprochat.com)|No auth required|`g4f.Provider.GPROChat`|`gemini-1.5-pro`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
|[hailuo.ai](https://www.hailuo.ai)|No auth required|`g4f.Provider.HailuoAI`|`MiniMax` _**(1)**_|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
|[editor.imagelabs.net](https://editor.imagelabs.net)|No auth required|`g4f.Provider.ImageLabs`|`gemini-1.5-pro`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
|[editor.imagelabs.net](editor.imagelabs.net)|No auth required|`g4f.Provider.ImageLabs`|❌|`sdxl-turbo`|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|

View file

@ -1,11 +1,9 @@
from __future__ import annotations
import json
from aiohttp import ClientSession
from ..typing import AsyncResult, Messages
from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
from ..requests.raise_for_status import raise_for_status
from .helper import format_prompt
class BlackboxAPI(AsyncGeneratorProvider, ProviderModelMixin):
label = "Blackbox AI API"

View file

@ -36,12 +36,12 @@ class DDG(AsyncGeneratorProvider, ProviderModelMixin):
supports_message_history = True
default_model = "gpt-4o-mini"
models = [default_model, "claude-3-haiku-20240307", "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo", "mistralai/Mixtral-8x7B-Instruct-v0.1"]
models = [default_model, "o3-mini", "claude-3-haiku-20240307", "meta-llama/Llama-3.3-70B-Instruct-Turbo", "mistralai/Mixtral-8x7B-Instruct-v0.1"]
model_aliases = {
"gpt-4": "gpt-4o-mini",
"claude-3-haiku": "claude-3-haiku-20240307",
"llama-3.1-70b": "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
"llama-3.3-70b": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
"mixtral-8x7b": "mistralai/Mixtral-8x7B-Instruct-v0.1",
}
@ -179,4 +179,4 @@ class DDG(AsyncGeneratorProvider, ProviderModelMixin):
yield FinishReason(reason)
except asyncio.TimeoutError as e:
raise TimeoutError(f"Request timed out: {str(e)}")
raise TimeoutError(f"Request timed out: {str(e)}")

View file

@ -25,19 +25,23 @@ class HuggingFaceInference(AsyncGeneratorProvider, ProviderModelMixin):
@classmethod
def get_models(cls) -> list[str]:
if not cls.models:
models = fallback_models.copy()
url = "https://huggingface.co/api/models?inference=warm&pipeline_tag=text-generation"
extra_models = [model["id"] for model in requests.get(url).json()]
extra_models.sort()
models.extend([model for model in extra_models if model not in models])
if not cls.image_models:
url = "https://huggingface.co/api/models?pipeline_tag=text-to-image"
cls.image_models = [model["id"] for model in requests.get(url).json() if model["trendingScore"] >= 20]
cls.image_models.sort()
models.extend([model for model in cls.image_models if model not in models])
cls.models = models
return cls.models
if not cls.models:
models = fallback_models.copy()
url = "https://huggingface.co/api/models?inference=warm&pipeline_tag=text-generation"
response = requests.get(url)
response.raise_for_status()
extra_models = [model["id"] for model in response.json()]
extra_models.sort()
models.extend([model for model in extra_models if model not in models])
if not cls.image_models:
url = "https://huggingface.co/api/models?pipeline_tag=text-to-image"
response = requests.get(url)
response.raise_for_status()
cls.image_models = [model["id"] for model in response.json() if model.get("trendingScore", 0) >= 20]
cls.image_models.sort()
models.extend([model for model in cls.image_models if model not in models])
cls.models = models
return cls.models
@classmethod
async def create_async_generator(
@ -215,4 +219,4 @@ def get_inputs(messages: Messages, model_data: dict, model_type: str, do_continu
inputs = format_prompt(messages, do_continue=do_continue)
else:
inputs = format_prompt(messages, do_continue=do_continue)
return inputs
return inputs

View file

@ -17,9 +17,10 @@ class Cerebras(OpenaiAPI):
models = [
default_model,
"llama3.1-8b",
"llama-3.3-70b"
"llama-3.3-70b",
"deepseek-r1-distill-llama-70b"
]
model_aliases = {"llama-3.1-70b": default_model, "llama-3.1-8b": "llama3.1-8b"}
model_aliases = {"llama-3.1-70b": default_model, "llama-3.1-8b": "llama3.1-8b", "deepseek-r1": "deepseek-r1-distill-llama-70b"}
@classmethod
async def create_async_generator(
@ -48,4 +49,4 @@ class Cerebras(OpenaiAPI):
},
**kwargs
):
yield chunk
yield chunk

View file

@ -152,7 +152,7 @@ o1_mini = Model(
o3_mini = Model(
name = 'o3-mini',
base_provider = 'OpenAI',
best_provider = Blackbox
best_provider = IterListProvider([DDG, Blackbox])
)
### GigaChat ###
@ -198,7 +198,7 @@ llama_3_1_8b = Model(
llama_3_1_70b = Model(
name = "llama-3.1-70b",
base_provider = "Meta Llama",
best_provider = IterListProvider([DDG, Blackbox, Glider, Jmuz, TeachAnything])
best_provider = IterListProvider([Blackbox, Glider, Jmuz, TeachAnything])
)
llama_3_1_405b = Model(
@ -236,7 +236,7 @@ llama_3_2_90b = Model(
llama_3_3_70b = Model(
name = "llama-3.3-70b",
base_provider = "Meta Llama",
best_provider = IterListProvider([Blackbox, DeepInfraChat, PollinationsAI, Jmuz, HuggingChat, HuggingFace])
best_provider = IterListProvider([DDG, Blackbox, DeepInfraChat, PollinationsAI, Jmuz, HuggingChat, HuggingFace])
)
### Mistral ###