Conversation
|
Someone is attempting to deploy a commit to the MSFT-AIP Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
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
OpenAIEmbeddingClientwith request/response serialization helpers and JSON source-gen registrations. - Exposes embeddings via
IModel.GetEmbeddingClientAsync()and implements it onModel/ModelVariantwith 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.
Added null checks Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
213a854 to
e9d887d
Compare
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Summary
Adds embedding support to the Foundry Local C# SDK, enabling text embedding generation through the
OpenAIEmbeddingClientvia Foundry Local Core.Changes
SDK
OpenAIEmbeddingClient— Public client for generating embeddings. ExposesGenerateEmbeddingAsync(string input)which sends the"embeddings"command to FoundryLocalCore viaICoreInteropand returns anEmbeddingCreateResponse. Configurable viaEmbeddingSettings(optionalDimensionsandEncodingFormatfields).EmbeddingRequestResponseTypes.cs— Request DTO (EmbeddingCreateRequestExtended) withFromUserInput()factory, and response deserialization/error handling extensions. Logs only payload length on deserialization failure to avoid large log output. Validatesresponse.Datais non-null before dereferencing.IModel.GetEmbeddingClientAsync()— New interface method for obtaining an embedding client from a loaded model.Model/ModelVariant— Implementation that checks the model is loaded and returns a newOpenAIEmbeddingClientinstance.JsonSerializationContext— RegisteredEmbeddingCreateRequestExtendedandEmbeddingCreateResponsefor AOT-compatible serialization.Tests
EmbeddingClientTests.cs— Tests againstqwen3-0.6b-embedding-generic-cpu:1:Documentation
README.md— Added embeddings to features list, usage example withGetEmbeddingClientAsync()and settings configuration.docs/api/index.md— AddedOpenAIEmbeddingClientto class index.docs/api/openaiembeddingclient.md— New API reference page with properties and methods.docs/api/imodel.md,model.md,modelvariant.md— AddedGetEmbeddingClientAsync()method documentation.Test plan
dotnet buildsucceedsDependencies
This PR depends on the neutron-server PR that adds the
"embeddings"functionality and/v1/embeddingsendpoint to Foundry Local core