Embedding: Adds Microsoft.Azure.Cosmos.AI package scaffold#5845
Embedding: Adds Microsoft.Azure.Cosmos.AI package scaffold#5845ananth7592 wants to merge 2 commits into
Conversation
612d090 to
8f7d3b7
Compare
|
@sdkReviewAgent |
| BlobPrefix: 'cosmosdb/csharp/cosmosai/$(BlobVersion)' | ||
| CleanTargetBeforeCopy: ${{ parameters.CleanupFolder }} | ||
|
|
||
| - task: PublishBuildArtifacts@1 |
There was a problem hiding this comment.
🟡 Pipeline: PublishBuildArtifacts nested inside release-only conditional — CI builds skip artifact publishing
- ${{ if eq(parameters.ReleasePackage, true) }}:
...
- task: PublishBuildArtifacts@1 # ← 4-space indent = inside conditional
In the sibling encryption-nuget-pack.yml (line 76), PublishBuildArtifacts@1 is at the step root level (2-space indent), meaning it runs unconditionally for both CI and release builds:
- task: PublishBuildArtifacts@1 # ← 2-space indent = outside conditional
Why this matters: The CI pipeline (azure-pipelines-cosmosai.yml) calls this template with ReleasePackage: false. Because the publish step is inside the conditional, PR/CI builds will silently skip artifact publishing. Reviewers and testers won't be able to download the .nupkg from Azure DevOps to inspect the package output — only the release pipeline produces downloadable artifacts. This appears to be a copy-paste indentation error from mirroring the encryption template.
Suggested fix: Outdent PublishBuildArtifacts@1 to the steps level (2-space indent) to match the encryption template:
# end of ${{ if eq(parameters.ReleasePackage, true) }} block
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts: Microsoft.Azure.Cosmos.AI'
inputs:
artifactName: Microsoft.Azure.Cosmos.AI
|
✅ Review complete (30:54) Posted 5 inline comment(s). Steps: ✓ context, correctness, cross-sdk, design, history, past-prs, synthesis, test-coverage |
|
Why a separate A few concrete reasons, all of which mirror the established pattern in
CI coverage is not sacrificed by this split: Happy to consolidate into the main SDK pipelines if the team would rather move that direction across both Encryption and AI together — that would be a larger refactor that should land as its own change rather than be bundled into this scaffold. |
Introduces Microsoft.Azure.Cosmos.AI - an optional extension library that will host AI-powered capabilities (embeddings, semantic re-ranking, OCR, model integrations) layered on the v3 SDK. Infrastructure only; no public APIs are exposed yet. The first capability - the Azure OpenAI embedding provider - lands in #5849. Package layout - Microsoft.Azure.Cosmos.AI/src - netstandard2.0 library, delay-signed with the MSSharedLib key, three-build aware via SdkProjectRef: ProjectReference in-source, NuGet pin [3.59.0,) for stable, 3.60.0-preview.0 for preview. - Microsoft.Azure.Cosmos.AI/src/AssemblyInfo.cs - assembly-level attributes (CLSCompliant, ComVisible). - Microsoft.Azure.Cosmos.AI/src/Mirrored/AssemblyKeys.cs - local copy of the public-key constant so InternalsVisibleTo resolves without a cross-project Compile link. - Microsoft.Azure.Cosmos.AI/Directory.Build.props - package-scoped overrides layered above the root props. - Microsoft.Azure.Cosmos.AI/tests/Microsoft.Azure.Cosmos.AI.Tests - MSTest test project skeleton targeting net8.0. Versioning (root Directory.Build.props) - Add CosmosAIOfficialVersion, CosmosAIPreviewVersion, and CosmosAIPreviewSuffixVersion properties so the AI package versions independently from the core SDK. - Add COSMOSAIPREVIEW to DefineConstants alongside PREVIEW and ENCRYPTIONPREVIEW so future preview-gated AI code can #if-guard consistently with the established pattern. Pipelines - azure-pipelines-cosmosai.yml - PR validation pipeline. Triggers on changes under Microsoft.Azure.Cosmos.AI/**, the cosmosai templates, the AI pipelines themselves, and Directory.Build.props (so version bumps to the CosmosAI* properties run AI parity validation). - azure-pipelines-cosmosai-official.yml - release pipeline with its own approval gate and partner-drop blob path, mirroring the existing azure-pipelines-encryption-official.yml layout. - templates/cosmosai-nuget-pack.yml - shared build + pack template. PublishBuildArtifacts is at step-root so CI builds (not just release builds) publish the .nupkg as a downloadable artifact. - templates/static-tools-cosmosai.yml - static-analysis template. Dependencies - Pin Newtonsoft.Json 10.0.2 with PrivateAssets=All to satisfy the core SDK's transitive contract without leaking onto the public dependency graph. No business logic, no public types, no contract surface change. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3b1fdb0 to
f67098f
Compare
Local validation on commit
|
| # | Configuration | Core SDK source | Result |
|---|---|---|---|
| 1 | Stable | Microsoft.Azure.Cosmos NuGet [3.59.0,) |
✅ 0 warn / 0 err (5.6 s) |
| 2 | Preview (-p:IsPreview=true) |
Microsoft.Azure.Cosmos NuGet 3.60.0-preview.0 |
✅ 0 warn / 0 err (2.6 s) |
| 3 | SdkProjectRef (-p:SdkProjectRef=true) |
In-tree ProjectReference |
✅ 0 warn / 0 err (17.6 s) |
Command:
dotnet build Microsoft.Azure.Cosmos.AI/src/Microsoft.Azure.Cosmos.AI.csproj -c Release [flags] --nologoPack
dotnet pack Microsoft.Azure.Cosmos.AI/src/Microsoft.Azure.Cosmos.AI.csproj -c Release -p:SdkProjectRef=true -o .\artifacts✅ Produced Microsoft.Azure.Cosmos.AI.1.0.0.nupkg (6,931 bytes).
Test project build (net8.0 after Pilchie feedback)
dotnet build Microsoft.Azure.Cosmos.AI/tests/Microsoft.Azure.Cosmos.AI.Tests/Microsoft.Azure.Cosmos.AI.Tests.csproj -c Release✅ 0 warn / 0 err. Output: bin/Release/net8.0/Microsoft.Azure.Cosmos.AI.Tests.dll.
Cross-package smoke test (core SDK still compiles with AI project present)
dotnet build Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj -c Release✅ 0 warn / 0 err.
Review-comment status
| # | Comment | Status |
|---|---|---|
| 1 | PublishBuildArtifacts nested inside release-only conditional |
✅ Fixed — outdented to step root in templates/cosmosai-nuget-pack.yml, matching encryption-nuget-pack.yml. |
| 2 | Directory.Build.props missing from CI trigger paths |
✅ Fixed — added to pr.paths.include in azure-pipelines-cosmosai.yml. |
| 3 | COSMOSAIPREVIEW define constant missing |
✅ Fixed — added alongside PREVIEW;ENCRYPTIONPREVIEW in root Directory.Build.props. |
| 4 | No API contract enforcement test infrastructure | ✅ Deferred to #5849 (first PR introducing public AI surface). |
| 5 | Main CI will NuGet-restore 3.60.0-preview.0 |
✅ Verified — 3.60.0-preview.0 is published on nuget.org; restore resolves cleanly. |
| 6 (Pilchie, raised on #5849) | net6.0 is out of support; target net8.0 |
✅ Applied here too — test project bumped to net8.0. Library stays netstandard2.0 (max consumer reach; matches the core SDK and Encryption library). |
Note: pre-existing main-branch build break in Encryption
A solution-level build with -p:SdkProjectRef=true (no -p:IsPreview=true) fails on origin/main HEAD da4efa8c8 with 5× CS0115 in Microsoft.Azure.Cosmos.Encryption / Microsoft.Azure.Cosmos.Encryption.Custom. Root cause is a #if guard mismatch where the base Container.IsFeedRangePartOfAsync / GetPartitionKeyRangesAsync are gated #if PREVIEW but the derived overrides use #if SDKPROJECTREF (or are unguarded). Unrelated to this PR — repro on clean origin/main confirmed.
Ready for re-review. CC @xinlian12.
NaluTripician
left a comment
There was a problem hiding this comment.
Did a structural diff against Microsoft.Azure.Cosmos.Encryption since that's the pattern this scaffold is following.Most of it lines up cleanly; a few items below are worth sorting before this lands, since they get more expensive to fix once #5842 puts real code on top of the scaffold.
Headline items:
- 🔴 The
.slnupdate mentioned in the PR description doesn't appear in the diff — leaves the AI projects off the per-PR build path that catches core-SDK breakages today. - 🟡 Missing the 4th GA-surface parity build step from
static-tools-encryption.yml(the one added after PR #5825 had a miss). - 🟡 No per-package changelog, README, or contract baseline — easy to seed at scaffold time, ugly to scope-creep into the implementation PR.
- 🟡 Test project pins (
Microsoft.NET.Test.Sdk 16.2.0,MSTest 1.2.0,Moq 4.8.3,coverlet 3.1.2) are 2016–2019 vintage. New test project = cheapest moment to land on the modern stack. - 🟡 GDN tasks (BinSkim/CredScan/PoliCheck/PostAnalysis) inherit the disabled
condition: eq(1,2)line verbatim from Encryption with a years-old comment — at minimum needs a tracking issue.
Inline comments below.
| @@ -0,0 +1,80 @@ | |||
| <Project Sdk="Microsoft.NET.Sdk"> | |||
There was a problem hiding this comment.
The PR description says the .sln got an "AI" solution folder with both projects, but the diff doesn't show any change to Microsoft.Azure.Cosmos.sln and I can't find Cosmos.AI referenced anywhere in it. Was this dropped in a rebase?
This matters because templates/build-internal.yml and templates/build-preview.yml both build via Microsoft.Azure.Cosmos.sln on every PR — that's how core-SDK changes get caught against Encryption today (the static-tools-encryption template cites PR #5825 and PR #5783 as prior incidents of exactly this class). The new azure-pipelines-cosmosai.yml only triggers on Microsoft.Azure.Cosmos.AI/**, so any future core-SDK PR that breaks the AI package will sail through and only surface on the next AI-directory PR.
Adding both projects to the .sln under an "AI" solution folder fixes it. Sanity check: dotnet build Microsoft.Azure.Cosmos.sln -p:IsPreview=true -p:SdkProjectRef=true should build AI alongside Encryption.
There was a problem hiding this comment.
Done in db7ea2e — both Microsoft.Azure.Cosmos.AI and Microsoft.Azure.Cosmos.AI.Tests are now in Microsoft.Azure.Cosmos.sln under a new AI solution folder (mirrors the existing Encryption / Encryption.Custom folders). Verified locally with dotnet build Microsoft.Azure.Cosmos.sln -p:IsPreview=true -p:SdkProjectRef=true --configuration Release — 0 errors, 16 pre-existing warnings (all Microsoft.Azure.Cosmos.Performance.Tests net6.0 EOL warnings, unrelated). This now means every PR build that runs the solution will catch core-SDK changes that break the AI package, same as the Encryption guardrail.
| <Authors>Microsoft</Authors> | ||
| <Description>AI extensions library for Azure Cosmos DB for NoSQL. Provides an Azure OpenAI / Foundry-backed embedding provider for automatic vector embedding generation in hybrid and vector search queries. Designed to be extensible for broader AI scenarios including semantic re-ranking, OCR, and model integrations. For more information, refer to https://aka.ms/CosmosDB</Description> | ||
| <Copyright>© Microsoft Corporation. All rights reserved.</Copyright> | ||
| <Title>Microsoft Azure Cosmos DB AI extensions library</Title> |
There was a problem hiding this comment.
Nit: <Title>...AI extensions library</Title> is plural — FaultInjection and Encryption both use singular ("Fault Injection library", "encryption library"). Title surfaces on nuget.org, so worth aligning with the sibling convention if not intentional.
There was a problem hiding this comment.
Done in db7ea2e — Microsoft Azure Cosmos DB AI extension library (singular), to align with Microsoft Azure Cosmos DB Fault Injection library and Microsoft Azure Cosmos DB client-side encryption library.
| <GeneratePackageOnBuild>false</GeneratePackageOnBuild> | ||
| <GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
| <TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
| <PackageTags>microsoft;azure;cosmos;cosmosdb;documentdb;nosql;azureofficial;dotnetcore;netcore;netstandard;ai;embedding;vector;openai;semanticranking</PackageTags> |
There was a problem hiding this comment.
Two artifacts worth seeding now, before the first preview push to nuget.org:
Microsoft.Azure.Cosmos.AI/changelog.md— both Encryption and FaultInjection ship a per-package changelog. FaultInjection's csproj also has<PackageReleaseNotes>pointing at it so customers can find release notes from nuget.org. Without one, the first preview push has no discoverable release notes and the implementation PR ([Embedding V0] AzureOpenAIEmbeddingGenerator provider implementation #5842) ends up scope-creeping one in.Microsoft.Azure.Cosmos.AI/README.md— FaultInjection has one, and it's what nuget.org renders when<PackageReadmeFile>is wired up. Trivial to seed with a stub.
Both are essentially free at the scaffold stage and load-bearing once the package is on nuget.org.
There was a problem hiding this comment.
Done in db7ea2e:
- Seeded Microsoft.Azure.Cosmos.AI/changelog.md (Keep-a-Changelog format, mirrors Encryption) with an Unreleased entry describing the scaffold.
- Seeded Microsoft.Azure.Cosmos.AI/README.md describing the package, why it's separate, and planned capabilities — mirrors the FaultInjection README structure.
- Wired pointing at the changelog (FaultInjection pattern) and README.md so nuget.org renders the README.
#5842 inherits the changelog Unreleased bucket — its description should add a customer-facing entry under ### Added for AzureOpenAIEmbeddingGenerator, per the repo's changelog classifier.
|
|
||
| namespace Microsoft.Azure.Cosmos.AI | ||
| { | ||
| internal static class AssemblyKeys |
There was a problem hiding this comment.
This makes three copies of the same hard-coded test public key in the repo (Encryption, Encryption.Custom, and now AI), all under "Mirrored" folders with no canonical source. If the key is ever rotated, three files diverge.
Out of scope for this PR, but worth a follow-up: extract a single AssemblyKeys.cs (e.g., under Microsoft.Azure.Cosmos/build/) and <Compile Include="..." Link="Mirrored\AssemblyKeys.cs" /> it from all three packages.
There was a problem hiding this comment.
Agreed and noted — leaving the 3 Mirrored\AssemblyKeys.cs copies as-is in this PR per your out-of-scope call. I'll file a follow-up issue to extract a single canonical AssemblyKeys.cs under Microsoft.Azure.Cosmos/build/ and it from all three packages (Encryption, Encryption.Custom, AI), and link the issue from this thread once filed.
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" /> |
There was a problem hiding this comment.
These pins are very stale to inherit from Encryption — Encryption is locked into them by accumulated test history, but a brand-new test project with zero tests doesn't have that constraint:
Microsoft.NET.Test.Sdk16.2.0 is from 2019 (current 17.13+)MSTest.TestAdapter/MSTest.TestFramework1.2.0 is from 2016; MSTest is on 3.x and has consolidated under a singleMSTestmeta-packageMoq4.8.3 predates the 2023 SponsorLink supply-chain incidentcoverlet.collector3.1.2 vs. current 6.x
Cheapest moment to land on the modern stack is right now, before #5842 lands real tests. Worth taking either the Azure SDK Engineering recommended test stack or whatever the newer test projects in this repo are using.
There was a problem hiding this comment.
Done in db7ea2e — modernized to match what the main SDK tests project (Microsoft.Azure.Cosmos.Tests.csproj) uses today:
| Pin | Before | After |
|---|---|---|
| Microsoft.NET.Test.Sdk | 16.2.0 | 17.12.0 |
| MSTest.TestAdapter | 1.2.0 | 3.7.3 |
| MSTest.TestFramework | 1.2.0 | 3.7.3 |
| coverlet.collector | 3.1.2 | 6.0.2 |
| Moq | 4.8.3 | 4.8.3 (unchanged — matches main SDK tests pin) |
Left Moq at 4.8.3 deliberately so we're not diverging from the rest of the repo on the SponsorLink question in this PR — happy to bump it across the repo (or swap to NSubstitute) as a separate change if you'd like. Tests project builds and runs clean (Passed 1/1).
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\src\Microsoft.Azure.Cosmos.AI.csproj" /> |
There was a problem hiding this comment.
Microsoft.Azure.Cosmos.Encryption.Tests.csproj links in ContractEnforcement.cs from the main SDK tests and ships DotNetSDKEncryptionAPI.net6.json / .net8.json baselines that lock the public surface. This project has neither.
A new GA-track package is the cheapest moment to wire this up — once #5842 lands AzureOpenAIEmbeddingGenerator and whatever options/builder types come with it, a single misplaced public modifier or accidental rename ships into a preview NuGet with nothing in the PR pipeline to catch it. Suggest adding:
<Compile Include="..\..\..\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\Contracts\ContractEnforcement.cs" Link="Contracts\ContractEnforcement.cs" />
<Compile Include="..\..\..\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\Contracts\ContractType.cs" Link="Contracts\ContractType.cs" />plus an empty DotNetSDKCosmosAIAPI.net8.json baseline and a [TestClass] that calls ContractEnforcement.ValidateContractContainBreakingChanges(...). Baseline stays empty for this PR; #5842 fills it.
There was a problem hiding this comment.
Done in db7ea2e:
- Linked ......\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\Contracts\ContractEnforcement.cs and ContractType.cs into the AI test project (same <Compile Include … Link> pattern as Microsoft.Azure.Cosmos.Encryption.Tests.csproj).
- Added Contracts\ContractEnforcementTests.cs with a [TestClass] that calls ValidateContract(dllName: "Microsoft.Azure.Cosmos.AI", baselinePattern: "DotNetSDKCosmosAIAPI", breakingChangesPattern: "DotNetSDKCosmosAIAPIChanges").
- Added Contracts\DotNetSDKCosmosAIAPI.net8.json baseline. The AI assembly currently has no own public types, so the baseline only captures System.Object-inherited members on the assembly-level enumeration; [Embedding V0] AzureOpenAIEmbeddingGenerator provider implementation #5842 fills it with real types via UpdateContracts.ps1.
- Wired the copy-to-output entry so baselines flow to the test bin folder.
Test run: Passed 1/1 (ContractChanges).
| command: build | ||
| nugetConfigPath: NuGet.config | ||
| projects: Microsoft.Azure.Cosmos.AI/src/Microsoft.Azure.Cosmos.AI.csproj | ||
| arguments: '-p:Optimize=true -p:IsPreview=true -p:SdkProjectRef=true -p:DefineSdkProjectRefSymbol=false --configuration Release' |
There was a problem hiding this comment.
The 4th build variant from static-tools-encryption.yml is missing — the one that builds against main SDK source with IsPreview unset, i.e., no PREVIEW / COSMOSAIPREVIEW symbol defined. Encryption added it explicitly after PR #5825 (FFCF GA promotion) had a miss the preview-only parity build let through; the comment block in static-tools-encryption.yml calls that out.
AI is in exactly the same position: Directory.Build.props now defines COSMOSAIPREVIEW as a preview-only constant, so any future #if COSMOSAIPREVIEW block creates the same GA/preview surface divergence. Suggest adding a 4th DotNetCoreCLI@2 step right after this one with arguments: '-p:Optimize=true -p:SdkProjectRef=true -p:DefineSdkProjectRefSymbol=false --configuration Release' (no IsPreview=true), and lifting the explanatory comment from the Encryption template.
There was a problem hiding this comment.
Done in db7ea2e — added the 4th DotNetCoreCLI@2 step right after the SDKPROJECTREF parity step, with �rguments: '-p:Optimize=true -p:SdkProjectRef=true -p:DefineSdkProjectRefSymbol=false --configuration Release' (no IsPreview=true). Lifted the explanatory comment from static-tools-encryption.yml and updated the constant name to COSMOSAIPREVIEW (which Directory.Build.props defines as the preview-only constant for this package). The cross-reference to PR #5825 is preserved.
|
|
||
| - task: securedevelopmentteam.vss-secure-development-tools.build-task-binskim.BinSkim@4 | ||
| displayName: 'BinSkim' | ||
| condition: eq(1,2) #disabling as nuget repo failing |
There was a problem hiding this comment.
The condition: eq(1,2) #disabling as nuget repo failing line (and the matching three on CredScan/PoliCheck/PostAnalysis below) is years-old text copied verbatim from static-tools-encryption.yml. The result is that the official release-gate pipeline for a brand-new package never runs BinSkim, CredScan, PoliCheck, or PostAnalysis — only Component Governance and (continueOnError: true) AntiMalware actually run.
CredScan in particular has real value here since AI scenarios typically take endpoint URIs and token credentials. Default for a new package should arguably be "on." Suggest either (a) removing the condition: eq(1,2) lines (the "nuget repo failing" rationale needs re-validation — it's stale), or (b) keeping them disabled with a # TODO(#NNNN) referencing a real tracking issue and a removal target, not a copy of a comment from a different package.
There was a problem hiding this comment.
Partial: in db7ea2e I replaced the verbatim condition: eq(1,2) #disabling as nuget repo failing comments on BinSkim, CredScan, PoliCheck, and PostAnalysis with condition: eq(1,2) # TODO(#5845): re-enable … markers, and added a block comment at the top of the GDN section explaining the intent (verify OneES NuGet feed access for these tasks, then remove the gates) and calling out that CredScan in particular matters for AI endpoint URIs / token credentials.
I stopped short of flipping the conditions on in this PR because I can't validate the OneES feed access from a local dev box, and a release-gate pipeline failing on its first run after this lands would block #5842. Happy to flip them on in a follow-up PR as soon as a release-gate dry run confirms green — or earlier in this PR if you'd prefer I just remove the conditions and let CI tell us. Your call.
Addresses Nalu's structural-diff review of #5845 (vs Microsoft.Azure.Cosmos.Encryption): - Microsoft.Azure.Cosmos.sln: add Microsoft.Azure.Cosmos.AI and Microsoft.Azure.Cosmos.AI.Tests under a new 'AI' solution folder, so templates/build-internal.yml and build-preview.yml catch core-SDK changes that break the AI package on every PR (same class of bug as PR #5825 / #5783 caught for Encryption). - templates/static-tools-cosmosai.yml: add the 4th GA-surface parity build step (IsPreview unset, SdkProjectRef=true, DefineSdkProjectRefSymbol=false) that static-tools-encryption.yml added post-#5825. Replace stale 'condition: eq(1,2) #disabling as nuget repo failing' comments on BinSkim/CredScan/PoliCheck/PostAnalysis with TODO(#5845) markers tracking re-enablement. - Microsoft.Azure.Cosmos.AI/changelog.md, README.md: seed per-package changelog and readme (mirroring Encryption / FaultInjection). - Microsoft.Azure.Cosmos.AI.csproj: singular Title ('AI extension library' to match Encryption / FaultInjection), wire PackageReleaseNotes -> changelog.md, PackageReadmeFile -> README.md. - Microsoft.Azure.Cosmos.AI.Tests.csproj: modernize stale test pins (Microsoft.NET.Test.Sdk 16.2.0 -> 17.12.0, MSTest 1.2.0 -> 3.7.3, coverlet.collector 3.1.2 -> 6.0.2 — Moq stays at 4.8.3 to match existing repo pin). Link ContractEnforcement.cs / ContractType.cs from main SDK tests and add ContractEnforcementTests + DotNetSDKCosmosAIAPI.net8.json baseline so a misplaced 'public' in #5842 surfaces at PR review time, not at NuGet publish. Validation: - dotnet build Microsoft.Azure.Cosmos.sln -p:IsPreview=true -p:SdkProjectRef=true --configuration Release: 0 errors (16 pre-existing net6.0 EOL warnings on Microsoft.Azure.Cosmos.Performance.Tests). - AI src builds clean in all 4 static-tools variants. - AI tests: Passed 1/1 (ContractChanges). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verification ✅Re-ran the full test battery from a clean state on commit
Full sln build (validates
|
Summary
Scaffolds the new
Microsoft.Azure.Cosmos.AIpackage — an optional, provider-style extension library for the Azure Cosmos DB .NET SDK that delivers AI-powered capabilities to applications built on Cosmos DB.This PR is infrastructure only — no business logic. The first capability implementation follows in #5842.
Motivation
AI is becoming a first-class requirement for modern data applications. Developers increasingly want their database layer to participate in AI workflows — powering semantic search, retrieval-augmented generation (RAG), and intelligent query augmentation — without having to build and maintain the plumbing themselves.
Microsoft.Azure.Cosmos.AI is the home for these capabilities in the .NET SDK. It is a dedicated, optional package that extends the core Azure Cosmos DB SDK with AI-powered features, keeping them modular and independently evolvable.
Why a separate package?
Over time, Microsoft.Azure.Cosmos.AI will be the single, consistent destination for AI-powered Cosmos DB capabilities in .NET — whether that is automatic vector embedding generation, semantic ranking, AI-assisted query construction, or future capabilities as the AI landscape
evolves.
Changes
New project scaffold
Microsoft.Azure.Cosmos.AI/src/Microsoft.Azure.Cosmos.AI.csproj-netstandard2.0, SNK signing,SdkProjectRefpattern,Azure.AI.OpenAI 2.1.0, explicitNewtonsoft.Json 10.0.2Microsoft.Azure.Cosmos.AI/src/AssemblyInfo.cs-InternalsVisibleTofor test project with strong-name public keyMicrosoft.Azure.Cosmos.AI/tests/.../Microsoft.Azure.Cosmos.AI.Tests.csproj- Empty MSTest project wired to main projectMicrosoft.Azure.Cosmos.AI/Directory.Build.props- Delegates up to repo root propsVersioning
Directory.Build.props- AddedCosmosAIOfficialVersion,CosmosAIPreviewVersion,CosmosAIPreviewSuffixVersionMicrosoft.Azure.Cosmos.sln- AddedAIsolution folder with both projectsPublishing pipelines
azure-pipelines-cosmosai-official.yml- Top-level release pipeline with Release Gates stage and Build/Pack/Publish stagetemplates/static-tools-cosmosai.yml- Static analysis with three build variants (NuGet ref, SdkProjectRef, parity check) plus BinSkim, CredScan, PoliCheck, AntiMalware, Component Governancetemplates/cosmosai-nuget-pack.yml- Build,.nupkg,.snupkgsymbols, SBOM manifest, Azure blob drop, artifact publishDesign Decisions
Why
netstandard2.0?Matches
Microsoft.Azure.CosmosandMicrosoft.Azure.Cosmos.Encryption- broadest framework reach without sacrificing modern API access.Why
Newtonsoft.JsonwithPrivateAssets="All"?The Cosmos SDK enforces an explicit
Newtonsoft.Json >= 10.0.2reference on all dependents via an MSBuild check.PrivateAssets="All"satisfies the check at build time while keeping the package off the public.nuspecdependency graph for consumers - identical to the Encryption package.Why pipelines in this PR?
Infrastructure is reviewable independently of business logic. The YAML files can merge and be registered in Azure DevOps now; the pipeline should be activated (queued for release) only after #5842 lands and provides real content to gate on.
Verification
dotnet build(official + SdkProjectRef variants) -> 0 warnings, 0 errorsdotnet test-> No tests yet (empty), exits 0Related
ICosmosEmbeddingGeneratorinterface +QueryRequestOptions/CosmosClientOptionssurfaceAzureOpenAIEmbeddingGeneratorprovider (follows this PR)Closes #5841
Part of #5830