mirror of
https://github.com/Mintplex-Labs/anything-llm
synced 2026-04-25 17:15:37 +02:00
Chroma Cloud vector db provider (#4273)
* add chroma cloud as new vector db provider * update docker example env * extend chroma class to chroma cloud * update readme --------- Co-authored-by: timothycarambat <rambat1010@gmail.com>
This commit is contained in:
@@ -136,7 +136,7 @@ AnythingLLM divides your documents into objects called `workspaces`. A Workspace
|
|||||||
- [PGVector](https://github.com/pgvector/pgvector)
|
- [PGVector](https://github.com/pgvector/pgvector)
|
||||||
- [Astra DB](https://www.datastax.com/products/datastax-astra)
|
- [Astra DB](https://www.datastax.com/products/datastax-astra)
|
||||||
- [Pinecone](https://pinecone.io)
|
- [Pinecone](https://pinecone.io)
|
||||||
- [Chroma](https://trychroma.com)
|
- [Chroma & ChromaCloud](https://trychroma.com)
|
||||||
- [Weaviate](https://weaviate.io)
|
- [Weaviate](https://weaviate.io)
|
||||||
- [Qdrant](https://qdrant.tech)
|
- [Qdrant](https://qdrant.tech)
|
||||||
- [Milvus](https://milvus.io)
|
- [Milvus](https://milvus.io)
|
||||||
|
|||||||
@@ -212,6 +212,12 @@ GID='1000'
|
|||||||
# CHROMA_API_HEADER="X-Api-Key"
|
# CHROMA_API_HEADER="X-Api-Key"
|
||||||
# CHROMA_API_KEY="sk-123abc"
|
# CHROMA_API_KEY="sk-123abc"
|
||||||
|
|
||||||
|
# Enable all below if you are using vector database: Chroma Cloud.
|
||||||
|
# VECTOR_DB="chromacloud"
|
||||||
|
# CHROMACLOUD_API_KEY="ck-your-api-key"
|
||||||
|
# CHROMACLOUD_TENANT=
|
||||||
|
# CHROMACLOUD_DATABASE=
|
||||||
|
|
||||||
# Enable all below if you are using vector database: Pinecone.
|
# Enable all below if you are using vector database: Pinecone.
|
||||||
# VECTOR_DB="pinecone"
|
# VECTOR_DB="pinecone"
|
||||||
# PINECONE_API_KEY=
|
# PINECONE_API_KEY=
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
export default function ChromaCloudOptions({ settings }) {
|
||||||
|
return (
|
||||||
|
<div className="w-full flex flex-col gap-y-7">
|
||||||
|
<div className="w-full flex items-center gap-[36px] mt-1.5">
|
||||||
|
<div className="flex flex-col w-60">
|
||||||
|
<label className="text-white text-sm font-semibold block mb-3">
|
||||||
|
API Key
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="password"
|
||||||
|
name="ChromaCloudApiKey"
|
||||||
|
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="ck-your-api-key-here"
|
||||||
|
defaultValue={settings?.ChromaCloudApiKey ? "*".repeat(20) : ""}
|
||||||
|
required={true}
|
||||||
|
autoComplete="off"
|
||||||
|
spellCheck={false}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-col w-60">
|
||||||
|
<label className="text-white text-sm font-semibold block mb-3">
|
||||||
|
Tenant ID
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
name="ChromaCloudTenant"
|
||||||
|
autoComplete="off"
|
||||||
|
type="text"
|
||||||
|
defaultValue={settings?.ChromaCloudTenant}
|
||||||
|
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="your-tenant-id-here"
|
||||||
|
required={true}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-col w-60">
|
||||||
|
<label className="text-white text-sm font-semibold block mb-3">
|
||||||
|
Database Name
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
name="ChromaCloudDatabase"
|
||||||
|
autoComplete="off"
|
||||||
|
type="text"
|
||||||
|
defaultValue={settings?.ChromaCloudDatabase}
|
||||||
|
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="your-database-name"
|
||||||
|
required={true}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ import PGVectorLogo from "@/media/vectordbs/pgvector.png";
|
|||||||
|
|
||||||
import LanceDBOptions from "@/components/VectorDBSelection/LanceDBOptions";
|
import LanceDBOptions from "@/components/VectorDBSelection/LanceDBOptions";
|
||||||
import ChromaDBOptions from "@/components/VectorDBSelection/ChromaDBOptions";
|
import ChromaDBOptions from "@/components/VectorDBSelection/ChromaDBOptions";
|
||||||
|
import ChromaCloudOptions from "@/components/VectorDBSelection/ChromaCloudOptions";
|
||||||
import PineconeDBOptions from "@/components/VectorDBSelection/PineconeDBOptions";
|
import PineconeDBOptions from "@/components/VectorDBSelection/PineconeDBOptions";
|
||||||
import WeaviateDBOptions from "@/components/VectorDBSelection/WeaviateDBOptions";
|
import WeaviateDBOptions from "@/components/VectorDBSelection/WeaviateDBOptions";
|
||||||
import QDrantDBOptions from "@/components/VectorDBSelection/QDrantDBOptions";
|
import QDrantDBOptions from "@/components/VectorDBSelection/QDrantDBOptions";
|
||||||
@@ -133,6 +134,14 @@ export default function GeneralVectorDatabase() {
|
|||||||
description:
|
description:
|
||||||
"Open source vector database you can host yourself or on the cloud.",
|
"Open source vector database you can host yourself or on the cloud.",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Chroma Cloud",
|
||||||
|
value: "chromacloud",
|
||||||
|
logo: ChromaLogo,
|
||||||
|
options: <ChromaCloudOptions settings={settings} />,
|
||||||
|
description:
|
||||||
|
"Fully managed Chroma cloud service with enterprise features and support.",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Pinecone",
|
name: "Pinecone",
|
||||||
value: "pinecone",
|
value: "pinecone",
|
||||||
|
|||||||
@@ -271,6 +271,14 @@ export const VECTOR_DB_PRIVACY = {
|
|||||||
],
|
],
|
||||||
logo: ChromaLogo,
|
logo: ChromaLogo,
|
||||||
},
|
},
|
||||||
|
chromacloud: {
|
||||||
|
name: "Chroma Cloud",
|
||||||
|
description: [
|
||||||
|
"Your vectors and document text are stored on Chroma's cloud service",
|
||||||
|
"Access to your data is managed by Chroma",
|
||||||
|
],
|
||||||
|
logo: ChromaLogo,
|
||||||
|
},
|
||||||
pinecone: {
|
pinecone: {
|
||||||
name: "Pinecone",
|
name: "Pinecone",
|
||||||
description: [
|
description: [
|
||||||
|
|||||||
@@ -202,6 +202,12 @@ SIG_SALT='salt' # Please generate random string at least 32 chars long.
|
|||||||
# CHROMA_API_HEADER="X-Api-Key"
|
# CHROMA_API_HEADER="X-Api-Key"
|
||||||
# CHROMA_API_KEY="sk-123abc"
|
# CHROMA_API_KEY="sk-123abc"
|
||||||
|
|
||||||
|
# Enable all below if you are using vector database: Chroma Cloud.
|
||||||
|
# VECTOR_DB="chromacloud"
|
||||||
|
# CHROMACLOUD_API_KEY="ck-your-api-key"
|
||||||
|
# CHROMACLOUD_TENANT=
|
||||||
|
# CHROMACLOUD_DATABASE=
|
||||||
|
|
||||||
# Enable all below if you are using vector database: Pinecone.
|
# Enable all below if you are using vector database: Pinecone.
|
||||||
# VECTOR_DB="pinecone"
|
# VECTOR_DB="pinecone"
|
||||||
# PINECONE_API_KEY=
|
# PINECONE_API_KEY=
|
||||||
|
|||||||
@@ -428,6 +428,11 @@ const SystemSettings = {
|
|||||||
ChromaApiHeader: process.env.CHROMA_API_HEADER,
|
ChromaApiHeader: process.env.CHROMA_API_HEADER,
|
||||||
ChromaApiKey: !!process.env.CHROMA_API_KEY,
|
ChromaApiKey: !!process.env.CHROMA_API_KEY,
|
||||||
|
|
||||||
|
// ChromaCloud DB Keys
|
||||||
|
ChromaCloudApiKey: !!process.env.CHROMACLOUD_API_KEY,
|
||||||
|
ChromaCloudTenant: process.env.CHROMACLOUD_TENANT,
|
||||||
|
ChromaCloudDatabase: process.env.CHROMACLOUD_DATABASE,
|
||||||
|
|
||||||
// Weaviate DB Keys
|
// Weaviate DB Keys
|
||||||
WeaviateEndpoint: process.env.WEAVIATE_ENDPOINT,
|
WeaviateEndpoint: process.env.WEAVIATE_ENDPOINT,
|
||||||
WeaviateApiKey: process.env.WEAVIATE_API_KEY,
|
WeaviateApiKey: process.env.WEAVIATE_API_KEY,
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the systems current vector database provider.
|
* Gets the systems current vector database provider.
|
||||||
* @param {('pinecone' | 'chroma' | 'lancedb' | 'weaviate' | 'qdrant' | 'milvus' | 'zilliz' | 'astra') | null} getExactly - If provided, this will return an explit provider.
|
* @param {('pinecone' | 'chroma' | 'chromacloud' | 'lancedb' | 'weaviate' | 'qdrant' | 'milvus' | 'zilliz' | 'astra') | null} getExactly - If provided, this will return an explit provider.
|
||||||
* @returns { BaseVectorDatabaseProvider}
|
* @returns { BaseVectorDatabaseProvider}
|
||||||
*/
|
*/
|
||||||
function getVectorDbClass(getExactly = null) {
|
function getVectorDbClass(getExactly = null) {
|
||||||
@@ -89,6 +89,9 @@ function getVectorDbClass(getExactly = null) {
|
|||||||
case "chroma":
|
case "chroma":
|
||||||
const { Chroma } = require("../vectorDbProviders/chroma");
|
const { Chroma } = require("../vectorDbProviders/chroma");
|
||||||
return Chroma;
|
return Chroma;
|
||||||
|
case "chromacloud":
|
||||||
|
const { ChromaCloud } = require("../vectorDbProviders/chromacloud");
|
||||||
|
return ChromaCloud;
|
||||||
case "lancedb":
|
case "lancedb":
|
||||||
const { LanceDb } = require("../vectorDbProviders/lance");
|
const { LanceDb } = require("../vectorDbProviders/lance");
|
||||||
return LanceDb;
|
return LanceDb;
|
||||||
|
|||||||
@@ -332,6 +332,20 @@ const KEY_MAPPING = {
|
|||||||
checks: [],
|
checks: [],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// ChromaCloud Options
|
||||||
|
ChromaCloudApiKey: {
|
||||||
|
envKey: "CHROMACLOUD_API_KEY",
|
||||||
|
checks: [isNotEmpty],
|
||||||
|
},
|
||||||
|
ChromaCloudTenant: {
|
||||||
|
envKey: "CHROMACLOUD_TENANT",
|
||||||
|
checks: [isNotEmpty],
|
||||||
|
},
|
||||||
|
ChromaCloudDatabase: {
|
||||||
|
envKey: "CHROMACLOUD_DATABASE",
|
||||||
|
checks: [isNotEmpty],
|
||||||
|
},
|
||||||
|
|
||||||
// Weaviate Options
|
// Weaviate Options
|
||||||
WeaviateEndpoint: {
|
WeaviateEndpoint: {
|
||||||
envKey: "WEAVIATE_ENDPOINT",
|
envKey: "WEAVIATE_ENDPOINT",
|
||||||
@@ -845,6 +859,7 @@ function supportedEmbeddingModel(input = "") {
|
|||||||
function supportedVectorDB(input = "") {
|
function supportedVectorDB(input = "") {
|
||||||
const supported = [
|
const supported = [
|
||||||
"chroma",
|
"chroma",
|
||||||
|
"chromacloud",
|
||||||
"pinecone",
|
"pinecone",
|
||||||
"lancedb",
|
"lancedb",
|
||||||
"weaviate",
|
"weaviate",
|
||||||
|
|||||||
29
server/utils/vectorDbProviders/chromacloud/index.js
Normal file
29
server/utils/vectorDbProviders/chromacloud/index.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
const { CloudClient } = require("chromadb");
|
||||||
|
const { Chroma } = require("../chroma");
|
||||||
|
|
||||||
|
// ChromaCloud works exactly the same as Chroma so we can just extend the
|
||||||
|
// Chroma class and override the connect method to use CloudClient
|
||||||
|
|
||||||
|
const ChromaCloud = {
|
||||||
|
...Chroma,
|
||||||
|
name: "ChromaCloud",
|
||||||
|
connect: async function () {
|
||||||
|
if (process.env.VECTOR_DB !== "chromacloud")
|
||||||
|
throw new Error("ChromaCloud::Invalid ENV settings");
|
||||||
|
|
||||||
|
const client = new CloudClient({
|
||||||
|
apiKey: process.env.CHROMACLOUD_API_KEY,
|
||||||
|
tenant: process.env.CHROMACLOUD_TENANT,
|
||||||
|
database: process.env.CHROMACLOUD_DATABASE,
|
||||||
|
});
|
||||||
|
|
||||||
|
const isAlive = await client.heartbeat();
|
||||||
|
if (!isAlive)
|
||||||
|
throw new Error(
|
||||||
|
"ChromaCloud::Invalid Heartbeat received - is the instance online?"
|
||||||
|
);
|
||||||
|
return { client };
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.ChromaCloud = ChromaCloud;
|
||||||
Reference in New Issue
Block a user