diff --git a/README.md b/README.md index 65c529b1abe..34a723859b5 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ AnythingLLM divides your documents into objects called `workspaces`. A Workspace - [PGVector](https://github.com/pgvector/pgvector) - [Astra DB](https://www.datastax.com/products/datastax-astra) - [Pinecone](https://pinecone.io) -- [Chroma](https://trychroma.com) +- [Chroma & ChromaCloud](https://trychroma.com) - [Weaviate](https://weaviate.io) - [Qdrant](https://qdrant.tech) - [Milvus](https://milvus.io) diff --git a/docker/.env.example b/docker/.env.example index 48068cfdcbe..dca22fa0493 100644 --- a/docker/.env.example +++ b/docker/.env.example @@ -212,6 +212,12 @@ GID='1000' # CHROMA_API_HEADER="X-Api-Key" # 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. # VECTOR_DB="pinecone" # PINECONE_API_KEY= diff --git a/frontend/src/components/VectorDBSelection/ChromaCloudOptions/index.jsx b/frontend/src/components/VectorDBSelection/ChromaCloudOptions/index.jsx new file mode 100644 index 00000000000..c9c4abc3351 --- /dev/null +++ b/frontend/src/components/VectorDBSelection/ChromaCloudOptions/index.jsx @@ -0,0 +1,53 @@ +export default function ChromaCloudOptions({ settings }) { + return ( +
+
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
+ ); +} diff --git a/frontend/src/pages/GeneralSettings/VectorDatabase/index.jsx b/frontend/src/pages/GeneralSettings/VectorDatabase/index.jsx index 52d15e838e4..864e5533ff8 100644 --- a/frontend/src/pages/GeneralSettings/VectorDatabase/index.jsx +++ b/frontend/src/pages/GeneralSettings/VectorDatabase/index.jsx @@ -24,6 +24,7 @@ import PGVectorLogo from "@/media/vectordbs/pgvector.png"; import LanceDBOptions from "@/components/VectorDBSelection/LanceDBOptions"; import ChromaDBOptions from "@/components/VectorDBSelection/ChromaDBOptions"; +import ChromaCloudOptions from "@/components/VectorDBSelection/ChromaCloudOptions"; import PineconeDBOptions from "@/components/VectorDBSelection/PineconeDBOptions"; import WeaviateDBOptions from "@/components/VectorDBSelection/WeaviateDBOptions"; import QDrantDBOptions from "@/components/VectorDBSelection/QDrantDBOptions"; @@ -133,6 +134,14 @@ export default function GeneralVectorDatabase() { description: "Open source vector database you can host yourself or on the cloud.", }, + { + name: "Chroma Cloud", + value: "chromacloud", + logo: ChromaLogo, + options: , + description: + "Fully managed Chroma cloud service with enterprise features and support.", + }, { name: "Pinecone", value: "pinecone", diff --git a/frontend/src/pages/OnboardingFlow/Steps/DataHandling/index.jsx b/frontend/src/pages/OnboardingFlow/Steps/DataHandling/index.jsx index 67be19cece1..a6e4ab025c1 100644 --- a/frontend/src/pages/OnboardingFlow/Steps/DataHandling/index.jsx +++ b/frontend/src/pages/OnboardingFlow/Steps/DataHandling/index.jsx @@ -271,6 +271,14 @@ export const VECTOR_DB_PRIVACY = { ], 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: { name: "Pinecone", description: [ diff --git a/server/.env.example b/server/.env.example index 03c5382fbd5..0d3d1ecd0e0 100644 --- a/server/.env.example +++ b/server/.env.example @@ -202,6 +202,12 @@ SIG_SALT='salt' # Please generate random string at least 32 chars long. # CHROMA_API_HEADER="X-Api-Key" # 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. # VECTOR_DB="pinecone" # PINECONE_API_KEY= diff --git a/server/models/systemSettings.js b/server/models/systemSettings.js index 961ccc5678c..f0796be0431 100644 --- a/server/models/systemSettings.js +++ b/server/models/systemSettings.js @@ -428,6 +428,11 @@ const SystemSettings = { ChromaApiHeader: process.env.CHROMA_API_HEADER, 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 WeaviateEndpoint: process.env.WEAVIATE_ENDPOINT, WeaviateApiKey: process.env.WEAVIATE_API_KEY, diff --git a/server/utils/helpers/index.js b/server/utils/helpers/index.js index 8fccb4fd768..bff2873b526 100644 --- a/server/utils/helpers/index.js +++ b/server/utils/helpers/index.js @@ -77,7 +77,7 @@ /** * 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} */ function getVectorDbClass(getExactly = null) { @@ -89,6 +89,9 @@ function getVectorDbClass(getExactly = null) { case "chroma": const { Chroma } = require("../vectorDbProviders/chroma"); return Chroma; + case "chromacloud": + const { ChromaCloud } = require("../vectorDbProviders/chromacloud"); + return ChromaCloud; case "lancedb": const { LanceDb } = require("../vectorDbProviders/lance"); return LanceDb; diff --git a/server/utils/helpers/updateENV.js b/server/utils/helpers/updateENV.js index 6bb397c3022..124b4b4e77f 100644 --- a/server/utils/helpers/updateENV.js +++ b/server/utils/helpers/updateENV.js @@ -332,6 +332,20 @@ const KEY_MAPPING = { checks: [], }, + // ChromaCloud Options + ChromaCloudApiKey: { + envKey: "CHROMACLOUD_API_KEY", + checks: [isNotEmpty], + }, + ChromaCloudTenant: { + envKey: "CHROMACLOUD_TENANT", + checks: [isNotEmpty], + }, + ChromaCloudDatabase: { + envKey: "CHROMACLOUD_DATABASE", + checks: [isNotEmpty], + }, + // Weaviate Options WeaviateEndpoint: { envKey: "WEAVIATE_ENDPOINT", @@ -845,6 +859,7 @@ function supportedEmbeddingModel(input = "") { function supportedVectorDB(input = "") { const supported = [ "chroma", + "chromacloud", "pinecone", "lancedb", "weaviate", diff --git a/server/utils/vectorDbProviders/chromacloud/index.js b/server/utils/vectorDbProviders/chromacloud/index.js new file mode 100644 index 00000000000..5f01ee03025 --- /dev/null +++ b/server/utils/vectorDbProviders/chromacloud/index.js @@ -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;