θΏ™ζ˜―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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Some cool features of AnythingLLM
- [Chroma](https://trychroma.com)
- [Weaviate](https://weaviate.io)
- [QDrant](https://qdrant.tech)
- [Milvus](https://milvus.io)

### Technical Overview

Expand Down
6 changes: 6 additions & 0 deletions docker/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ GID='1000'
# QDRANT_ENDPOINT="http://localhost:6333"
# QDRANT_API_KEY=

# Enable all below if you are using vector database: Milvus.
# VECTOR_DB="milvus"
# MILVUS_ADDRESS="http://localhost:19530"
# MILVUS_USERNAME=
# MILVUS_PASSWORD=

# CLOUD DEPLOYMENT VARIRABLES ONLY
# AUTH_TOKEN="hunter2" # This is the password to your application if remote hosting.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
export default function MilvusDBOptions({ settings }) {
return (
<div className="w-full flex flex-col gap-y-4">
<div className="w-full flex items-center gap-4">
<div className="flex flex-col w-60">
<label className="text-white text-sm font-semibold block mb-4">
Milvus DB Address
</label>
<input
type="text"
name="MilvusAddress"
className="bg-zinc-900 text-white placeholder-white placeholder-opacity-60 text-sm rounded-lg focus:border-white block w-full p-2.5"
placeholder="http://localhost:19530"
defaultValue={settings?.MilvusAddress}
required={true}
autoComplete="off"
spellCheck={false}
/>
</div>

<div className="flex flex-col w-60">
<label className="text-white text-sm font-semibold block mb-4">
Milvus Username
</label>
<input
type="text"
name="MilvusUsername"
className="bg-zinc-900 text-white placeholder-white placeholder-opacity-60 text-sm rounded-lg focus:border-white block w-full p-2.5"
placeholder="username"
defaultValue={settings?.MilvusUsername}
autoComplete="off"
spellCheck={false}
/>
</div>
<div className="flex flex-col w-60">
<label className="text-white text-sm font-semibold block mb-4">
Milvus Password
</label>
<input
type="password"
name="MilvusPassword"
className="bg-zinc-900 text-white placeholder-white placeholder-opacity-60 text-sm rounded-lg focus:border-white block w-full p-2.5"
placeholder="password"
defaultValue={settings?.MilvusPassword ? "*".repeat(20) : ""}
autoComplete="off"
spellCheck={false}
/>
</div>
</div>
</div>
);
}
Binary file added frontend/src/media/vectordbs/milvus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions frontend/src/pages/GeneralSettings/VectorDatabase/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import PineconeLogo from "@/media/vectordbs/pinecone.png";
import LanceDbLogo from "@/media/vectordbs/lancedb.png";
import WeaviateLogo from "@/media/vectordbs/weaviate.png";
import QDrantLogo from "@/media/vectordbs/qdrant.png";
import MilvusLogo from "@/media/vectordbs/milvus.png";
import PreLoader from "@/components/Preloader";
import ChangeWarningModal from "@/components/ChangeWarning";
import { MagnifyingGlass } from "@phosphor-icons/react";
Expand All @@ -17,6 +18,7 @@ import PineconeDBOptions from "@/components/VectorDBSelection/PineconeDBOptions"
import QDrantDBOptions from "@/components/VectorDBSelection/QDrantDBOptions";
import WeaviateDBOptions from "@/components/VectorDBSelection/WeaviateDBOptions";
import VectorDBItem from "@/components/VectorDBSelection/VectorDBItem";
import MilvusDBOptions from "@/components/VectorDBSelection/MilvusDBOptions";

export default function GeneralVectorDatabase() {
const [saving, setSaving] = useState(false);
Expand Down Expand Up @@ -79,6 +81,13 @@ export default function GeneralVectorDatabase() {
description:
"Open source local and cloud hosted multi-modal vector database.",
},
{
name: "Milvus",
value: "milvus",
logo: MilvusLogo,
options: <MilvusDBOptions settings={settings} />,
description: "Open-source, highly scalable, and blazing fast.",
},
];

const updateVectorChoice = (selection) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import PineconeLogo from "@/media/vectordbs/pinecone.png";
import LanceDbLogo from "@/media/vectordbs/lancedb.png";
import WeaviateLogo from "@/media/vectordbs/weaviate.png";
import QDrantLogo from "@/media/vectordbs/qdrant.png";
import MilvusLogo from "@/media/vectordbs/milvus.png";
import React, { useState, useEffect } from "react";
import paths from "@/utils/paths";
import { useNavigate } from "react-router-dom";
Expand Down Expand Up @@ -123,6 +124,13 @@ const VECTOR_DB_PRIVACY = {
],
logo: WeaviateLogo,
},
milvus: {
name: "Milvus",
description: [
"Your vectors and document text are stored on your Milvus instance (cloud or self-hosted)",
],
logo: MilvusLogo,
},
lancedb: {
name: "LanceDB",
description: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import PineconeLogo from "@/media/vectordbs/pinecone.png";
import LanceDbLogo from "@/media/vectordbs/lancedb.png";
import WeaviateLogo from "@/media/vectordbs/weaviate.png";
import QDrantLogo from "@/media/vectordbs/qdrant.png";
import MilvusLogo from "@/media/vectordbs/milvus.png";
import System from "@/models/system";
import paths from "@/utils/paths";
import PineconeDBOptions from "@/components/VectorDBSelection/PineconeDBOptions";
import ChromaDBOptions from "@/components/VectorDBSelection/ChromaDBOptions";
import QDrantDBOptions from "@/components/VectorDBSelection/QDrantDBOptions";
import WeaviateDBOptions from "@/components/VectorDBSelection/WeaviateDBOptions";
import LanceDBOptions from "@/components/VectorDBSelection/LanceDBOptions";
import MilvusOptions from "@/components/VectorDBSelection/MilvusDBOptions";
import showToast from "@/utils/toast";
import { useNavigate } from "react-router-dom";
import VectorDBItem from "@/components/VectorDBSelection/VectorDBItem";
Expand Down Expand Up @@ -81,6 +83,13 @@ export default function VectorDatabaseConnection({
description:
"Open source local and cloud hosted multi-modal vector database.",
},
{
name: "Milvus",
value: "milvus",
logo: MilvusLogo,
options: <MilvusOptions settings={settings} />,
description: "Open-source, highly scalable, and blazing fast.",
},
];

function handleForward() {
Expand Down
5 changes: 5 additions & 0 deletions server/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ VECTOR_DB="lancedb"
# QDRANT_ENDPOINT="http://localhost:6333"
# QDRANT_API_KEY=

# Enable all below if you are using vector database: Milvus.
# VECTOR_DB="milvus"
# MILVUS_ADDRESS="http://localhost:19530"
# MILVUS_USERNAME=
# MILVUS_PASSWORD=

# CLOUD DEPLOYMENT VARIRABLES ONLY
# AUTH_TOKEN="hunter2" # This is the password to your application if remote hosting.
Expand Down
7 changes: 7 additions & 0 deletions server/models/systemSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ const SystemSettings = {
QdrantApiKey: process.env.QDRANT_API_KEY,
}
: {}),
...(vectorDB === "milvus"
? {
MilvusAddress: process.env.MILVUS_ADDRESS,
MilvusUsername: process.env.MILVUS_USERNAME,
MilvusPassword: !!process.env.MILVUS_PASSWORD,
}
: {}),
LLMProvider: llmProvider,
...(llmProvider === "openai"
? {
Expand Down
3 changes: 2 additions & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@prisma/client": "5.3.0",
"@qdrant/js-client-rest": "^1.4.0",
"@xenova/transformers": "^2.10.0",
"@zilliz/milvus2-sdk-node": "^2.3.5",
"archiver": "^5.3.1",
"bcrypt": "^5.1.0",
"body-parser": "^1.20.2",
Expand Down Expand Up @@ -77,4 +78,4 @@
"nodemon": "^2.0.22",
"prettier": "^3.0.3"
}
}
}
1 change: 1 addition & 0 deletions server/utils/EmbeddingEngines/azureOpenAi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class AzureOpenAiEmbedder {
new AzureKeyCredential(process.env.AZURE_OPENAI_KEY)
);
this.openai = openai;
this.dimensions = 1536;

// Limit of how many strings we can process in a single pass to stay with resource or network limits
// https://learn.microsoft.com/en-us/azure/ai-services/openai/faq#i-am-trying-to-use-embeddings-and-received-the-error--invalidrequesterror--too-many-inputs--the-max-number-of-inputs-is-1---how-do-i-fix-this-:~:text=consisting%20of%20up%20to%2016%20inputs%20per%20API%20request
Expand Down
4 changes: 4 additions & 0 deletions server/utils/EmbeddingEngines/localAi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class LocalAiEmbedder {
: {}),
});
this.openai = new OpenAIApi(config);
// We don't know this for user's set model so for vectorDB integrations that requires dimensionality
// in schema, we will throw an error.
// Applies to QDrant and Milvus.
this.dimensions = null;

// Limit of how many strings we can process in a single pass to stay with resource or network limits
this.maxConcurrentChunks = 50;
Expand Down
1 change: 1 addition & 0 deletions server/utils/EmbeddingEngines/native/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class NativeEmbedder {
: path.resolve(__dirname, `../../../storage/models`)
);
this.modelPath = path.resolve(this.cacheDir, "Xenova", "all-MiniLM-L6-v2");
this.dimensions = 384;

// Limit of how many strings we can process in a single pass to stay with resource or network limits
this.maxConcurrentChunks = 50;
Expand Down
1 change: 1 addition & 0 deletions server/utils/EmbeddingEngines/openAi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class OpenAiEmbedder {
});
const openai = new OpenAIApi(config);
this.openai = openai;
this.dimensions = 1536;

// Limit of how many strings we can process in a single pass to stay with resource or network limits
this.maxConcurrentChunks = 500;
Expand Down
3 changes: 3 additions & 0 deletions server/utils/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ function getVectorDbClass() {
case "qdrant":
const { QDrant } = require("../vectorDbProviders/qdrant");
return QDrant;
case "milvus":
const { Milvus } = require("../vectorDbProviders/milvus");
return Milvus;
default:
throw new Error("ENV: No VECTOR_DB value found in environment!");
}
Expand Down
23 changes: 22 additions & 1 deletion server/utils/helpers/updateENV.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,20 @@ const KEY_MAPPING = {
checks: [],
},

// Milvus Options
MilvusAddress: {
envKey: "MILVUS_ADDRESS",
checks: [isValidURL, validDockerizedUrl],
},
MilvusUsername: {
envKey: "MILVUS_USERNAME",
checks: [isNotEmpty],
},
MilvusPassword: {
envKey: "MILVUS_PASSWORD",
checks: [isNotEmpty],
},

// Together Ai Options
TogetherAiApiKey: {
envKey: "TOGETHER_AI_API_KEY",
Expand Down Expand Up @@ -279,7 +293,14 @@ function supportedEmbeddingModel(input = "") {
}

function supportedVectorDB(input = "") {
const supported = ["chroma", "pinecone", "lancedb", "weaviate", "qdrant"];
const supported = [
"chroma",
"pinecone",
"lancedb",
"weaviate",
"qdrant",
"milvus",
];
return supported.includes(input)
? null
: `Invalid VectorDB type. Must be one of ${supported.join(", ")}.`;
Expand Down
40 changes: 40 additions & 0 deletions server/utils/vectorDbProviders/milvus/MILVUS_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# How to setup a local (or remote) Milvus Vector Database

[Official Milvus Docs](https://milvus.io/docs/example_code.md) for reference.

### How to get started

**Requirements**

Choose one of the following

- Cloud

- [Cloud account](https://cloud.zilliz.com/)

- Local
- Docker
- `git` available in your CLI/terminal

**Instructions**

- Cloud

- Create a Cluster on your cloud account
- Get connect Public Endpoint and Token
- Set .env.development variable in server

- Local
- Download yaml file `wget https://github.com/milvus-io/milvus/releases/download/v2.3.4/milvus-standalone-docker-compose.yml -O docker-compose.yml`
- Start Milvus `sudo docker compose up -d`
- Check the containers are up and running `sudo docker compose ps`
- Get port number and set .env.development variable in server

eg: `server/.env.development`

```
VECTOR_DB="milvus"
MILVUS_ADDRESS="http://localhost:19530"
MILVUS_USERNAME=minioadmin # Whatever your username and password are
MILVUS_PASSWORD=minioadmin
```
Loading