📦Chromadb

Chromadb

This is the default database used when no vectordb is specified . We create a temp directory and persist the embeddings there using the PersistentClient of Chromadb by default.

This is for experimentation purposes when the user wants a quick headstart and wants to experiment with things quickly.

Compulsory arguments:

  • class_name => The name of the index under which documents are stored

Here are some sample configurations:

=> Chromadb with embedding specification

"vectordb": {
    "name": "chromadb",
    "class_name": "genai_stack",
    "embedding": {
        "name": "HuggingFaceEmbeddings",
        "fields": {
            "model_name": "sentence-transformers/all-mpnet-base-v2",
            "model_kwargs": { "device": "cpu" }
        }
    }
}

==> Chromadb without embedding specification. Without any embedding specification we use the default embedding which is HuggingFaceEmbeddings

"vectordb": {
    "name": "chromadb",
    "class_name": "genai_stack"
}

Python Usage:

from genai_stack.vectordb.chromadb import ChromaDB

config = {"class_name": "MyIndexName"}
vectordb = ChromaDB.from_kwargs(config)
vectordb.search("Your question")

# Output 
# <Documents closest to your question>

Last updated