Skip to content

Commit 2aeb4c2

Browse files
Add new model provider PPIO (#3211)
* feat: add new model provider PPIO * fix: fix ppio model fetching * fix: code lint * reorder LLM update interface for streaming and chats to use valid keys linting --------- Co-authored-by: timothycarambat <[email protected]>
1 parent b07240d commit 2aeb4c2

File tree

26 files changed

+585
-3
lines changed

26 files changed

+585
-3
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"opendocument",
4242
"openrouter",
4343
"pagerender",
44+
"ppio",
4445
"Qdrant",
4546
"royalblue",
4647
"SearchApi",

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ AnythingLLM divides your documents into objects called `workspaces`. A Workspace
9999
- [Apipie](https://apipie.ai/)
100100
- [xAI](https://x.ai/)
101101
- [Novita AI (chat models)](https://novita.ai/model-api/product/llm-api?utm_source=github_anything-llm&utm_medium=github_readme&utm_campaign=link)
102+
- [PPIO](https://ppinfra.com?utm_source=github_anything-llm)
102103

103104
**Embedder models:**
104105

docker/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ GID='1000'
126126
# DEEPSEEK_API_KEY='your-deepseek-api-key-here'
127127
# DEEPSEEK_MODEL_PREF='deepseek-chat'
128128

129+
# LLM_PROVIDER='ppio'
130+
# PPIO_API_KEY='your-ppio-api-key-here'
131+
# PPIO_MODEL_PREF=deepseek/deepseek-v3/community
132+
129133
###########################################
130134
######## Embedding API SElECTION ##########
131135
###########################################
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import System from "@/models/system";
2+
import { useState, useEffect } from "react";
3+
4+
export default function PPIOLLMOptions({ settings }) {
5+
return (
6+
<div className="w-full flex flex-col gap-y-7">
7+
<div className="w-full flex items-start gap-[36px] mt-1.5">
8+
<div className="flex flex-col w-60">
9+
<label className="text-theme-text-primary text-sm font-semibold block mb-3">
10+
PPIO API Key
11+
</label>
12+
<input
13+
type="password"
14+
name="PPIOApiKey"
15+
className="border-none bg-theme-settings-input-bg text-theme-text-primary placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"
16+
placeholder="PPIO API Key"
17+
defaultValue={settings?.PPIOApiKey ? "*".repeat(20) : ""}
18+
required={true}
19+
autoComplete="off"
20+
spellCheck={false}
21+
/>
22+
</div>
23+
{!settings?.credentialsOnly && (
24+
<PPIOModelSelection settings={settings} />
25+
)}
26+
</div>
27+
</div>
28+
);
29+
}
30+
31+
function PPIOModelSelection({ settings }) {
32+
const [groupedModels, setGroupedModels] = useState({});
33+
const [loading, setLoading] = useState(true);
34+
35+
useEffect(() => {
36+
async function fetchModels() {
37+
setLoading(true);
38+
const { models } = await System.customModels("ppio");
39+
if (models?.length > 0) {
40+
const modelsByOrganization = models.reduce((acc, model) => {
41+
acc[model.organization] = acc[model.organization] || [];
42+
acc[model.organization].push(model);
43+
return acc;
44+
}, {});
45+
setGroupedModels(modelsByOrganization);
46+
}
47+
setLoading(false);
48+
}
49+
fetchModels();
50+
}, []);
51+
52+
if (loading || Object.keys(groupedModels).length === 0) {
53+
return (
54+
<div className="flex flex-col w-60">
55+
<label className="text-theme-text-primary text-sm font-semibold block mb-3">
56+
Chat Model Selection
57+
</label>
58+
<select
59+
name="PPIOModelPref"
60+
required={true}
61+
disabled={true}
62+
className="bg-theme-settings-input-bg text-theme-text-primary text-sm rounded-lg focus:ring-primary-button focus:border-primary-button block w-full p-2.5"
63+
>
64+
<option disabled={true} selected={true}>
65+
-- loading available models --
66+
</option>
67+
</select>
68+
</div>
69+
);
70+
}
71+
72+
return (
73+
<div className="flex flex-col">
74+
<label className="text-theme-text-primary text-sm font-semibold block mb-3">
75+
Chat Model Selection
76+
</label>
77+
<select
78+
name="PPIOModelPref"
79+
required={true}
80+
className="border-none bg-theme-settings-input-bg text-theme-text-primary border-theme-border text-sm rounded-lg block w-full p-2.5"
81+
>
82+
{Object.keys(groupedModels)
83+
.sort()
84+
.map((organization) => (
85+
<optgroup key={organization} label={organization}>
86+
{groupedModels[organization].map((model) => (
87+
<option
88+
key={model.id}
89+
value={model.id}
90+
selected={settings?.PPIOModelPref === model.id}
91+
>
92+
{model.name}
93+
</option>
94+
))}
95+
</optgroup>
96+
))}
97+
</select>
98+
</div>
99+
);
100+
}

frontend/src/hooks/useGetProvidersModels.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const groupedProviders = [
7979
"openai",
8080
"novita",
8181
"openrouter",
82+
"ppio",
8283
];
8384
export default function useGetProviderModels(provider = null) {
8485
const [defaultModels, setDefaultModels] = useState([]);
3.51 KB
Loading

frontend/src/pages/GeneralSettings/LLMPreference/index.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import DeepSeekLogo from "@/media/llmprovider/deepseek.png";
3030
import APIPieLogo from "@/media/llmprovider/apipie.png";
3131
import XAILogo from "@/media/llmprovider/xai.png";
3232
import NvidiaNimLogo from "@/media/llmprovider/nvidia-nim.png";
33+
import PPIOLogo from "@/media/llmprovider/ppio.png";
3334

3435
import PreLoader from "@/components/Preloader";
3536
import OpenAiOptions from "@/components/LLMSelection/OpenAiOptions";
@@ -57,6 +58,7 @@ import DeepSeekOptions from "@/components/LLMSelection/DeepSeekOptions";
5758
import ApiPieLLMOptions from "@/components/LLMSelection/ApiPieOptions";
5859
import XAILLMOptions from "@/components/LLMSelection/XAiLLMOptions";
5960
import NvidiaNimOptions from "@/components/LLMSelection/NvidiaNimOptions";
61+
import PPIOLLMOptions from "@/components/LLMSelection/PPIOLLMOptions";
6062

6163
import LLMItem from "@/components/LLMSelection/LLMItem";
6264
import { CaretUpDown, MagnifyingGlass, X } from "@phosphor-icons/react";
@@ -246,6 +248,15 @@ export const AVAILABLE_LLM_PROVIDERS = [
246248
description: "Run DeepSeek's powerful LLMs.",
247249
requiredConfig: ["DeepSeekApiKey"],
248250
},
251+
{
252+
name: "PPIO",
253+
value: "ppio",
254+
logo: PPIOLogo,
255+
options: (settings) => <PPIOLLMOptions settings={settings} />,
256+
description:
257+
"Run stable and cost-efficient open-source LLM APIs, such as DeepSeek, Llama, Qwen etc.",
258+
requiredConfig: ["PPIOApiKey"],
259+
},
249260
{
250261
name: "AWS Bedrock",
251262
value: "bedrock",

frontend/src/pages/OnboardingFlow/Steps/DataHandling/index.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import AWSBedrockLogo from "@/media/llmprovider/bedrock.png";
2525
import DeepSeekLogo from "@/media/llmprovider/deepseek.png";
2626
import APIPieLogo from "@/media/llmprovider/apipie.png";
2727
import XAILogo from "@/media/llmprovider/xai.png";
28-
2928
import CohereLogo from "@/media/llmprovider/cohere.png";
3029
import ZillizLogo from "@/media/vectordbs/zilliz.png";
3130
import AstraDBLogo from "@/media/vectordbs/astraDB.png";
@@ -36,6 +35,7 @@ import WeaviateLogo from "@/media/vectordbs/weaviate.png";
3635
import QDrantLogo from "@/media/vectordbs/qdrant.png";
3736
import MilvusLogo from "@/media/vectordbs/milvus.png";
3837
import VoyageAiLogo from "@/media/embeddingprovider/voyageai.png";
38+
import PPIOLogo from "@/media/llmprovider/ppio.png";
3939

4040
import React, { useState, useEffect } from "react";
4141
import paths from "@/utils/paths";
@@ -226,6 +226,14 @@ export const LLM_SELECTION_PRIVACY = {
226226
],
227227
logo: XAILogo,
228228
},
229+
ppio: {
230+
name: "PPIO",
231+
description: [
232+
"Your chats will not be used for training",
233+
"Your prompts and document text used in response creation are visible to PPIO",
234+
],
235+
logo: PPIOLogo,
236+
},
229237
};
230238

231239
export const VECTOR_DB_PRIVACY = {

frontend/src/pages/OnboardingFlow/Steps/LLMPreference/index.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import NovitaLogo from "@/media/llmprovider/novita.png";
2525
import XAILogo from "@/media/llmprovider/xai.png";
2626
import NvidiaNimLogo from "@/media/llmprovider/nvidia-nim.png";
2727
import CohereLogo from "@/media/llmprovider/cohere.png";
28+
import PPIOLogo from "@/media/llmprovider/ppio.png";
29+
2830
import OpenAiOptions from "@/components/LLMSelection/OpenAiOptions";
2931
import GenericOpenAiOptions from "@/components/LLMSelection/GenericOpenAiOptions";
3032
import AzureAiOptions from "@/components/LLMSelection/AzureAiOptions";
@@ -50,6 +52,7 @@ import ApiPieLLMOptions from "@/components/LLMSelection/ApiPieOptions";
5052
import NovitaLLMOptions from "@/components/LLMSelection/NovitaLLMOptions";
5153
import XAILLMOptions from "@/components/LLMSelection/XAiLLMOptions";
5254
import NvidiaNimOptions from "@/components/LLMSelection/NvidiaNimOptions";
55+
import PPIOLLMOptions from "@/components/LLMSelection/PPIOLLMOptions";
5356

5457
import LLMItem from "@/components/LLMSelection/LLMItem";
5558
import System from "@/models/system";
@@ -213,6 +216,14 @@ const LLMS = [
213216
options: (settings) => <DeepSeekOptions settings={settings} />,
214217
description: "Run DeepSeek's powerful LLMs.",
215218
},
219+
{
220+
name: "PPIO",
221+
value: "ppio",
222+
logo: PPIOLogo,
223+
options: (settings) => <PPIOLLMOptions settings={settings} />,
224+
description:
225+
"Run stable and cost-efficient open-source LLM APIs, such as DeepSeek, Llama, Qwen etc.",
226+
},
216227
{
217228
name: "APIpie",
218229
value: "apipie",

frontend/src/pages/WorkspaceSettings/AgentConfig/AgentLLMSelection/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const ENABLED_PROVIDERS = [
2525
"bedrock",
2626
"fireworksai",
2727
"deepseek",
28+
"ppio",
2829
"litellm",
2930
"apipie",
3031
"xai",

locales/README.fa-IR.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ AnythingLLM اسناد شما را به اشیایی به نام `workspaces` ت
103103
- [Apipie](https://apipie.ai/)
104104
- [xAI](https://x.ai/)
105105
- [Novita AI (chat models)](https://novita.ai/model-api/product/llm-api?utm_source=github_anything-llm&utm_medium=github_readme&utm_campaign=link)
106+
- [PPIO](https://ppinfra.com?utm_source=github_anything-llm)
106107

107108
<div dir="rtl">
108109

locales/README.ja-JP.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ AnythingLLMのいくつかのクールな機能
9090
- [Groq](https://groq.com/)
9191
- [Cohere](https://cohere.com/)
9292
- [KoboldCPP](https://github.com/LostRuins/koboldcpp)
93+
- [PPIO](https://ppinfra.com?utm_source=github_anything-llm)
9394

9495
**埋め込みモデル:**
9596

locales/README.tr-TR.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ AnythingLLM, belgelerinizi **"çalışma alanları" (workspaces)** adı verilen
100100
- [Apipie](https://apipie.ai/)
101101
- [xAI](https://x.ai/)
102102
- [Novita AI (chat models)](https://novita.ai/model-api/product/llm-api?utm_source=github_anything-llm&utm_medium=github_readme&utm_campaign=link)
103+
- [PPIO](https://ppinfra.com?utm_source=github_anything-llm)
103104

104105
**Embedder modelleri:**
105106

locales/README.zh-CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ AnythingLLM的一些酷炫特性
8686
- [Groq](https://groq.com/)
8787
- [Cohere](https://cohere.com/)
8888
- [KoboldCPP](https://github.com/LostRuins/koboldcpp)
89+
- [PPIO (聊天模型)](https://ppinfra.com?utm_source=github_anything-llm)
8990

9091
**支持的嵌入模型:**
9192

server/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ SIG_SALT='salt' # Please generate random string at least 32 chars long.
116116
# NVIDIA_NIM_LLM_BASE_PATH='http://127.0.0.1:8000'
117117
# NVIDIA_NIM_LLM_MODEL_PREF='meta/llama-3.2-3b-instruct'
118118

119+
# LLM_PROVIDER='ppio'
120+
# PPIO_API_KEY='your-ppio-api-key-here'
121+
# PPIO_MODEL_PREF='deepseek/deepseek-v3/community'
122+
119123
###########################################
120124
######## Embedding API SElECTION ##########
121125
###########################################

server/models/systemSettings.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,10 @@ const SystemSettings = {
560560
NvidiaNimLLMBasePath: process.env.NVIDIA_NIM_LLM_BASE_PATH,
561561
NvidiaNimLLMModelPref: process.env.NVIDIA_NIM_LLM_MODEL_PREF,
562562
NvidiaNimLLMTokenLimit: process.env.NVIDIA_NIM_LLM_MODEL_TOKEN_LIMIT,
563+
564+
// PPIO API keys
565+
PPIOApiKey: !!process.env.PPIO_API_KEY,
566+
PPIOModelPref: process.env.PPIO_MODEL_PREF,
563567
};
564568
},
565569

server/storage/models/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ mixedbread-ai*
88
gemini
99
togetherAi
1010
tesseract
11-
ppio
11+
ppio

0 commit comments

Comments
 (0)