OpenAi_Fetcher 0.1.2
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package OpenAi_Fetcher --version 0.1.2
NuGet\Install-Package OpenAi_Fetcher -Version 0.1.2
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="OpenAi_Fetcher" Version="0.1.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add OpenAi_Fetcher --version 0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: OpenAi_Fetcher, 0.1.2"
#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 OpenAi_Fetcher as a Cake Addin
#addin nuget:?package=OpenAi_Fetcher&version=0.1.2
// Install OpenAi_Fetcher as a Cake Tool
#tool nuget:?package=OpenAi_Fetcher&version=0.1.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
OpenAi Fetcher
Class library to incorporate OpenAI in your .NET application.
Use
Fetch data
Replace ’apiKey’ with your OpenAI api key. And change instruction and input.
var fetcher = new OpenAi.OpenAiApiFetcher(apiKey, "Return the 3 biggest cities of the country", "Sweden");
Change default model
Default setting is Gpt-3.5-turbo. But you can select gpt-4 or gpt-4-1106-preview.
fetcher.Model = GptModels.Gpt4
Custom model
fetcher.Model = GptModels.Custom = "custom-model";
You can get reuslt returned as a JSON string or strongly-typed as GptResponse
Strongly-typed
GptResponse response = await fetcher.FetchCompletionsAsync();
var gptChoises = response.Choices[0];
Result
gptChoises.Message.Content:
1. Stockholm - The capital and largest city of Sweden, with a population of approximately 975,000 people.
2. Gothenburg - The second-largest city in Sweden, with a population of around 590,000 people.
3. Malmö - The third-largest city in Sweden, with a population of about 320,000 people.
JSON string
string result = await fetcher.FetchCompletionsAsync();
Result
{
"id": "chatcmpl-8Ig99G1IFcO0JIU77OOL7g15vgD7D",
"object": "chat.completion",
"created": 1699462607,
"model": "gpt-3.5-turbo-0613",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The three biggest cities in Sweden are:\n\n1. Stockholm - The capital and largest city of Sweden, with a population of approximately 975,000 people.\n2. Gothenburg - The second-largest city in Sweden, with a population of around 590,000 people.\n3. Malmö - The third-largest city in Sweden, with a population of about 320,000 people."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 21,
"completion_tokens": 78,
"total_tokens": 99
}
}
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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.