Fitomad.OpenAI 0.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Fitomad.OpenAI --version 0.2.0
NuGet\Install-Package Fitomad.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="Fitomad.OpenAI" Version="0.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Fitomad.OpenAI --version 0.2.0
#r "nuget: Fitomad.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 Fitomad.OpenAI as a Cake Addin
#addin nuget:?package=Fitomad.OpenAI&version=0.2.0

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

OpenAI .NET library

Fitomad.OpenAI is a .NET library that allows you to access the powerful AI models from OpenAI, such as GPT, DALL-E, and Whisper, through a simple and intuitive interface. You can use this framework to generate text, code, images, audio, and more, with just a few lines of code.

Fitomad.OpenAI provides various options to customize your requests and responses. Whether you want to create a chatbot, a content generator, a sentiment analyzer, a translator, or any other AI-powered application, Fitomad.OpenAI can help you achieve your goals with ease and efficiency.

Dependency Injection

var aiSettings = new OpenAISettingsBuilder()
    .WithApiKey(_apiKey)
    .Build();

var services = new ServiceCollection();
services.AddOpenAIHttpClient(settings: aiSettings);

Chat Completion

ChatRequest request = new ChatRequestBuilder()
    .WithModel(ChatModelKind.GPT_3_5_TURBO)
    .WithSystemMessage("Eres un profesor de alumnos de 10 años.")
    .WithUserMessage("Explícame qué es una estrella.")
    .WithTemperatute(TemperatureKind.Precise)
    .WithReponseFormat(ChatResponseFormat.Text)
    .Build();

ChatResponse chatResponse = await client.ChatCompletion.CreateChatAsync(request);

Image

ImageRequest request = new ImageRequestBuilder()
    .WithModel(ImageModelKind.DALL_E_3)
    .WithPrompt("Un paisaje urbano, con algunos rascacielos de fondo aplicando un estilo de Dalí.")
    .WithImagesCount(1)
    .WithSize(DallE3Size.Square)
    .WithQuality(DallE3Quality.HD)
    .WithStyle(DallE3Style.Vivid)
    .WithResponseFormat(ImageResponseFormat.Url)
    .Build();

ImageResponse imageResponse = await client.Image.CreateImageAsync(request);
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 82 5/14/2024
1.0.1 104 2/29/2024
1.0.0 177 12/16/2023
0.2.0 108 12/10/2023