θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ AnythingLLM divides your documents into objects called `workspaces`. A Workspace
- [Novita AI (chat models)](https://novita.ai/model-api/product/llm-api?utm_source=github_anything-llm&utm_medium=github_readme&utm_campaign=link)
- [PPIO](https://ppinfra.com?utm_source=github_anything-llm)
- [Moonshot AI](https://www.moonshot.ai/)
- [Microsoft Foundry Local](https://github.com/microsoft/Foundry-Local)
- [CometAPI (chat models)](https://api.cometapi.com/)

**Embedder models:**

- [AnythingLLM Native Embedder](/server/storage/models/README.md) (default)
Expand Down
5 changes: 5 additions & 0 deletions docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ GID='1000'
# MOONSHOT_AI_API_KEY='your-moonshot-api-key-here'
# MOONSHOT_AI_MODEL_PREF='moonshot-v1-32k'

# LLM_PROVIDER='foundry'
# FOUNDRY_BASE_PATH='http://127.0.0.1:55776'
# FOUNDRY_MODEL_PREF='phi-3.5-mini'
# FOUNDRY_MODEL_TOKEN_LIMIT=4096

###########################################
######## Embedding API SElECTION ##########
###########################################
Expand Down
110 changes: 110 additions & 0 deletions frontend/src/components/LLMSelection/FoundryOptions/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import { useEffect, useState } from "react";
import System from "@/models/system";

export default function FoundryOptions({ settings }) {
const [models, setModels] = useState([]);
const [loading, setLoading] = useState(!!settings?.FoundryBasePath);
const [basePath, setBasePath] = useState(settings?.FoundryBasePath);
const [model, setModel] = useState(settings?.FoundryModelPref || "");

useEffect(() => {
setModel(settings?.FoundryModelPref || "");
}, [settings?.FoundryModelPref]);

useEffect(() => {
async function fetchModels() {
try {
setLoading(true);
if (!basePath) throw new Error("Base path is required");
const { models, error } = await System.customModels(
"foundry",
null,
basePath
);
if (error) throw new Error(error);
setModels(models);
} catch (error) {
console.error("Error fetching Foundry models:", error);
setModels([]);
} finally {
setLoading(false);
}
}
fetchModels();
}, [basePath]);

return (
<div className="flex flex-col gap-y-7">
<div className="flex gap-[36px] mt-1.5 flex-wrap">
<div className="flex flex-col w-60">
<label className="text-white text-sm font-semibold block mb-3">
Base URL
</label>
<input
type="url"
name="FoundryBasePath"
className="border-none bg-theme-settings-input-bg text-white 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"
placeholder="eg: http://127.0.0.1:8080"
defaultValue={settings?.FoundryBasePath}
required={true}
autoComplete="off"
spellCheck={false}
onChange={(e) => setBasePath(e.target.value)}
/>
</div>
<div className="flex flex-col w-60">
<label className="text-white text-sm font-semibold block mb-3">
Chat Model
</label>
{loading ? (
<select
name="FoundryModelPref"
required={true}
disabled={true}
className="border-none bg-theme-settings-input-bg text-white 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"
>
<option>---- Loading ----</option>
</select>
) : (
<select
name="FoundryModelPref"
value={model}
onChange={(e) => setModel(e.target.value)}
required={true}
className="border-none bg-theme-settings-input-bg text-white 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"
>
{models.length > 0 ? (
<>
<option value="">-- Select a model --</option>
{models.map((model) => (
<option key={model.id} value={model.id}>
{model.id}
</option>
))}
</>
) : (
<option disabled value="">
No models found
</option>
)}
</select>
)}
</div>
<div className="flex flex-col w-60">
<label className="text-white text-sm font-semibold block mb-3">
Token Context Window
</label>
<input
type="number"
name="FoundryModelTokenLimit"
className="border-none bg-theme-settings-input-bg text-white 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"
placeholder="4096"
defaultValue={settings?.FoundryModelTokenLimit}
autoComplete="off"
min={0}
/>
</div>
</div>
</div>
);
}
Binary file added frontend/src/media/llmprovider/foundry-local.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions frontend/src/pages/GeneralSettings/LLMPreference/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import PPIOLogo from "@/media/llmprovider/ppio.png";
import DellProAiStudioLogo from "@/media/llmprovider/dpais.png";
import MoonshotAiLogo from "@/media/llmprovider/moonshotai.png";
import CometApiLogo from "@/media/llmprovider/cometapi.png";
import FoundryLogo from "@/media/llmprovider/foundry-local.png";

import PreLoader from "@/components/Preloader";
import OpenAiOptions from "@/components/LLMSelection/OpenAiOptions";
Expand Down Expand Up @@ -65,6 +66,7 @@ import NvidiaNimOptions from "@/components/LLMSelection/NvidiaNimOptions";
import PPIOLLMOptions from "@/components/LLMSelection/PPIOLLMOptions";
import DellProAiStudioOptions from "@/components/LLMSelection/DPAISOptions";
import MoonshotAiOptions from "@/components/LLMSelection/MoonshotAiOptions";
import FoundryOptions from "@/components/LLMSelection/FoundryOptions";

import LLMItem from "@/components/LLMSelection/LLMItem";
import { CaretUpDown, MagnifyingGlass, X } from "@phosphor-icons/react";
Expand Down Expand Up @@ -313,6 +315,18 @@ export const AVAILABLE_LLM_PROVIDERS = [
description: "500+ AI Models all in one API.",
requiredConfig: ["CometApiLLMApiKey"],
},
{
name: "Microsoft Foundry Local",
value: "foundry",
logo: FoundryLogo,
options: (settings) => <FoundryOptions settings={settings} />,
description: "Run Microsoft's Foundry models locally.",
requiredConfig: [
"FoundryBasePath",
"FoundryModelPref",
"FoundryModelTokenLimit",
],
},
{
name: "xAI",
value: "xai",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import PGVectorLogo from "@/media/vectordbs/pgvector.png";
import DPAISLogo from "@/media/llmprovider/dpais.png";
import MoonshotAiLogo from "@/media/llmprovider/moonshotai.png";
import CometApiLogo from "@/media/llmprovider/cometapi.png";
import FoundryLogo from "@/media/llmprovider/foundry-local.png";

import React, { useState, useEffect } from "react";
import paths from "@/utils/paths";
Expand Down Expand Up @@ -261,6 +262,13 @@ export const LLM_SELECTION_PRIVACY = {
],
logo: CometApiLogo,
},
foundry: {
name: "Microsoft Foundry Local",
description: [
"Your model and chats are only accessible on the machine running Foundry Local",
],
logo: FoundryLogo,
},
};

export const VECTOR_DB_PRIVACY = {
Expand Down
5 changes: 5 additions & 0 deletions server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ SIG_SALT='salt' # Please generate random string at least 32 chars long.
# MOONSHOT_AI_API_KEY='your-moonshot-api-key-here'
# MOONSHOT_AI_MODEL_PREF='moonshot-v1-32k'

# LLM_PROVIDER='foundry'
# FOUNDRY_BASE_PATH='http://127.0.0.1:55776'
# FOUNDRY_MODEL_PREF='phi-3.5-mini'
# FOUNDRY_MODEL_TOKEN_LIMIT=4096

###########################################
######## Embedding API SElECTION ##########
###########################################
Expand Down
5 changes: 5 additions & 0 deletions server/models/systemSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,11 @@ const SystemSettings = {
GenericOpenAiKey: !!process.env.GENERIC_OPEN_AI_API_KEY,
GenericOpenAiMaxTokens: process.env.GENERIC_OPEN_AI_MAX_TOKENS,

// Foundry Keys
FoundryBasePath: process.env.FOUNDRY_BASE_PATH,
FoundryModelPref: process.env.FOUNDRY_MODEL_PREF,
FoundryModelTokenLimit: process.env.FOUNDRY_MODEL_TOKEN_LIMIT,

AwsBedrockLLMConnectionMethod:
process.env.AWS_BEDROCK_LLM_CONNECTION_METHOD || "iam",
AwsBedrockLLMAccessKeyId: !!process.env.AWS_BEDROCK_LLM_ACCESS_KEY_ID,
Expand Down
Loading