Skip to content

Added embedding API to C# SDK#581

Open
phanindraraja wants to merge 7 commits intomicrosoft:mainfrom
phanindraraja:user/rchava/embedding-support
Open

Added embedding API to C# SDK#581
phanindraraja wants to merge 7 commits intomicrosoft:mainfrom
phanindraraja:user/rchava/embedding-support

Conversation

@phanindraraja
Copy link
Copy Markdown
Member

No description provided.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 3, 2026

Someone is attempting to deploy a commit to the MSFT-AIP Team on Vercel.

A member of the Team first needs to authorize it.

@phanindraraja phanindraraja changed the title Added embedding API to SDK Added embedding API to C# SDK Apr 3, 2026
@phanindraraja phanindraraja marked this pull request as ready for review April 3, 2026 07:03
Copilot AI review requested due to automatic review settings April 3, 2026 07:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an embeddings capability to the Foundry Local C# SDK, aligning it with the existing OpenAI-compatible chat and audio clients and exposing it through the model abstraction.

Changes:

  • Introduces OpenAIEmbeddingClient with request/response serialization helpers and JSON source-gen registrations.
  • Exposes embeddings via IModel.GetEmbeddingClientAsync() and implements it on Model / ModelVariant with loaded-model enforcement.
  • Adds test coverage plus README/API docs updates for the new embeddings surface.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
sdk/cs/src/OpenAI/EmbeddingClient.cs Adds OpenAIEmbeddingClient and the public embeddings API surface.
sdk/cs/src/OpenAI/EmbeddingRequestResponseTypes.cs Adds embeddings request DTO + response parsing/serialization helpers.
sdk/cs/src/IModel.cs Adds GetEmbeddingClientAsync to the public model interface.
sdk/cs/src/Detail/Model.cs Wires GetEmbeddingClientAsync through to the selected variant.
sdk/cs/src/Detail/ModelVariant.cs Implements GetEmbeddingClientAsync with “must be loaded” validation.
sdk/cs/src/Detail/JsonSerializationContext.cs Registers embeddings request/response types for STJ source generation.
sdk/cs/test/FoundryLocal.Tests/EmbeddingClientTests.cs Adds embeddings integration tests (basic, normalization, determinism, known values).
sdk/cs/README.md Documents embeddings feature and shows usage + settings.
sdk/cs/docs/api/microsoft.ai.foundry.local.openaiembeddingclient.md Adds generated API docs for OpenAIEmbeddingClient.
sdk/cs/docs/api/microsoft.ai.foundry.local.imodel.md Updates generated API docs for IModel with embeddings accessor.
sdk/cs/docs/api/microsoft.ai.foundry.local.model.md Updates generated API docs for Model with embeddings accessor.
sdk/cs/docs/api/microsoft.ai.foundry.local.modelvariant.md Updates generated API docs for ModelVariant with embeddings accessor.
sdk/cs/docs/api/index.md Adds OpenAIEmbeddingClient to the API docs index.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

/// Get an OpenAI API based EmbeddingClient
/// </summary>
/// <param name="ct">Optional cancellation token.</param>
/// <returns>OpenAI.EmbeddingClient</returns>
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

The XML doc <returns> says OpenAI.EmbeddingClient, but the method returns OpenAIEmbeddingClient (and there is no OpenAI.EmbeddingClient type). Update the return documentation to reference the correct type to avoid misleading API consumers and generated docs.

Suggested change
/// <returns>OpenAI.EmbeddingClient</returns>
/// <returns>OpenAIEmbeddingClient</returns>

Copilot uses AI. Check for mistakes.
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.

2 participants