NGpt 1.4.4
See the version list below for details.
dotnet add package NGpt --version 1.4.4
NuGet\Install-Package NGpt -Version 1.4.4
<PackageReference Include="NGpt" Version="1.4.4" />
paket add NGpt --version 1.4.4
#r "nuget: NGpt, 1.4.4"
// Install NGpt as a Cake Addin #addin nuget:?package=NGpt&version=1.4.4 // Install NGpt as a Cake Tool #tool nuget:?package=NGpt&version=1.4.4
NGpt - OpenAI ChatGPT client for C# AI developers
Thanks
Thanks for downloading NGpt, OpenAI ChatGPT client for C# developers! We hope this library will help you to create amazing AI applications in C#.
NGpt is a powerful transient fault-tolerant .NET 6 OpenAI client that helps C# developers to use OpenAPI ChatGPT in their applications in seconds. All you need to know is your OpenAI apiKey. Download this package and start coding AI applications in C# today!
Features
- Easy integration with ChatGPT in OpenAI in your .NET applications
- Simplified API usage - Just use the Chat class and Completion method.
- Built specifically for C# developers
- Generate more than 1 completion option in a single response
- You can send more reqests than allowed, NGpt will handle it for you and send it with a proper delay. Transient HTTP errors handling with rety logic and exponential backoff.
Installation
Install the package from NuGet: Install-Package NGpt
Quickstart examples
This is a QUICKSTART for C# DEVELOPERS to use OPENAI ChatGPT:
- Replace the <API_KEY> and optionally <ORGANIZATION> with your own values that you can find on OpenAI website.
- Copy the example code and paste it into your C# program in Visual Studio.
- Run the application
- Congratulations! You made your first call to OpenAI ChatGPT!
- Experiment with your own requests and responses.
The Simplest Example
using NGpt;
// Initialize the client with your API key.
var chat = new Chat("<API_KEY>");
// Get a response from your input string
var response = _chat.Complete("Say hello");
Console.WriteLine(content);
More Complex Example - use it when you need more configuration flexibility
using NGpt;
// Initialize the client.
Optionally you can pass the organization id as a second parameter.
var chat = new Chat("<API_KEY>");
// Create a completion request
var completionRequest = new ChatRequest()
{
Messages = new ChatMessage[]
{
new ChatMessage()
{
Role = Role.User,
Content = "Say this is a test!",
}
},
Temperature = 0.7f,
Model = ChatModel.GPT3_5Turbo
};
// Get the response
var response = chat.Complete(completionRequest);
// Extract the content
var content = response.Choices[0].Message.Content;
Console.WriteLine(content);
Example: Generate 3 response options in a single OpenAPI request
using NGpt.ChatCompletion;
using NGpt;
// Optionally you can pass the organization id as a second parameter.
var chat = new Chat("<API_KEY>");
var completionRequest = new ChatRequest()
{
Messages = new ChatMessage[]
{
new ChatMessage()
{
Role = Role.User,
Content = "Create C# program that checks if a given number is prime number",
},
},
Temperature = 0f,
Model = ChatModel.GPT3_5Turbo,
N = 3
};
var response = chat.Complete(completionRequest);
foreach(var choice in response.Choices)
{
var content = choice.Message.Content;
Console.WriteLine(content);
}
Support
For more information, support, or to report issues, please contact the support team at kontakt@pilsoft.pl.
License
NGpt is proprietary software. Unauthorized copying, modification, distribution, or any form of usage outside the terms of the license agreement are strictly prohibited. For more information on licensing, please contact the licensing team at kontakt@pilsoft.pl.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
-
net6.0
- Flurl.Http (>= 3.2.4)
- Newtonsoft.Json (>= 13.0.3)
- Polly.Extensions.Http (>= 3.0.0)
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.7.4 | 346 | 7/18/2023 |
1.7.3 | 169 | 7/10/2023 |
1.7.2 | 163 | 7/6/2023 |
1.7.1 | 155 | 7/6/2023 |
1.7.0 | 155 | 5/12/2023 |
1.6.1 | 169 | 5/11/2023 |
1.6.0 | 148 | 5/10/2023 |
1.5.0 | 166 | 5/7/2023 |
1.4.5 | 154 | 5/5/2023 |
1.4.4 | 151 | 5/5/2023 |
1.4.3 | 169 | 4/30/2023 |
1.4.2 | 180 | 4/30/2023 |
1.4.1 | 168 | 4/30/2023 |
1.4.0 | 169 | 4/29/2023 |
1.3.0 | 162 | 4/28/2023 |
- Add the simplest Complete(string request) method overload