Repository navigation
feat(azureprovider): add Cosmos DB vector store - #1304
Conversation
Port the CommunityToolkit Cosmos DB connector using a caller-owned stable azcosmos client. Add typed and dynamic records, partition-aware vector and hybrid search, embedding generation, Go documentation, an example, and opt-in live integration tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved schema-path, score-field collision, and timestamp-query defects affect correctness.
4 open issues
What changed in this PR
Adds an Azure Cosmos DB backend to VectorData using a caller-owned native client.
Changes:
- Supports container lifecycle, typed/dynamic records, CRUD, and partition keys.
- Adds embedding generation and partition-scoped vector/hybrid search.
- Includes protocol tests, opt-in live tests, and a runnable example.
| File | Description |
|---|---|
| provider/azureprovider/cosmosdb.go | Store configuration and public contracts. |
| provider/azureprovider/cosmosdb_test.go | Protocol regression tests. |
| provider/azureprovider/cosmosdb_query.go | Filters, routing, and ranked queries. |
| provider/azureprovider/cosmosdb_e2e_test.go | Four opt-in live integration tests. |
| provider/azureprovider/cosmosdb_collection.go | Container policies, record mapping, CRUD, and paging. |
| go.sum | Cosmos SDK dependency checksums. |
| go.mod | Adds stable azcosmos dependency. |
| examples/02-agents/providers/azure/cosmosdb/main.go | Demonstrates generated embeddings and scoped search. |
Review effort: Balanced
| case *providerservices.VectorPropertyModel: | ||
| c.vectors = append(c.vectors, p) | ||
| } | ||
| c.properties[propertyName(property)] = property |
| value = strings.ReplaceAll(value, "~", "~0") | ||
| return strings.ReplaceAll(value, "/", "~1") |
| return nil, err | ||
| } | ||
| if found { | ||
| document[property.StorageName] = value |
| yield(zero, cosmosFailure(c.store.databaseName, c.name, "GetFiltered", err)) | ||
| return | ||
| } | ||
| query := "SELECT VALUE c FROM c" |
Reserve the internal score field, quote Cosmos schema paths, normalize record and filter timestamps to fixed-width UTC, and omit unrequested vectors from filtered queries. Add protocol regressions and document the wire contracts. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
API consistency review
Changed Go contractNew Upstream evidence reviewed
AssessmentThis PR is an explicitly documented, scoped port of the CommunityToolkit MEVD Azure Cosmos DB connector, using stable
|


Summary
azureprovider.CosmosDB, using stableazcosmos v1.5.0and a caller-owned native client.Compatibility and limits
azcosmosdoes not execute cross-partition ranking/ordering. Vector search, hybrid search, and ordered retrieval require equality filters for every partition-key property; unsupported queries fail before service I/O or embedding generation.IncludeVectors; sequential batches may partially succeed. These contracts are documented in Go comments.Validation