Chroma Vector Database

repository·main·Indexed 12 days ago

https://github.com/chroma-core/chroma

An open-source data infrastructure for AI designed as a vector database to store and query embeddings. It supports in-memory prototyping, persistent storage, and a hosted cloud service. The ecosystem includes JavaScript/TypeScript clients via the `chromadb` bundled package and the `chromadb-client` lightweight package, supporting various embedding providers such as OpenAI, Cohere, and Ollama.

Tokens
230.2K
Snippets
708
Records
983
Agent score
94%

What's inside Chroma

  1. Overview of Chroma capabilities

    main

    Chroma is an open-source data infrastructure for AI designed for retrieval tasks. It provides the following core capabilities:

    • Document Storage: Store documents alongside their associated metadata.
    • Embeddings: Support for various embedding models including OpenAI, Cohere, Hugging Face, and sentence-transformers.
    • Vector Search: Support for dense, sparse, and hybrid search strategies, allowing you to combine multiple search methods.
    • Full-Text & Regex Search: Perform keyword and regular expression searches over your data without requiring embeddings.
    • Metadata Filtering: Apply metadata conditions at query time to filter search results.
    • Multi-Modal Retrieval: Index and search across different modalities such as images and audio in addition to text.
  2. Chroma client production features

    main

    The Chroma Rust client includes production-ready features:

    • Rate Limiting & Retries: Optional automatic handling of rate limiting and backoff/retry for Chroma Cloud and compatible implementations.
    • Observability: Support for the OpenTelemetry standard via the metrics feature.
  3. Module Architecture and Components

    main

    The Sparse Index module is organized into three primary functional areas:

    • Types (types.rs): Handles low-level utilities, such as encoding/decoding dimension IDs as base64 strings and managing special storage prefixes.
    • Writer (writer.rs): Manages data ingestion. Includes SparseDelta for accumulating changes (creates/deletes), SparseWriter for managing the write process, and SparseFlusher for final commits.
    • Reader (reader.rs): Manages data retrieval. Includes SparseReader for access, Cursor for tracking positions in posting lists, and Score for representing results (document offset and similarity score).
  4. Choose a Chroma deployment mode

    main

    Chroma offers three deployment modes depending on your scale and requirements. The API remains consistent across all modes, allowing you to transition from prototyping to production easily.

    • Local: An embedded library ideal for prototyping and experimentation.
    • Single-Node: A single server suitable for small to medium workloads (typically < 10 million records across a few collections).
    • Distributed: A scalable multi-service deployment designed for large production workloads and millions of collections.

    Chroma Cloud is the managed version of the Distributed architecture.

  5. Generate custom benchmarks and compare results

    main

    The Generative Benchmarking toolkit allows you to create custom benchmarks tailored to your specific data and use cases, and subsequently compare metrics to evaluate different embedding models or configurations.

    Key components include:

    • generate_benchmark.ipynb: A guide for generating custom benchmarks from your own data.
    • compare.ipynb: A framework for comparing benchmark results.
    • functions/: Contains the underlying functions for running notebooks, including various embedding functions and LLM prompts.
    • data/: Contains example data for testing the notebooks.
    • results/: The destination for saving benchmark results.
  6. Explore Chroma APIs

    main

    Chroma provides different API surfaces depending on your use case:

    • Chroma API: Use this to programmatically access self-hosted deployments or Chroma Cloud databases.
    • Sync API: Use this to synchronize GitHub repositories and websites directly to Chroma Cloud collections.
    • Embeddings API: Use this to generate dense and sparse embeddings using your Chroma Cloud API key.
  7. Supported Chroma Sync Source Types

    main

    Chroma Sync supports the following source types:

    • S3 buckets: Sync files from Amazon S3, with optional auto-sync on upload.
    • GitHub repositories: Sync code from public or private repos, with diff-based incremental updates.
    • Web: Crawl and ingest websites starting from a seed URL.
    • File upload: Upload individual files directly via the dashboard or the API.
  8. Overview of Chroma Index Types and Default Behaviors

    main

    Chroma's Schema system recognizes six value types, each with an associated index type. If you do not provide a specific Schema, collections use these built-in defaults:

    Config ClassValue TypeDefault BehaviorUse Case
    StringInvertedIndexConfigstringEnabled for all metadataFilter on string values
    FtsIndexConfigstringEnabled for K.DOCUMENT onlyFull-text search on documents
    VectorIndexConfigfloat_listEnabled for K.EMBEDDING onlySimilarity search on embeddings
    SparseVectorIndexConfigsparse_vectorDisabled (requires config)Keyword-based search
    IntInvertedIndexConfigint_valueEnabled for all metadataFilter on integer values
    FloatInvertedIndexConfigfloat_valueEnabled for all metadataFilter on float values
    BoolInvertedIndexConfigbooleanEnabled for all metadataFilter on boolean values
  9. Overview of the Search API

    main

    The Search API is a unified, expression-based interface for hybrid search operations in Chroma Cloud. It replaces the separate query() and get() methods with a single, composable API that supports vector similarity, metadata filtering, and custom ranking expressions.

    Key Features:

    • Unified Interface: Replaces query() and get().
    • Expression-based Queries: Uses K() expressions for filtering and field selection.
    • Composable Operations: Chain methods like .where(), .limit(), and .select().
    • Advanced Capabilities: Supports hybrid search with RRF (Reciprocal Rank Fusion), custom ranking, and batch operations.
    • Flexible Result Selection: Precisely choose which fields to return to reduce payload size.
    IMPORTANT

    The Search API is currently available in Chroma Cloud only. Support for single-node/local Chroma is planned for a future release.

  10. What is Schema and why use it?

    main

    Schema provides fine-grained control over index configuration for Chroma collections. It allows you to manage which indexes are created for different data types, enabling you to:

    • Enable Hybrid Search: Combine dense and sparse embeddings for improved retrieval.
    • Optimize Performance: Disable unused indexes to speed up write operations and reduce index build times.
    • Fine-Tune Configuration: Adjust vector index parameters specifically for your workload.

    By default, collections include sensible defaults: inverted indexes for scalar types, vector indexes for embeddings, and full-text search indexes for documents. You can apply configurations globally to all metadata keys of a certain type or override them for specific keys.