⚙️ Running ChromaDB
ℹ Chroma can be run in-memory in Python (without Docker), but this feature is not yet available in other languages. To use this library you either need a hosted or local version of ChromaDB running.
If you can run docker-compose up -d --build you can run Chroma.
git clone https://github.com/chroma-core/chroma.git
cd chroma
# Run a ChromaDB instance at localhost:8000
docker-compose up -d --build
More information about deploying Chroma to production can be found here.
🚀 Installing the library
cargo add chromadb
The library crate can be found at crates.io.
📖 Documentation
The library reference can be found here.
🔍 Overview
The library provides 2 modules to interact with the ChromaDB server via API V1:
client- To interface with the ChromaDB server.collection- To interface with an associated ChromaDB collection.
You can connect to ChromaDB by instantiating a ChromaClient
use ChromaClient;
use ;
use json;
// With default ChromaClientOptions
// Defaults to http://localhost:8000
let client: ChromaClient = new;
// With custom ChromaClientOptions
let client: ChromaClient = new;
Now that a client is instantiated, we can interface with the ChromaDB server.
// Get or create a collection with the given name and no metadata.
let collection: ChromaCollection = client.get_or_create_collection.await?;
// Get the UUID of the collection
let collection_uuid = collection.id;
println!;
With a collection instance, we can perform queries on the database
// Upsert some embeddings with documents and no metadata.
let collection_entries = CollectionEntries ;
let result: bool = collection.upsert.await?;
// Create a filter object to filter by document content.
let where_document = json!;
// Get embeddings from a collection with filters and limit set to 1.
// An empty IDs vec will return all embeddings.
let get_query = GetQuery ;
let get_result: GetResult = collection.get.await?;
println!;
Find more information about the available filters and options in the get() documentation.
⚖️ LICENSE
MIT © Anush008