OpenAi.Api.Abstractions
1.0.1
The owner has unlisted this package.
This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet tool install --global OpenAi.Api.Abstractions --version 1.0.1
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local OpenAi.Api.Abstractions --version 1.0.1
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=OpenAi.Api.Abstractions&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package OpenAi.Api.Abstractions --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
OpenAi.Api
The OpenAiProvider class is a provider for interacting with the OpenAI API. It allows you to generate completions and retrieve information about specific models.
Public Constructors
OpenAiProvider(HttpClient httpClient)
Initializes a new instance of the OpenAiProvider class with the specified HttpClient object used for making HTTP requests to the OpenAI API.
httpClient: TheHttpClientobject to use for making HTTP requests.
Public Methods
Task<string?> GenerateCompletionAsync(CompletionRequest completionRequest)
Asynchronously generates a completion based on the provided CompletionRequest.
completionRequest: The completion request object.- Returns: A
Task<string>representing the asynchronous operation. The task result contains the generated completion as a JSON string, ornullif an error occurs.
Task<Model?> GetModelAsync(string modelName)
Asynchronously retrieves information about a specific model by its name.
modelName: The name of the model.- Returns: A
Task<Model>representing the asynchronous operation. The task result contains the retrieved model information as aModelobject, ornullif an error occurs.
Usage
To use the OpenAiProvider class, you need to instantiate it with an HttpClient object and then call the desired methods. Here's an example:
HttpClient httpClient = new HttpClient();
OpenAiProvider openAiProvider = new OpenAiProvider(httpClient);
// Generate completion
CompletionRequest completionRequest = new CompletionRequest(model, prompt);
string? completion = await openAiProvider.GenerateCompletionAsync(completionRequest);
// Get model information
string modelName = "davinci-codex";
Model? model = await openAiProvider.GetModelAsync(modelName);
| Product | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|