Description
A Client for 'ChromaDB'.
Description
Client for 'ChromaDB', a vector database for storing and querying embeddings. This package provides a convenient interface to interact with the REST API of 'ChromaDB' <https://docs.trychroma.com>.
README.md
rchroma 
rchroma provides a clean interface to ChromaDB, a modern vector database for storing and querying embeddings.
Installation
You can install rchroma from GitHub:
# install.packages("remotes")
remotes::install_github("cynkra/rchroma")
You also need a running ChromaDB instance. The easiest way to get started is using Docker:
docker pull chromadb/chroma
docker run -p 8000:8000 chromadb/chroma
See the ChromaDB documentation for other installation methods.
Usage
library(rchroma)
# Connect to ChromaDB
client <- chroma_connect()
# Create a collection and add documents with embeddings
create_collection(client, "my_collection")
add_documents(
client,
"my_collection",
documents = c("apple", "banana"),
ids = c("doc1", "doc2"),
embeddings = list(
c(1.0, 0.0), # apple
c(0.8, 0.2) # banana (similar to apple)
)
)
# Query similar documents using embeddings
query(
client,
"my_collection",
query_embeddings = list(c(1.0, 0.0)), # should match apple best
n_results = 2
)