OpenAI.NET is a Standard-Compliant .NET library built on top of OpenAI API RESTful endpoints to enable software engineers to develop AI-Powered solutions in .NET.
This library was built according to The Standard. The library follows engineering principles, patterns and tooling as recommended by The Standard.
This library is also a community effort which involved many nights of pair-programming, test-driven development and in-depth exploration research and design discussions.
In order to use this library there are prerequists that you must complete before you can write your first AI-Powered C#.NET program. These steps are as follows:
You must create an OpenAI account with the following link: https://platform.openai.com/signup
Once you've created an OpenAI account. Now, go ahead and generate an API key from the following link: https://platform.openai.com/account/api-keys
Once you've completed the aforementioned steps, let's write our very first program with OpenAI.NET as follows:
Find our nuget package.
The following example demonstrate how you can write your first Completions program.
var openAiApiConfigurations = new ApiConfigurations
{
ApiKey = "YOUR_API_KEY_HERE",
OrganizationId = "YOUR_OPTIONAL_ORG_ID_HERE"
}
var openAiClient = new OpenAIClient(openAiApiConfigurations);
var inputCompletion = new Completion
{
Request = new CompletionRequest
{
Prompts = new string[] {"Human: Hello!"}
Model = "text-davinci-003"
};
}
Completion resultCompletion =
await this.openAiClient.Completions.PostCompletionAsync(
inputCompletion);
Array.ForEach(resultCompletion.Response.Prompts, Console.WriteLine);
If you want to contribute to this project please review the following documents:
If you have a question make sure you either open an issue or join our The Standard Community discord server.
Our live-sessions are schedules on The Standard Calendar make sure you adjust the time to your city/timezone to to be able to join us.
We broadcast on multiple platforms:
YouTube
LinkedIn
Twitch
Twitter
Facebook
Here's our live sessions to show you how this library was developed from scratch: