Skip to content

[04-chromadb] Connect to Chroma 1.x with ChromaDotNet.Client - #72

Merged
El Bruno (elbruno) merged 1 commit into
Azure-Samples:mainfrom
Laurianti:fix-04-chromadb-client
Oct 27, 2026
Merged

El Bruno (elbruno) merged 1 commit into
Azure-Samples:mainfrom
Laurianti:fix-04-chromadb-client

Conversation

@Laurianti

@Laurianti Federico Laurianti (Laurianti) commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Scenario 04-chromadb cannot reach Chroma: GetOrCreateCollection fails with NotFound, so the semantic search has no collection.

  • Products moves from ChromaDB.Client 1.0.1-ci-13369893450 to ChromaDotNet.Client 2.14.0, which uses the v2 API of Chroma 1.x. ChromaDB.Client is deprecated on NuGet in favor of ChromaDotNet.Client. The namespace is still ChromaDB.Client.
  • Program.cs: the client takes the Chroma address as it is, with new ChromaClient(uri). No more /api/v1.
  • MemoryContext.cs: UpsertAsync and QueryAsync, the method names in 2.x. The empty metadata list is no longer passed: it was never filled, and 2.x wants one entry per id or none.
  • AppHost: the Chroma image is pinned to chromadb/chroma:1.5.9, the version tested. The untagged image moved from 0.x to 1.x and broke the sample; with a tag, a new major does not break it again.
  • Scenario README: the snippets follow the code.

Where the packages are used:

Fixes #71

Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request Type

What kind of change does this Pull Request introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
git clone https://github.com/Laurianti/eShopLite.git
cd eShopLite
git checkout fix-04-chromadb-client
  • Test the code
cd scenarios/04-chromadb/src
dotnet build eShopLite-ChromaDB.slnx

Then run eShopAppHost as in the scenario README and search from the Store.

What to Check

Verify that the following are valid

  • The Products log has no "Error creating chromaDB client" and shows "Memory context initialized: True".
  • The semantic search in the Store returns products.

Other Information

Tested with chromadb/chroma:1.5.9 and SQL Server 2025 in Docker, .NET SDK 10.0.402:

  • Products alone, without Azure OpenAI. Before: "Error creating chromaDB client" with NotFound. After: the products collection is created and the log shows "Memory context initialized: True".
  • MemoryContext with deterministic fake embeddings and a fake chat client: 9 products upserted, 9 records in the collection, and the searches return products. The results are the same as with the old client and /api/v1/ against Chroma 0.5.20.
  • Full scenario: eShopAppHost with the containers it starts (Chroma 1.5.9, SQL Server 2022) and Azure OpenAI, keyless, with gpt-5.4-mini for chat and text-embedding-3-small for embeddings. Before: the semantic search in the Store shows "No response" and /api/aisearch returns 500. After: 9 records in the products collection, and from the Store "rain jacket" returns Outdoor Rain Jacket and Outdoor Backpack, "something for camping" returns Camping Lantern and Camping Tent.
  • Build: 0 errors, the same 13 warnings as before. dotnet format --verify-no-changes on the changed files passes.

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.

🟢 Approval recommended

The focused migration is internally consistent and has no identified blocking issues; runtime validation was not independently performed.

No open issues 🎉

What changed in this PR

Restores scenario 04’s Chroma connectivity by migrating Products to a Chroma 1.x-compatible client, addressing #71.

Changes:

  • Replaces the legacy client and removes the /api/v1 suffix.
  • Updates collection operations and omits unused metadata.
  • Pins Chroma to 1.5.9 and aligns README examples.
File Description
scenarios/​04-chromadb/​src/​Products/​Program.cs Updates client and collection initialization.
scenarios/​04-chromadb/​src/​Products/​Products.csproj Uses ChromaDotNet.Client 2.14.0.
scenarios/​04-chromadb/​src/​Products/​Memory/​MemoryContext.cs Updates upsert and query calls.
scenarios/​04-chromadb/​src/​eShopAppHost/​Program.cs Pins the Chroma container version.
scenarios/​04-chromadb/​README.md Aligns setup and API examples.

Review effort: Balanced

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.

[04-chromadb] Products cannot connect to Chroma: GetOrCreateCollection fails with NotFound

3 participants