If you haven’t seen all the amazing things people are getting the new OpenAI GPT-3 API to do, it’s definitely worth taking a look.

Opinions seem to be divided as to whether this is more hype or a real turning point for practical AI, but from my personal experience it is definitely a huge step forward. Sure it’s not perfect, but one can’t help but be amazed by the shear amount of tasks that it seems somewhat capable of tackling and the hard-to-describe feeling of genuine intellegence it imparts on anyone who spends much time trying it out. Many of the failure modes (like making up answers to nonsensical questions) seems to be swiftly counterected by cleaver prompt engineering (in this case, explicitly telling it that it is allowed to respond “I don’t know").

There is a playground that lets one easily interest with the text outputs of the the API, but even more exciting are the possilities of programatic access via the API. To facilitate that, there is an official Python package and an unofficial NodeJS package which wrap the raw Rest API, and this week I’ve been working on expanding that footprint.

Today I’m excited to launch my .NET bindings for the OpenAI GPT-3 API. This is a widely compatible .NET Standard 2.0 package which should work on the .NET Framework, on cross-platform .NET Core, and even via ASP.NET or Xamarin mobile (although I have not yet tested all of those scenarios). It’s a bit more than a simple Rest wrapper, handling some of the complication of the API and making it feel like an idiomatic C# library.

Using it is as simple as installing the nuget package “OpenAI" and doing something quick and simple like

var api = new OpenAI_API.OpenAIAPI(engine: Engine.Davinci);

var result = await api.Completions.CreateCompletionAsync("One Two Three One Two", temperature: 0.1);
Console.WriteLine(result.ToString());
// should print something that starts with "Three"

Of course there’s plenty of advanced ways to use it as well, from asyncronous streaming of results using fancy new C# 8.0 async interators (don’t worry, it’s also possible via more traditional methods for older versions of C#), to inspecting the log-likelihoods of results, to searching the document matching API. More details can be found on the Github Repo Readme