Estrada.ChromaDB.Repositories
0.1.3-alpha
dotnet add package Estrada.ChromaDB.Repositories --version 0.1.3-alpha
NuGet\Install-Package Estrada.ChromaDB.Repositories -Version 0.1.3-alpha
<PackageReference Include="Estrada.ChromaDB.Repositories" Version="0.1.3-alpha" />
<PackageVersion Include="Estrada.ChromaDB.Repositories" Version="0.1.3-alpha" />
<PackageReference Include="Estrada.ChromaDB.Repositories" />
paket add Estrada.ChromaDB.Repositories --version 0.1.3-alpha
#r "nuget: Estrada.ChromaDB.Repositories, 0.1.3-alpha"
#:package Estrada.ChromaDB.Repositories@0.1.3-alpha
#addin nuget:?package=Estrada.ChromaDB.Repositories&version=0.1.3-alpha&prerelease
#tool nuget:?package=Estrada.ChromaDB.Repositories&version=0.1.3-alpha&prerelease
🚀 dotnet-chroma-repositories
Lightweight ChromaDB repository SDK for .NET that wraps around the Semantic Kernel Microsoft.SemanticKernel.Connectors.Chroma (for now).
This is the repository for the Estrada.ChromaDB.Repositories NuGet package. 🎉
📋 Table of Contents
- What's in the Box
- ⚠️ Important Notes
- 🔍 How Does It Work
- 📚 Class Details
- 🛠️ How to Use
- 📖 Implementation Sample
📦 What's in the Box
- 🏗️ A lightweight framework that splits the Chroma data model into COLLECTIONS and CHUNKS, enabling more C#-friendly interactions with Chroma data.
- 📚 A repository template of
<TCollection, TChunk>for seamless access to Chroma and easy manipulation of these structures. - 🔧 A default implementation sample, ready to register, inject, and use.
- ✨ Additional features missing from the Microsoft.SemanticKernel.Connectors.Chroma package:
- 📄 Document property binding
- 🔍 Metadata filtering
- 📄 Pagination options
⚠️ Important Notes
Prerequisites:
- Package Version:
Microsoft.SemanticKernel.Connectors.Chroma --version 1.74.0-alpha- Chroma Image: Use exactly
chromadb/chroma:0.4.24- Docker Command:
docker run --name local-chroma-container -v ./chroma-data:/data -p XXXX:8000 chromadb/chroma:0.4.24
📝 Notes:
- Future versions plan to remove the Semantic Kernel dependency, but it's required for now.
- Use a Docker volume to persist Chroma data. Create a local folder as a 'bridge' to the container and run the command from there.
🔍 How Does It Work
The SDK utilizes these core classes to handle ChromaDB data:
- COLLECTION: A grouping structure for chunks and summary/common data.
- CHUNK: A unit of data associated with a collection. May include an embedding or be text-only.
- METADATA: Maps Chroma metadata to a typed class, defining the shape of a chunk or collection.
- REPOSITORY: The Chroma connector, handling access and defining types for
TColandTChunk.
🏗️ Structures Hierarchy
- Repository<
TCol,TChunk> of:- Collections<
TCol> with:- 1 x CollectionMetadata<
TCol> - N x Chunks<
TChunk> with:- 1 x ChunkMetadata<
TChunk>
- 1 x ChunkMetadata<
- 1 x CollectionMetadata<
- Collections<
📚 Class Details
| Class | Description |
|---|---|
| COLLECTIONS 🗂️ | Data structure holding summary data common to all collection chunks.<br>- Always the first chunk (ID = 0).<br>- No text embedding, only a description.<br>- Stores: Model + Dimensions, Total Chunks, Type & Chunk Type. |
| CHUNKS 📄 | Pieces of data to query, with desired shape/metadata.<br>- ID assigned on creation.<br>- May or may not have embeddings.<br>- Includes DefaultMetadata class for typed access. |
| METADATA 🏷️ | Maps metadata to C# classes, defining chunk/collection shapes.<br>- Used in constructors for deserialization.<br>- Ensures correct key mapping via AddMetadata. |
| REPOSITORIES 🔌 | Connects to Chroma, reshapes data per types.<br>- Isolates client access.<br>- Includes extensions for filtering, document binding, pagination. |
Note: Collections and Chunks have distinct Metadata classes. Extend
CollectionMetadata&ChunkMetadataaccordingly.
🛠️ How to Use
Let's create a repository for embedding multiple files in the same collection. 📁
Step 0: Setup
Use the AddChromaClient and optionally AddChromaConfiguration startup extensions to register the client and inject ChromaSettings from appsettings.json. Also, register your repo.
Steps:
Create Collection Class 📂<br>Create a class inheriting from
ChromaCollection(e.g.,ChromaFilesCollection).Create Collection Metadata 🏷️<br>Inherit from
ChromaCollectionMetadata(e.g.,FilesCollectionMetadata).Create Chunk Class 📄<br>Inherit from
ChromaChunk(e.g.,ChromaFileChunk).Create Chunk Metadata 🏷️<br>Inherit from
ChromaMetadata(e.g.,FileChunkMetadata).Create Repository 🔌<br>Inherit from
ChromaRepository<TCol, TChunk>(e.g.,ChromaFilesRepository<ChromaFilesCollection, ChromaFileChunk>).<br>Recommended: Create an interface extendingIChromaRepository<TCol, TChunk>.Create Enum 🔢<br>Define an enum for TYPE and CHUNK_TYPE (start from 2 to avoid reserved values 0 and 1).
enum EChunkType { FILE = 2, CUSTOMER_REVIEWS = 3, // ... }- Collections get TYPE = 'COLLECTION' and CHUNK_TYPE from your enum.
- Chunks get TYPE = your enum value for filtering.
Tip: Use
DefaultChunk(string collectionName)for new chunks with predefined settings.
📖 Implementation Sample
This repository originates the package and serves as a sample implementation: dotnet-llamasharp
It demonstrates handling Files, Chats, and System messages for a RAG application using the package's Default Implementation for generic file inspection.
Made with ❤️ for the .NET community. Grab your copy, use it, modify it or do whatever you want with it.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Configuration (>= 10.0.7)
- Microsoft.Extensions.DependencyInjection (>= 10.0.2)
- Microsoft.Extensions.Options (>= 10.0.7)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.0)
- Microsoft.SemanticKernel.Connectors.Chroma (>= 1.74.0-alpha)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.3-alpha | 49 | 5/12/2026 |
| 0.1.2-alpha | 45 | 5/12/2026 |
| 0.1.1-alpha | 44 | 5/12/2026 |
| 0.1.0-alpha | 50 | 5/11/2026 |