Skip to content

Chroma: add the MEVD provider - #58

Open
Laurianti wants to merge 4 commits into
CommunityToolkit:mainfrom
Laurianti:chroma-provider
Open

Laurianti wants to merge 4 commits into
CommunityToolkit:mainfrom
Laurianti:chroma-provider

Conversation

@Laurianti

@Laurianti Laurianti commented Oct 6, 2026 •

Copy link
Copy Markdown

Adds CommunityToolkit.VectorData.Chroma, the Chroma provider proposed in #57, with MEVD/test/Chroma.UnitTests and MEVD/test/Chroma.ConformanceTests. It follows the layout of the Qdrant provider, and builds on ChromaDotNet.Client as Qdrant builds on Qdrant.Client. I maintain ChromaDotNet.Client.

The conformance tests start chromadb/chroma:1.5.9 with Testcontainers, so the mevd.yml matrix picks them up. Chroma stores exactly one embedding per record, so there are no multi-vector and no-vector model tests. The hybrid search tests need Chroma Cloud: they run when Chroma:ConnectionString points to it, as the README of the tests says, and are skipped otherwise.

The same code, published as ChromaDotNet.VectorData 0.4.2, runs the Semantic Kernel and Agent Framework samples, and the Semantic Kernel hybrid search sample runs on Chroma Cloud.

The container is written in the tests, as for Weaviate. When Testcontainers.Chroma ships (testcontainers/testcontainers-dotnet#1784), it can replace it.

With the Aspire integration proposed in CommunityToolkit/Aspire#2219, builder.AddChromaClient("chroma") registers the ChromaClient that AddChromaVectorStore() takes from the container.

tryAGI/LangChain.Databases#180 adds Chroma to the tests of LangChain .NET with the same provider, and moves to this package when it ships.

.gitignore gets testsettings.*.json: the conformance tests READMEs, the PgVector one included, describe testsettings.development.json as git-ignored.

Fixes #57

Copilot AI balanced review requested due to automatic review settings October 6, 2026 21:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Client reference leaks, non-idempotent disposal, and incorrect nullable-filter negation can cause resource and query failures.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity · 1 Low severity

Open (4)
What changed in this PR

Adds the Chroma MEVD provider, including mapping, filtering, vector/hybrid search, dependency injection, and test infrastructure.

Changes:

  • Implements the Chroma vector store and collection APIs.
  • Adds unit and container-based conformance tests.
  • Integrates Chroma into dependencies, solutions, and documentation.
File Description
README.md Lists the Chroma package.
MEVD/​test/​Chroma.UnitTests/​FakeEmbeddingGenerator.cs Adds a test embedding generator.
MEVD/​test/​Chroma.UnitTests/​ChromaVectorStoreTests.cs Tests vector-store behavior.
MEVD/​test/​Chroma.UnitTests/​ChromaMapperTests.cs Tests record mapping.
MEVD/​test/​Chroma.UnitTests/​ChromaHotel.cs Defines unit-test models.
MEVD/​test/​Chroma.UnitTests/​ChromaFilterTranslatorTests.cs Tests filter translation.
MEVD/​test/​Chroma.UnitTests/​ChromaCollectionTests.cs Tests collection operations.
MEVD/​test/​Chroma.UnitTests/​ChromaCollectionSearchMappingTests.cs Tests score conversion.
MEVD/​test/​Chroma.UnitTests/​ChromaCollectionCreateMappingTests.cs Tests collection definitions.
MEVD/​test/​Chroma.UnitTests/​Chroma.UnitTests.csproj Configures unit tests.
MEVD/​test/​Chroma.UnitTests/​.editorconfig Configures test analyzers.
MEVD/​test/​Chroma.ConformanceTests/​TypeTests/​ChromaKeyTypeTests.cs Covers supported keys.
MEVD/​test/​Chroma.ConformanceTests/​TypeTests/​ChromaEmbeddingTypeTests.cs Covers embedding types.
MEVD/​test/​Chroma.ConformanceTests/​TypeTests/​ChromaDataTypeTests.cs Covers metadata types.
MEVD/​test/​Chroma.ConformanceTests/​testsettings.json Provides test configuration.
MEVD/​test/​Chroma.ConformanceTests/​Support/​ChromaTestStore.cs Manages Chroma test instances.
MEVD/​test/​Chroma.ConformanceTests/​Support/​ChromaTestEnvironment.cs Loads test settings.
MEVD/​test/​Chroma.ConformanceTests/​Support/​ChromaFixture.cs Defines the shared fixture.
MEVD/​test/​Chroma.ConformanceTests/​README.md Documents conformance testing.
MEVD/​test/​Chroma.ConformanceTests/​ModelTests/​ChromaNoDataModelTests.cs Tests no-data models.
MEVD/​test/​Chroma.ConformanceTests/​ModelTests/​ChromaDynamicModelTests.cs Tests dynamic models.
MEVD/​test/​Chroma.ConformanceTests/​ModelTests/​ChromaBasicModelTests.cs Tests basic models.
MEVD/​test/​Chroma.ConformanceTests/​ChromaTestSuiteImplementationTests.cs Verifies suite coverage.
MEVD/​test/​Chroma.ConformanceTests/​ChromaIndexKindTests.cs Tests index support.
MEVD/​test/​Chroma.ConformanceTests/​ChromaHybridSearchTests.cs Tests cloud hybrid search.
MEVD/​test/​Chroma.ConformanceTests/​ChromaFilterTests.cs Tests filtering behavior.
MEVD/​test/​Chroma.ConformanceTests/​ChromaEmbeddingGenerationTests.cs Tests generated embeddings.
MEVD/​test/​Chroma.ConformanceTests/​ChromaDistanceFunctionTests.cs Tests distance functions.
MEVD/​test/​Chroma.ConformanceTests/​ChromaDependencyInjectionTests.cs Tests DI registrations.
MEVD/​test/​Chroma.ConformanceTests/​ChromaCollectionManagementTests.cs Tests collection management.
MEVD/​test/​Chroma.ConformanceTests/​Chroma.ConformanceTests.csproj Configures conformance tests.
MEVD/​src/​Chroma/​SharedChromaClient.cs Adds shared-client ownership.
MEVD/​src/​Chroma/​README.md Documents the provider.
MEVD/​src/​Chroma/​ChromaVectorStoreOptions.cs Defines store options.
MEVD/​src/​Chroma/​ChromaVectorStore.cs Implements the vector store.
MEVD/​src/​Chroma/​ChromaServiceCollectionExtensions.cs Adds DI extensions.
MEVD/​src/​Chroma/​ChromaModelBuilder.cs Validates collection models.
MEVD/​src/​Chroma/​ChromaMapper.cs Maps records and metadata.
MEVD/​src/​Chroma/​ChromaFilterTranslator.cs Translates LINQ filters.
MEVD/​src/​Chroma/​ChromaFieldMapping.cs Maps keys and documents.
MEVD/​src/​Chroma/​ChromaDynamicCollection.cs Adds dynamic collections.
MEVD/​src/​Chroma/​ChromaConstants.cs Defines provider constants.
MEVD/​src/​Chroma/​ChromaCollectionSearchMapping.cs Maps distances and thresholds.
MEVD/​src/​Chroma/​ChromaCollectionOptions.cs Defines collection options.
MEVD/​src/​Chroma/​ChromaCollectionCreateMapping.cs Maps collection schemas.
MEVD/​src/​Chroma/​ChromaCollection.cs Implements CRUD and search.
MEVD/​src/​Chroma/​Chroma.csproj Configures the provider package.
MEVD/​src/​Chroma/​AssemblyInfo.cs Adds assembly licensing.
MEVD/​MEVD.slnf Includes Chroma projects.
Directory.Packages.props Adds the Chroma client version.
CommunityToolkit.AI.slnx Includes Chroma projects.
.gitignore Ignores local test settings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread MEVD/src/Chroma/SharedChromaClient.cs
Comment thread MEVD/src/Chroma/ChromaFilterTranslator.cs Outdated
Comment thread MEVD/src/Chroma/ChromaVectorStore.cs Outdated
Comment thread MEVD/src/Chroma/ChromaVectorStoreOptions.cs Outdated
Laurianti added a commit to ChromaDotNet/ChromaDB.VectorData that referenced this pull request Oct 6, 2026
… does

The NativeAOT compiler of .NET 10.0.12 fails on the state machine of the handler when RunOperationAsync returns its task: "VTable ... not computed by the IL scanner".
Laurianti added a commit to ChromaDotNet/ChromaDB.VectorData that referenced this pull request Oct 6, 2026
Laurianti added a commit to ChromaDotNet/ChromaDB.VectorData that referenced this pull request Oct 6, 2026
The README says where the provider goes next, CommunityToolkit/AI#58, and what happens to this package then.
Laurianti added a commit to ChromaDotNet/ChromaDB.VectorData that referenced this pull request Oct 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Model validation must reject Chroma’s reserved Search API keys as data-property storage names.

1 open finding
4 resolved since last review

🧠 Review effort: Balanced

Comment on lines +36 to +40
protected override void ValidateProperty(PropertyModel propertyModel, VectorStoreCollectionDefinition? definition)
{
base.ValidateProperty(propertyModel, definition);

switch (propertyModel)

@adamsitnik adamsitnik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, big thanks for your contribution @Laurianti

The provider follows established conventions closely enough that I consider this ready to merge. I found two nits myself and used LLM to find one minor bug. As soon as they are addressed, we should be ready to ship.

Again, thank you!

Comment thread MEVD/src/Chroma/Chroma.csproj Outdated
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>1.0.0-preview.1</Version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: for other projects, like Sqlvec, we use X.Y.Z-preview version number:

<Version>1.0.2-preview</Version>

Suggested change
<Version>1.0.0-preview.1</Version>
<Version>1.0.0-preview</Version>

It allows us to release small patches without bumping preview version number.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 1141099.

var recordIndex = 0;
foreach (var record in records)
{
if (keyProperty.IsAutoGenerated && keyProperty.GetValue<Guid>(record) == Guid.Empty)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chroma (unlike Qdrant) supports string keys, and ChromaModelBuilder.ValidateKeyProperty doesn't reject IsAutoGenerated=true on a string key. So we can get InvalidCastException here.

A fix would be to add similar check to ChromaModelBuilder

// All .NET types are supported by the InMemory provider, but we support auto-generation of keys only for GUIDs
if (keyProperty.IsAutoGenerated && keyProperty.Type != typeof(Guid))
{
throw new NotSupportedException(
$"Auto-generation is only supported for key properties of type Guid. Property '{keyProperty.ModelName}' has type '{keyProperty.Type.Name}'.");
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 7791e1c: ChromaModelBuilder now rejects IsAutoGenerated on a string key, as InMemoryModelBuilder does.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could reuse MEVD/test/InMemory.UnitTests/FakeEmbeddingGenerator.cs instead of adding new utility here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in e74ad96: the tests use the one in InMemory.UnitTests.

Laurianti added a commit to ChromaDotNet/.github that referenced this pull request Oct 7, 2026
@Laurianti

Copy link
Copy Markdown
Author

Thanks @adamsitnik! The three points are addressed, one commit each.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a Chroma provider (CommunityToolkit.VectorData.Chroma)

3 participants