OpenAI.Net.Client
1.0.0
See the version list below for details.
dotnet add package OpenAI.Net.Client --version 1.0.0
NuGet\Install-Package OpenAI.Net.Client -Version 1.0.0
<PackageReference Include="OpenAI.Net.Client" Version="1.0.0" />
paket add OpenAI.Net.Client --version 1.0.0
#r "nuget: OpenAI.Net.Client, 1.0.0"
// Install OpenAI.Net.Client as a Cake Addin #addin nuget:?package=OpenAI.Net.Client&version=1.0.0 // Install OpenAI.Net.Client as a Cake Tool #tool nuget:?package=OpenAI.Net.Client&version=1.0.0
OpenAI.Net
OpenAI library for .NET
C# .NET library for use with the OpenAI API.
This is community-maintained library.
Getting started
Install package Nuget package
Install-Package OpenAI.Net.Client
Register services using the extension method
services.AddOpenAIServices(apiKey);
OR
services.AddOpenAIServices(apiKey, organizationId);
OR
services.AddOpenAIServices(apiKey, organizationId, apiUrl);
N.B We recommened using environment variables, configuration files or secret file for storing the API key securely. See here for further details.
Inject the service where you need it.
e.g
public class MyAwsomeService
{
private readonly IOpenAIService _openAIService;
private readonly ILogger<MyAwsomeService> _logger;
public MyAwsomeService(IOpenAIService openAIService,ILogger<MyAwsomeService> logger)
{
_openAIService = openAIService;
_logger = logger;
}
public async Task<TextCompletionResponse> Search()
{
var request = new TextCompletionRequest("text-davinci-003", "Say this is a test");
var response = await _openAIService.TextCompletion.Get(request);
if (response.IsSuccess)
{
return response.Result;
}
else
{
_logger.LogError(response.Exception, response.ErrorMessage, response.ErrorResponse);
}
return new TextCompletionResponse();
}
}
Full support of all current API's
Testing
This project has 100% code coverage with Unit tests and 100% pass rate with Stryker mutation testing.
See latest Stryker report here.
We also have Integration tests foreach service.
This should provide confidence in the library going forwards.
Contributions
Contributions are welcome.
Minimum requirements for any PR's.
MUST include Unit tests and maintain 100% coverage.
MUST pass Stryker mutation testing with 100%
SHOULD have integration tests
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
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 6.0.0)
- Microsoft.Extensions.Http (>= 6.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.0.21 | 12,402 | 11/10/2023 | |
1.0.20 | 4,712 | 3/25/2023 | |
1.0.19 | 436 | 3/20/2023 | |
1.0.18 | 348 | 3/18/2023 | |
1.0.17 | 716 | 3/14/2023 | |
1.0.16 | 237 | 3/14/2023 | |
1.0.15 | 6,028 | 1/22/2023 | |
1.0.14 | 647 | 1/8/2023 | |
1.0.13 | 504 | 12/29/2022 | |
1.0.12 | 352 | 12/27/2022 | |
1.0.11 | 323 | 12/27/2022 | |
1.0.10 | 362 | 12/27/2022 | |
1.0.9 | 349 | 12/27/2022 | |
1.0.8 | 336 | 12/26/2022 | |
1.0.7 | 378 | 12/26/2022 | |
1.0.6 | 328 | 12/26/2022 | |
1.0.5 | 318 | 12/26/2022 | |
1.0.4 | 341 | 12/26/2022 | |
1.0.3 | 367 | 12/25/2022 | |
1.0.2 | 350 | 12/25/2022 | |
1.0.1 | 365 | 12/25/2022 | |
1.0.0 | 418 | 12/25/2022 |