vector stores
. For detailed documentation of all Chroma
features and configurations head to the API reference.
Chroma CloudChroma Cloud powers serverless vector and full-text search. It’s extremely fast, cost-effective, scalable and painless. Create a DB and try it out in under 30 seconds with $5 of free credits.Get started with Chroma Cloud
Overview
Integration details
Class | Package | PY support | Version |
---|---|---|---|
Chroma | @langchain/community | ✅ |
Setup
To use Chroma vector stores, you’ll need to install the@langchain/community
integration package along with the Chroma JS SDK as a peer dependency.
This guide will also use OpenAI embeddings, which require you to install the @langchain/openai
integration package. You can also use other supported embeddings models if you wish.
chromadb
package:
Credentials
If you are running Chroma locally, you do not need to provide any credentials. If you are a Chroma Cloud user, set yourCHROMA_TENANT
, CHROMA_DATABASE
, and CHROMA_API_KEY
environment variables.
The Chroma CLI can set these for you. First, login via the CLI, and then use the connect
command:
Instantiation
Setup your embedding function
First, choose your embedding function. Here we useOpenAIEmbeddings
:
Running Locally
A simpleChroma
instantiation will connect to a Chroma server running locally on http://localhost:8000
:
host
, port
and whether to connect using ssl
:
Chroma Cloud
To connect to Chroma Cloud, provide yourtenant
, database
, and chromaCloudAPIKey
:
Manage vector store
Add items to vector store
Delete items from vector store
You can delete documents from Chroma by id as follows:Query vector store
Once your vector store has been created and the relevant documents have been added you will most likely wish to query it during the running of your chain or agent.Query directly
Performing a simple similarity search can be done as follows:Query by turning into retriever
You can also transform the vector store into a retriever for easier usage in your chains.Usage for retrieval-augmented generation
For guides on how to use this vector store for retrieval-augmented generation (RAG), see the following sections:API reference
For detailed documentation of allChroma
features and configurations head to the API reference