Standard.AI.OpenAI 0.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Standard.AI.OpenAI --version 0.2.0
NuGet\Install-Package Standard.AI.OpenAI -Version 0.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Standard.AI.OpenAI" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Standard.AI.OpenAI --version 0.2.0
#r "nuget: Standard.AI.OpenAI, 0.2.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Standard.AI.OpenAI as a Cake Addin
#addin nuget:?package=Standard.AI.OpenAI&version=0.2.0

// Install Standard.AI.OpenAI as a Cake Tool
#tool nuget:?package=Standard.AI.OpenAI&version=0.2.0

Standard.AI.OpenAI

<div align=center> <img width="300" src="https://raw.githubusercontent.com/hassanhabib/OpenAI.NET/main/Standard.AI.OpenAI/artificial-intelligence.png" /> </div>

<br />

.NET The Standard - COMPLIANT The Standard Community

Introduction

Standard.AI.OpenAI 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.

Standard-Compliance

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.

How to use this library?

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:

OpenAI Account

You must create an OpenAI account with the following link: https://platform.openai.com/signup

API Keys

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

Hello, World!

Once you've completed the aforementioned steps, let's write our very first program with Standard.AI.OpenAI as follows:

Standard.AI.OpenAI Nuget

Find our nuget package.

Program.cs

The following example demonstrate how you can write your first Completions program.

using OpenAI.NET.Clients.OpenAIs;
using OpenAI.NET.Models.Configurations;
using OpenAI.NET.Models.Services.Foundations.Completions;

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
    {
        Prompt = new string[] { "Human: Hello!" },

        Model = "text-davinci-003"
    }
};

Completion resultCompletion =
    await openAIClient.Completions.PromptCompletionAsync(
        inputCompletion);

Array.ForEach(resultCompletion.Response.Choices, choice => Console.WriteLine(choice.Text));

How to Contribute

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.

Live-Sessions

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

Past-Sessions

Here's our live sessions to show you how this library was developed from scratch:

OPENAI000: Getting Started

OPENAI001: API Integrations

OPENAI002: API Integrations

OPENAI003: API Integrations

OPENAI004: Completion Service

OPENAI005: Completion Service

OPENAI006: Developing Completion Clients

OPENAI007: Acceptance & Integration Tests

OPENAI008: Acceptance & Integration Tests

OPENAI009: Publishing Nuget Package

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Standard.AI.OpenAI:

Package Downloads
FenixAlliance.ABS.Integrations.OpenAI

Application Component for the Alliance Business Suite.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.6.0 9,778 5/27/2023
0.5.0 1,471 5/5/2023
0.4.0 690 4/16/2023
0.3.0 1,767 4/1/2023
0.2.0 276 3/26/2023
0.1.0 296 3/22/2023

This is a beta release that offers both completions and chat completions