OpenAI releases official .NET library

Last week, OpenAI released the first beta version of its official .NET library, which is available as a NuGet package for .NET developers to try. This release follows Microsoft’s announcement at the Build 2024 conference highlighting their partnership with OpenAI to enhance the .NET ecosystem with advanced AI capabilities.

This 2.0.0-beta.1 version of the official OpenAI library for .NET supports the full OpenAI API, including Assistants v2 and Chat Completions. It also integrates with GPT-4o, OpenAI’s latest flagship model. Note that the library is generated based on the OpenAPI specification in collaboration with Microsoft.

As reported, the library is designed with extensibility in mind, allowing the community to build additional libraries on top of it. There are also both synchronous and asynchronous APIs available for developers. Additionally, the library offers access to streaming completions via IAsyncEnumerable.

Regarding the expansion of the .NET AI ecosystem: Microsoft states the following:

We’ve worked with numerous partners, at Microsoft and across the industry, to enable developers to tap into the AI ​​ecosystem. One of our most exciting collaborations this year was with OpenAI. We’ve worked with them to deliver an official .NET library, which will be released later this month. This partnership and the new SDK ensure that .NET developers have a great experience and are on par with other programming language libraries you may be familiar with. It also provides support for the latest OpenAI features and models, such as GPT4o and Assistants v2, and a unified experience for OpenAI and Azure OpenAI

The library makes integration with both OpenAI and Azure OpenAI easier for developers. It also complements the existing official libraries available to Python and TypeScript/JavaScript developers and provides .NET developers with robust tools to work with OpenAI’s technology.

The .NET library is developed and supported on GitHub, where, as stated in the announcement, it will be regularly updated with the latest features of OpenAI. As reported, in the coming months the project will focus on gathering user feedback to refine the library and eventually release a stable NuGet package.

In recognizing the work done before this official release, the .NET team highlighted user contributions Roger Pincombe and community-developed libraries such as Betalgo.OpenAI from Betalgo and OpenAI-DotNet from RageAgainstThePixel.

The community asked several questions about the new OpenAI .NET library and its integration with existing packages. One important question concerned the Azure.AI.OpenAI package. Microsoft has clarified that the existing package will be transformed into a companion library for the Azure OpenAI Service, with a special AzureOpenAIClient.

This update aims to simplify interoperability between Azure and non-Azure OpenAI services, with significant changes expected. Community feedback is actively encouraged to refine these updates.

Another study looked at support for the latest GPT-4o features, such as audio streaming and image and video recognition. The response confirmed that these features are supported and directed users to the main repository for more code samples.

There were also questions about the relationship between the new OpenAI library and ML.NET, with the team member stating that the two have nothing to do with each other. However, they welcomed feedback on possible integrations between ML.NET and OpenAI models.

More about the OpenAI library for .NET readers can be found on the official GitHub project repository and the nuget package page.

Leave a Comment