Summary
The C# library and several samples currently depend on Betalgo.Ranul.OpenAI, a community-maintained OpenAI client library. We should migrate to the official OpenAI NuGet package, which is maintained by OpenAI in collaboration with Microsoft and generated from the OpenAI OpenAPI
specification.
Motivation
- Official support: The
OpenAI package is maintained by OpenAI and Microsoft, ensuring long-term support, timely updates, and alignment with the OpenAI API.
- API parity: Generated from the OpenAPI spec, the official package guarantees accurate coverage of the OpenAI REST API surface.
- Ecosystem alignment: As a Microsoft project, Foundry Local should align with the official Microsoft-collaborated library rather than a community alternative.
- Partial migration already exists: Two samples (
foundry-local-web-server and tool-calling-foundry-local-web-server) already use the official OpenAI package (v2.5.0), demonstrating feasibility.
Scope
Library (core dependency)
sdk/cs/src/Microsoft.AI.Foundry.Local.csproj — references Betalgo.Ranul.OpenAI v9.1.0
- Source files with Betalgo
using statements:
sdk/cs/src/OpenAI/ChatClient.cs
sdk/cs/src/OpenAI/AudioClient.cs
sdk/cs/src/OpenAI/ChatCompletionRequestResponseTypes.cs
sdk/cs/src/OpenAI/AudioTranscriptionRequestResponseTypes.cs
sdk/cs/src/OpenAI/LiveAudioTranscriptionTypes.cs
sdk/cs/src/OpenAI/ToolCallingExtensions.cs
sdk/cs/src/Detail/JsonSerializationContext.cs
Tests
sdk/cs/test/FoundryLocal.Tests/ChatCompletionsTests.cs
Samples (4 projects via Central Package Management)
samples/cs/tutorial-chat-assistant
samples/cs/tutorial-tool-calling
samples/cs/tutorial-voice-to-text
samples/cs/tutorial-document-summarizer
Samples (direct Betalgo usage in code)
samples/cs/native-chat-completions
samples/cs/model-management-example
samples/cs/tool-calling-foundry-local-sdk
Configuration files
samples/cs/Directory.Packages.props — central version Betalgo.Ranul.OpenAI v9.2.0
Documentation
sdk/cs/README.md
sdk/cs/docs/api/microsoft.ai.foundry.local.openaiaudioclient.md
sdk/cs/docs/api/microsoft.ai.foundry.local.openaichatclient.md
Considerations
- Breaking change for library consumers: This is a public API change since the library exposes Betalgo types (e.g.,
ChatCompletionCreateRequest, ChatCompletionCreateResponse). Consumers using
these types directly will need to update their code.
- Type mapping: The two libraries have different type hierarchies and namespaces. A mapping guide for commonly used types would be helpful.
- Realtime API: The library uses Betalgo's
RealtimeModels for live audio transcription (LiveAudioTranscriptionTypes.cs). Verify the official package has equivalent Realtime API support.
- Version alignment: The samples already on the official package use v2.5.0. The library should target a stable version.
Summary
The C# library and several samples currently depend on
Betalgo.Ranul.OpenAI, a community-maintained OpenAI client library. We should migrate to the officialOpenAINuGet package, which is maintained by OpenAI in collaboration with Microsoft and generated from the OpenAI OpenAPIspecification.
Motivation
OpenAIpackage is maintained by OpenAI and Microsoft, ensuring long-term support, timely updates, and alignment with the OpenAI API.foundry-local-web-serverandtool-calling-foundry-local-web-server) already use the officialOpenAIpackage (v2.5.0), demonstrating feasibility.Scope
Library (core dependency)
sdk/cs/src/Microsoft.AI.Foundry.Local.csproj— referencesBetalgo.Ranul.OpenAIv9.1.0usingstatements:sdk/cs/src/OpenAI/ChatClient.cssdk/cs/src/OpenAI/AudioClient.cssdk/cs/src/OpenAI/ChatCompletionRequestResponseTypes.cssdk/cs/src/OpenAI/AudioTranscriptionRequestResponseTypes.cssdk/cs/src/OpenAI/LiveAudioTranscriptionTypes.cssdk/cs/src/OpenAI/ToolCallingExtensions.cssdk/cs/src/Detail/JsonSerializationContext.csTests
sdk/cs/test/FoundryLocal.Tests/ChatCompletionsTests.csSamples (4 projects via Central Package Management)
samples/cs/tutorial-chat-assistantsamples/cs/tutorial-tool-callingsamples/cs/tutorial-voice-to-textsamples/cs/tutorial-document-summarizerSamples (direct Betalgo usage in code)
samples/cs/native-chat-completionssamples/cs/model-management-examplesamples/cs/tool-calling-foundry-local-sdkConfiguration files
samples/cs/Directory.Packages.props— central versionBetalgo.Ranul.OpenAIv9.2.0Documentation
sdk/cs/README.mdsdk/cs/docs/api/microsoft.ai.foundry.local.openaiaudioclient.mdsdk/cs/docs/api/microsoft.ai.foundry.local.openaichatclient.mdConsiderations
ChatCompletionCreateRequest,ChatCompletionCreateResponse). Consumers usingthese types directly will need to update their code.
RealtimeModelsfor live audio transcription (LiveAudioTranscriptionTypes.cs). Verify the official package has equivalent Realtime API support.