XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

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.

68414ece
Arken1xs <152556624+Arken1xs@users.noreply.github.com>
提交于

代码差异

7 个文件 +41 -36
Modified .github/workflows/copilot.yml +12 -8
@@ -27,14 +27,18 @@ jobs:
27 27 let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
28 28 return artifact.name == "pr_number"
29 29 })[0];
30 let download = await github.rest.actions.downloadArtifact({
31 owner: context.repo.owner,
32 repo: context.repo.repo,
33 artifact_id: matchArtifact.id,
34 archive_format: 'zip',
35 });
36 let fs = require('fs');
37 fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data));
30 if (matchArtifact) {
31 let download = await github.rest.actions.downloadArtifact({
32 owner: context.repo.owner,
33 repo: context.repo.repo,
34 artifact_id: matchArtifact.id,
35 archive_format: 'zip',
36 });
37 let fs = require('fs');
38 fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data));
39 } else {
40 throw new Error('No artifact found with name "pr_number"');
41 }
38 42 - name: 'Unzip artifact'
39 43 run: unzip pr_number.zip
40 44 - name: Setup Python
Modified docs/providers-and-models.md +1 -3
@@ -37,7 +37,6 @@ This document provides an overview of various AI providers and models, including
37 37 ### Providers No auth required
38 38 | Website | API Credentials | Provider | Text Models | Image Models | Vision (Image Upload) | Stream | Status |
39 39 |----------|-------------|--------------|---------------|--------|--------|------|------|
40 |[aichatfree.info](https://aichatfree.info)|No auth required|`g4f.Provider.AIChatFree`|`gemini-1.5-pro` _**(1+)**_|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
41 40 |[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)|
42 41 |[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)|
43 42 |[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
45 44 |[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)|
46 45 |[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)|❌|
47 46 |[copilot.microsoft.com](https://copilot.microsoft.com)|Optional API key|`g4f.Provider.Copilot`|`gpt-4, gpt-4o`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
48 |[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)|
47 |[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)|
49 48 |[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)|
50 49 |[chat10.free2gpt.xyz](https://chat10.free2gpt.xyz)|No auth required|`g4f.Provider.Free2GPT`|`mistral-7b`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
51 50 |[freegptsnav.aifree.site](https://freegptsnav.aifree.site)|No auth required|`g4f.Provider.FreeGpt`|`gemini-1.5-pro`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
52 51 |[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)|
53 52 |[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)|
54 |[gprochat.com](https://gprochat.com)|No auth required|`g4f.Provider.GPROChat`|`gemini-1.5-pro`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
55 53 |[hailuo.ai](https://www.hailuo.ai)|No auth required|`g4f.Provider.HailuoAI`|`MiniMax` _**(1)**_|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
56 54 |[editor.imagelabs.net](https://editor.imagelabs.net)|No auth required|`g4f.Provider.ImageLabs`|`gemini-1.5-pro`|❌|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
57 55 |[editor.imagelabs.net](editor.imagelabs.net)|No auth required|`g4f.Provider.ImageLabs`|❌|`sdxl-turbo`|❌|✔|![](https://img.shields.io/badge/Active-brightgreen)|
Modified g4f/Provider/BlackboxAPI.py +0 -2
@@ -1,11 +1,9 @@
1 1 from __future__ import annotations
2 import json
3 2 from aiohttp import ClientSession
4 3
5 4 from ..typing import AsyncResult, Messages
6 5 from .base_provider import AsyncGeneratorProvider, ProviderModelMixin
7 6 from ..requests.raise_for_status import raise_for_status
8 from .helper import format_prompt
9 7
10 8 class BlackboxAPI(AsyncGeneratorProvider, ProviderModelMixin):
11 9 label = "Blackbox AI API"
Modified g4f/Provider/DDG.py +3 -3
@@ -36,12 +36,12 @@ class DDG(AsyncGeneratorProvider, ProviderModelMixin):
36 36 supports_message_history = True
37 37
38 38 default_model = "gpt-4o-mini"
39 models = [default_model, "claude-3-haiku-20240307", "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo", "mistralai/Mixtral-8x7B-Instruct-v0.1"]
39 models = [default_model, "o3-mini", "claude-3-haiku-20240307", "meta-llama/Llama-3.3-70B-Instruct-Turbo", "mistralai/Mixtral-8x7B-Instruct-v0.1"]
40 40
41 41 model_aliases = {
42 42 "gpt-4": "gpt-4o-mini",
43 43 "claude-3-haiku": "claude-3-haiku-20240307",
44 "llama-3.1-70b": "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
44 "llama-3.3-70b": "meta-llama/Llama-3.3-70B-Instruct-Turbo",
45 45 "mixtral-8x7b": "mistralai/Mixtral-8x7B-Instruct-v0.1",
46 46 }
47 47
@@ -179,4 +179,4 @@ class DDG(AsyncGeneratorProvider, ProviderModelMixin):
179 179 yield FinishReason(reason)
180 180
181 181 except asyncio.TimeoutError as e:
182 raise TimeoutError(f"Request timed out: {str(e)}")
182 raise TimeoutError(f"Request timed out: {str(e)}")
Modified g4f/Provider/hf/HuggingFaceInference.py +18 -14
@@ -25,19 +25,23 @@ class HuggingFaceInference(AsyncGeneratorProvider, ProviderModelMixin):
25 25
26 26 @classmethod
27 27 def get_models(cls) -> list[str]:
28 if not cls.models:
29 models = fallback_models.copy()
30 url = "https://huggingface.co/api/models?inference=warm&pipeline_tag=text-generation"
31 extra_models = [model["id"] for model in requests.get(url).json()]
32 extra_models.sort()
33 models.extend([model for model in extra_models if model not in models])
34 if not cls.image_models:
35 url = "https://huggingface.co/api/models?pipeline_tag=text-to-image"
36 cls.image_models = [model["id"] for model in requests.get(url).json() if model["trendingScore"] >= 20]
37 cls.image_models.sort()
38 models.extend([model for model in cls.image_models if model not in models])
39 cls.models = models
40 return cls.models
28 if not cls.models:
29 models = fallback_models.copy()
30 url = "https://huggingface.co/api/models?inference=warm&pipeline_tag=text-generation"
31 response = requests.get(url)
32 response.raise_for_status()
33 extra_models = [model["id"] for model in response.json()]
34 extra_models.sort()
35 models.extend([model for model in extra_models if model not in models])
36 if not cls.image_models:
37 url = "https://huggingface.co/api/models?pipeline_tag=text-to-image"
38 response = requests.get(url)
39 response.raise_for_status()
40 cls.image_models = [model["id"] for model in response.json() if model.get("trendingScore", 0) >= 20]
41 cls.image_models.sort()
42 models.extend([model for model in cls.image_models if model not in models])
43 cls.models = models
44 return cls.models
41 45
42 46 @classmethod
43 47 async def create_async_generator(
@@ -215,4 +219,4 @@ def get_inputs(messages: Messages, model_data: dict, model_type: str, do_continu
215 219 inputs = format_prompt(messages, do_continue=do_continue)
216 220 else:
217 221 inputs = format_prompt(messages, do_continue=do_continue)
218 return inputs
222 return inputs
Modified g4f/Provider/needs_auth/Cerebras.py +4 -3
@@ -17,9 +17,10 @@ class Cerebras(OpenaiAPI):
17 17 models = [
18 18 default_model,
19 19 "llama3.1-8b",
20 "llama-3.3-70b"
20 "llama-3.3-70b",
21 "deepseek-r1-distill-llama-70b"
21 22 ]
22 model_aliases = {"llama-3.1-70b": default_model, "llama-3.1-8b": "llama3.1-8b"}
23 model_aliases = {"llama-3.1-70b": default_model, "llama-3.1-8b": "llama3.1-8b", "deepseek-r1": "deepseek-r1-distill-llama-70b"}
23 24
24 25 @classmethod
25 26 async def create_async_generator(
@@ -48,4 +49,4 @@ class Cerebras(OpenaiAPI):
48 49 },
49 50 **kwargs
50 51 ):
51 yield chunk
52 yield chunk
Modified g4f/models.py +3 -3
@@ -152,7 +152,7 @@ o1_mini = Model(
152 152 o3_mini = Model(
153 153 name = 'o3-mini',
154 154 base_provider = 'OpenAI',
155 best_provider = Blackbox
155 best_provider = IterListProvider([DDG, Blackbox])
156 156 )
157 157
158 158 ### GigaChat ###
@@ -198,7 +198,7 @@ llama_3_1_8b = Model(
198 198 llama_3_1_70b = Model(
199 199 name = "llama-3.1-70b",
200 200 base_provider = "Meta Llama",
201 best_provider = IterListProvider([DDG, Blackbox, Glider, Jmuz, TeachAnything])
201 best_provider = IterListProvider([Blackbox, Glider, Jmuz, TeachAnything])
202 202 )
203 203
204 204 llama_3_1_405b = Model(
@@ -236,7 +236,7 @@ llama_3_2_90b = Model(
236 236 llama_3_3_70b = Model(
237 237 name = "llama-3.3-70b",
238 238 base_provider = "Meta Llama",
239 best_provider = IterListProvider([Blackbox, DeepInfraChat, PollinationsAI, Jmuz, HuggingChat, HuggingFace])
239 best_provider = IterListProvider([DDG, Blackbox, DeepInfraChat, PollinationsAI, Jmuz, HuggingChat, HuggingFace])
240 240 )
241 241
242 242 ### Mistral ###