Jump to content
Xtreme .Net Talk

Announcing the stable release of the official OpenAI library for .NET


Recommended Posts

Guest .NET Team
Posted

Back in June, we launched the first beta of the OpenAI library for .NET, empowering developers to integrate advanced AI models into their applications. Today, we are excited to share that the stable release of the official OpenAI library for .NET is now live. This release ensures a smooth and reliable integration experience for developers working with OpenAI and Azure OpenAI services in their .NET applications.

 

[ATTACH type=full" alt="OpenAI NuGet Package]5982[/ATTACH]

 

[HEADING=1]Key features[/HEADING]

 

The official OpenAI library for .NET provides powerful tools that simplify integrating OpenAI’s cutting-edge models into your .NET applications, offering developers a streamlined experience:

 

 

  • Full OpenAI REST API support: Includes Assistants v2 and Chat Completions, enabling flexible and advanced interactions.
  • Support for latest models: OpenAI’s latest flagship models, including GPT-4o, GPT-4o mini, o1-preview, and o1-mini, are fully supported, ensuring developers have access to cutting-edge AI capabilities.
  • Extensibility: The library is designed with extensibility in mind, allowing the community to build additional libraries on top of it.
  • Sync and async APIs: These ensure developers have the flexibility to use synchronous or asynchronous patterns depending on their application’s needs.
  • Streaming completions: Access to streaming completions via [iCODE]IAsyncEnumerable<T>[/iCODE], offering more dynamic interaction models.
  • Quality-of-life improvements: Numerous improvements have been made throughout the beta cycle based on community feedback.
  • .NET Standard 2.0 compatibility: This library, written in C#, supports all .NET variants that implement .NET Standard 2.0, ensuring compatibility with the latest .NET platforms.

 

 

This official .NET library ensures a smooth and supported integration with OpenAI and Azure OpenAI. It also complements OpenAI’s official libraries for Python and TypeScript/JavaScript developers.

 

The library is open-source, developed, and supported on GitHub. It will be kept up to date with the latest features from OpenAI.

 

[HEADING=1]Sample code[/HEADING]

 

Here’s a quick look at how easy it is to use the OpenAI library in a .NET application. The following code snippet demonstrates how to create an OpenAI client and use it to complete a chat interaction:

 

 

using OpenAI.Chat;ChatClient client = new(   model: "gpt-4o",   apiKey: Environment.GetEnvironmentVariable("OPENAI_API_KEY"));ChatCompletion completion = client.CompleteChat("Say 'this is a test.'");Console.WriteLine($"[ASSISTANT]: {completion.Content[0].Text}");

 

[HEADING=1]Thank you to the .NET community[/HEADING]

 

This stable release wouldn’t have been possible without the continued support and feedback from the .NET community. Over the course of the beta, we’ve seen significant engagement and contributions that helped shape this release. We’re committed to continuing this collaboration as the library evolves.

 

[HEADING=1]Get started today[/HEADING]

 

  • Try the library: Install the NuGet package for the official OpenAI library for .NET and start experimenting with its features.
  • Join the community: Engage with us and other developers on GitHub. Share your experiences, report issues, and contribute to discussions.

 

 

The post Announcing the stable release of the official OpenAI library for .NET appeared first on .NET Blog.

 

Continue reading...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...