Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 1.25 KB

File metadata and controls

36 lines (22 loc) · 1.25 KB

ChatCompletions C# / .NET Wrapper

A C# / .NET wrapper library around the OpenAI ChatCompletions (ChatGPT) API. Easy-to-use with a wide range of functionality. Supports ChatCompletions with function-calling. Supports automatic function-call creation through simply applying attributes to an existing C# method.

NuGet

Basic Usage

var gpt = new ChatGPT("your_secret_key");

var response = await gpt.GetChatCompletion(
                          messages: new List<Zintom.OpenAIWrapper.Models.Message> {
                            new() { Role = "user", Content = "What is 9 + 900?" }
                          },
                          options: new ChatGPT.ChatCompletionOptions() { Model = LanguageModels.GPT_3_5_Turbo });

Console.WriteLine(response?.Choices?[0].Message?.Content);

Other documentation and tutorials:

Installation

Visual Studio GUI:

Project -> Manage NuGet Packages... -> Search: "OpenAIWrapper" -> Install

Package Manager

PM> NuGet\Install-Package OpenAIWrapper

.NET CLI

> dotnet add package OpenAIWrapper