![]() |
VOOZH | about |
`Betalgo.OpenAI` has changed its package ID and namespace and will now be called `Betalgo.Ranul.OpenAI`. This change improves compatibility with Microsoft libraries and aligns with a new project called Ranul Tinga.
For the migration guide: https://github.com/betalgo/openai/wiki/Migration-Guides-for-breaking-changes
For more details: https://blog.kayhantolga.com/ai-updates-series-1
dotnet add package Betalgo.OpenAI --version 8.7.2
NuGet\Install-Package Betalgo.OpenAI -Version 8.7.2
<PackageReference Include="Betalgo.OpenAI" Version="8.7.2" />
<PackageVersion Include="Betalgo.OpenAI" Version="8.7.2" />Directory.Packages.props
<PackageReference Include="Betalgo.OpenAI" />Project file
paket add Betalgo.OpenAI --version 8.7.2
#r "nuget: Betalgo.OpenAI, 8.7.2"
#:package Betalgo.OpenAI@8.7.2
#addin nuget:?package=Betalgo.OpenAI&version=8.7.2Install as a Cake Addin
#tool nuget:?package=Betalgo.OpenAI&version=8.7.2Install as a Cake Tool
A .NET Library for accessing OpenAI's API, provided as a community library. This Library allows you to integrate OpenAI's capabilities into your .NET applications with ease.
โญ We appreciate your star, it helps! ๐ GitHub Repo stars
We have a very new ๐ Discord
and ๐ Static Badge
channel. Please come and help us build the .NET AI community.
Install-Package Betalgo.OpenAI
Install-Package Betalgo.OpenAI.Utilities
Maintenance of this project is made possible by all the bug reporters, contributors, and sponsors.
๐ Sponsors:
@betalgo, Laser Cat Eyes
@tylerje, @oferavnery, @MayDay-wpf, @AnukarOP, @Removable, @Scar11
The repository contains a sample project named OpenAI.Playground to help you understand how the library works. However, please exercise caution while experimenting, as some test methods may result in unintended consequences such as file deletion or fine-tuning.
!! It is highly recommended that you use a separate account instead of your primary account while using the playground. Some test methods may add or delete your files and models, potentially causing unwanted issues. !!
Your API Key can be obtained from here: https://platform.openai.com/account/api-keys
Your Organization ID can be found here: https://platform.openai.com/account/org-settings
var openAiService = new OpenAIService(new OpenAiOptions()
{
ApiKey = Environment.GetEnvironmentVariable("MY_OPEN_AI_API_KEY")
});
"OpenAIServiceOptions": {
"ApiKey": "Your api key goes here",
"Organization": "Your Organization Id goes here (optional)",
"UseBeta": "true/false (optional)"
}
(To use user secrets: Right-click your project name in "Solution Explorer", then click "Manage User Secrets". This is a good way to keep your API keys secure.)
serviceCollection.AddOpenAIService();
OR
serviceCollection.AddOpenAIService(settings => { settings.ApiKey = Environment.GetEnvironmentVariable("MY_OPEN_AI_API_KEY"); });
After injecting your service, you can retrieve it from the service provider:
var openAiService = serviceProvider.GetRequiredService<IOpenAIService>();
You can set a default model (optional):
openAiService.SetDefaultModelId(Models.Gpt_4o);
var completionResult = await openAiService.ChatCompletion.CreateCompletion(new ChatCompletionCreateRequest
{
Messages = new List<ChatMessage>
{
ChatMessage.FromSystem("You are a helpful assistant."),
ChatMessage.FromUser("Who won the world series in 2020?"),
ChatMessage.FromAssistant("The Los Angeles Dodgers won the World Series in 2020."),
ChatMessage.FromUser("Where was it played?")
},
Model = Models.Gpt_4o,
});
if (completionResult.Successful)
{
Console.WriteLine(completionResult.Choices.First().Message.Content);
}
Due to time constraints, not all methods have been thoroughly tested or fully documented. If you encounter any issues, please report them or submit a pull request. Your contributions are always appreciated.
Needless to say, I cannot accept responsibility for any damage caused by using the library.
PromptTokensDetails, audio_tokens and cached_tokens.Gpt_4o_2024_08_06 and Chatgpt_4o_latest.strict paremeter from ToolDefinition to FunctionDefinitiono1-mini and o1-preview).MaxCompletionTokens for chat completions.ParallelToolCalls for chat completions.ServiceTier for chat completions.ChunkingStrategy in Vector Store and Vector Store Files.Strict in ToolDefinition.MaxNumberResults and RankingOptions for FileSearchTool.ReasoningTokens for token usage.ResponseFormatOneOfType for AssistantResponse.cs.For any issues, contributions, or feedback, feel free to reach out or submit a pull request.
Betalgo X: Betalgo (@Betalgo) / X (twitter.com)
Betalgo Linkedin: Betalgo | LinkedIn
Tolga X: Tolga Kayhan (@kayhantolga) / X (twitter.com)
Tolga Linkedin: Tolga Kayhan | LinkedIn
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Betalgo.OpenAI:
| Package | Downloads |
|---|---|
|
DialogDimensions.OpenAI.Assistants
This is a service for communicating with OpenAI's assistants platform, based on Betalgo's OpenAiService. |
|
|
Oraculum
Library to create and organize factual knowledge inside a Weaviate vector DB and define AI GPT based assistants using this knowledge. |
|
|
BootstrapBlazor.OpenAI
Bootstrap UI OpenAI components experience |
|
|
AIDotNet.OpenAI
AI DotNet API |
|
|
VEDriversLite.AI.OpenAI
Simple VirtualAssistant for OpenAI API wrapper package. It can simplify some few commands from business logic layer. |
Showing the top 4 popular GitHub repositories that depend on Betalgo.OpenAI:
| Repository | Stars |
|---|---|
|
cmu-sei/GHOSTS
GHOSTS (General Human-Oriented Synthetic Teammates and Systems) is a realistic user simulation framework for cyber experimentation, simulation, training, and exercise
|
|
|
FireCubeStudios/Run
WinUI 3 Run
|
|
|
1694439208/Avalonia_BluePrint
avalonia, avalonia node editor, imitate unreal engine blueprint. ไฝฟ็จavaloniaๅผๅ็่็น็ผ่พๅจ๏ผๆจกไปฟ่ๅนปๅผๆ่ๅพ
|
|
|
tylike/AI.Labs
openai chatgpt or local llm(llama.cpp gguf format)+TTS+STT+Word+Excel
|
| Version | Downloads | Last Updated | |
|---|---|---|---|
| 8.7.2 | 241,101 | 10/10/2024 | 8.7.2 is deprecated. |
| 8.7.1 | 40,201 | 9/24/2024 | |
| 8.7.0 | 1,895 | 9/23/2024 | |
| 8.6.2 | 139,282 | 8/26/2024 | |
| 8.6.1 | 70,137 | 7/18/2024 | |
| 8.6.0 | 20,338 | 7/11/2024 | |
| 8.5.1 | 62,212 | 6/18/2024 | |
| 8.5.0 | 13,427 | 6/15/2024 | |
| 8.4.0 | 17,816 | 6/11/2024 | |
| 8.3.0 | 17,903 | 6/3/2024 | |
| 8.2.2 | 46,114 | 5/18/2024 | |
| 8.1.1 | 36,637 | 4/20/2024 | |
| 8.1.0 | 17,287 | 4/16/2024 | |
| 8.0.1 | 6,956 | 4/11/2024 | |
| 8.0.0 | 26,065 | 4/9/2024 | |
| 7.4.7 | 7,756 | 4/6/2024 | |
| 7.4.6 | 237,090 | 2/7/2024 | |
| 7.4.5 | 13,026 | 2/1/2024 |