Skip to content

Commit dcf4276

Browse files
docs: Update ChromaDB configuration details for Chroma Cloud support (#4008)
Fixes #4008 Auto-cherry-pick to 1.0.x Signed-off-by: Philip I. Thomas <[email protected]>
1 parent 535e632 commit dcf4276

File tree

1 file changed

+45
-5
lines changed
  • spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs

1 file changed

+45
-5
lines changed

spring-ai-docs/src/main/antora/modules/ROOT/pages/api/vectordbs/chroma.adoc

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ link:https://docs.trychroma.com/[Chroma] is the open-source embedding database.
66

77
== Prerequisites
88

9-
1. Access to ChromeDB. The <<Run Chroma Locally, setup local ChromaDB>> appendix shows how to set up a DB locally with a Docker container.
9+
1. Access to ChromaDB. Compatible with link:https://trychroma.com/signup[Chroma Cloud], or <<run Chroma Locally, setup local ChromaDB>> in the appendix shows how to set up a DB locally with a Docker container.
10+
- For Chroma Cloud: You'll need your API key, tenant name, and database name from your Chroma Cloud dashboard.
11+
- For local ChromaDB: No additional configuration required beyond starting the container.
1012

1113
2. `EmbeddingModel` instance to compute the document embeddings. Several options are available:
1214
- If required, an API key for the xref:api/embeddings.adoc#available-implementations[EmbeddingModel] to generate the embeddings stored by the `ChromaVectorStore`.
@@ -72,12 +74,16 @@ A simple configuration can either be provided via Spring Boot's _application.pro
7274
[source,properties]
7375
----
7476
# Chroma Vector Store connection properties
75-
spring.ai.vectorstore.chroma.client.host=<your Chroma instance host>
76-
spring.ai.vectorstore.chroma.client.port=<your Chroma instance port>
77-
spring.ai.vectorstore.chroma.client.key-token=<your access token (if configure)>
77+
spring.ai.vectorstore.chroma.client.host=<your Chroma instance host> // for Chroma Cloud: api.trychroma.com
78+
spring.ai.vectorstore.chroma.client.port=<your Chroma instance port> // for Chroma Cloud: 443
79+
spring.ai.vectorstore.chroma.client.key-token=<your access token (if configure)> // for Chroma Cloud: use the API key
7880
spring.ai.vectorstore.chroma.client.username=<your username (if configure)>
7981
spring.ai.vectorstore.chroma.client.password=<your password (if configure)>
8082
83+
# Chroma Vector Store tenant and database properties (required for Chroma Cloud)
84+
spring.ai.vectorstore.chroma.tenant-name=<your tenant name> // default: SpringAiTenant
85+
spring.ai.vectorstore.chroma.database-name=<your database name> // default: SpringAiDatabase
86+
8187
# Chroma Vector Store collection properties
8288
spring.ai.vectorstore.chroma.initialize-schema=<true or false>
8389
spring.ai.vectorstore.chroma.collection-name=<your collection name>
@@ -123,8 +129,10 @@ You can use the following properties in your Spring Boot configuration to custom
123129
|`spring.ai.vectorstore.chroma.client.key-token`| Access token (if configured) | -
124130
|`spring.ai.vectorstore.chroma.client.username`| Access username (if configured) | -
125131
|`spring.ai.vectorstore.chroma.client.password`| Access password (if configured) | -
132+
|`spring.ai.vectorstore.chroma.tenant-name`| Tenant (required for Chroma Cloud) | `SpringAiTenant`
133+
|`spring.ai.vectorstore.chroma.database-name`| Database name (required for Chroma Cloud) | `SpringAiDatabase`
126134
|`spring.ai.vectorstore.chroma.collection-name`| Collection name | `SpringAiCollection`
127-
|`spring.ai.vectorstore.chroma.initialize-schema`| Whether to initialize the required schema | `false`
135+
|`spring.ai.vectorstore.chroma.initialize-schema`| Whether to initialize the required schema (creates tenant/database/collection if they don't exist) | `false`
128136
|===
129137

130138
[NOTE]
@@ -134,6 +142,36 @@ For ChromaDB secured with link:https://docs.trychroma.com/usage-guide#static-api
134142
For ChromaDB secured with link:https://docs.trychroma.com/usage-guide#basic-authentication[Basic Authentication] use the `ChromaApi#withBasicAuth(<your user>, <your password>)` method to set your credentials. Check the `BasicAuthChromaWhereIT` for an example.
135143
====
136144

145+
=== Chroma Cloud Configuration
146+
147+
For Chroma Cloud, you need to provide the tenant and database names from your Chroma Cloud instance. Here's an example configuration:
148+
149+
[source,properties]
150+
----
151+
# Chroma Cloud connection
152+
spring.ai.vectorstore.chroma.client.host=api.trychroma.com
153+
spring.ai.vectorstore.chroma.client.port=443
154+
spring.ai.vectorstore.chroma.client.key-token=<your-chroma-cloud-api-key>
155+
156+
# Chroma Cloud tenant and database (required)
157+
spring.ai.vectorstore.chroma.tenant-name=<your-tenant-id>
158+
spring.ai.vectorstore.chroma.database-name=<your-database-name>
159+
160+
# Collection configuration
161+
spring.ai.vectorstore.chroma.collection-name=my-collection
162+
spring.ai.vectorstore.chroma.initialize-schema=true
163+
----
164+
165+
[NOTE]
166+
====
167+
For Chroma Cloud:
168+
- The host should be `api.trychroma.com`
169+
- The port should be `443` (HTTPS)
170+
- You must provide your API key via `key-token`
171+
- The tenant and database names must match your Chroma Cloud configuration
172+
- Set `initialize-schema=true` to automatically create the collection if it doesn't exist (it won't recreate existing tenant/database)
173+
====
174+
137175
== Metadata filtering
138176

139177
You can leverage the generic, portable link:https://docs.spring.io/spring-ai/reference/api/vectordbs.html#_metadata_filters[metadata filters] with ChromaVector store as well.
@@ -238,6 +276,8 @@ Integrate with OpenAI's embeddings by adding the Spring Boot OpenAI starter to y
238276
@Bean
239277
public VectorStore chromaVectorStore(EmbeddingModel embeddingModel, ChromaApi chromaApi) {
240278
return ChromaVectorStore.builder(chromaApi, embeddingModel)
279+
.tenantName("your-tenant-name") // default: SpringAiTenant
280+
.databaseName("your-database-name") // default: SpringAiDatabase
241281
.collectionName("TestCollection")
242282
.initializeSchema(true)
243283
.build();

0 commit comments

Comments
 (0)