HigLabo library provide features
- OpenAI client library
- Object Mapper(fastest in the world)
- DbSharp(DAL generator)
- And other.(Mail, Ftp, Rss, Twitter...etc)
I added .NET Standard version at 2020/07/03. It was moved from https://github.com/higty/higlabo.netstandard repository.
2024-05-07 updated. Support usage information on chat completion.
2024-04-22 updated. Support Groq. You can use llama, mixtral, gemma
2024-04-20 updated. This release include fie search and vector store endpoint.
2024-04-17 updated. This release include Batch endpoint.
See article. https://www.codeproject.com/Articles/5372480/Csharp-OpenAI-library-that-support-Assistants-API
See sample code. https://github.com/higty/higlabo/blob/master/Net8/HigLabo.OpenAI.SampleConsoleApp/OpenAIPlayground.cs
Set up: HigLabo.OpenAI from Nuget, and also add HigLabo.Core, HigLabo.NewtonsoftJson. I test against latest version of these three packages.
How to use? It is easy to use!
var cl = new OpenAIClient("API Key"); // OpenAI
--var cl = new OpenAIClient(new AzureSettings("API KEY", "https://tinybetter-work-for-our-future.openai.azure.com/", "MyDeploymentName"));
--var cl = new OpenAIClient(new GroqSettings("API Key")); // Groq, llama, mixtral, gemma
var result = new ChatCompletionStreamResult();
await foreach (string text in cl.ChatCompletionsStreamAsync("How to enjoy coffee?", "gpt-4", result, CancellationToken.None))
{
Console.Write(text);
}
Console.WriteLine();
Console.WriteLine("***********************");
Console.WriteLine("Finish reason: " + result.GetFinishReason());
var p = new RunCreateParameter();
p.Assistant_Id = assistantId;
p.Thread_Id = threadId;
var result = new AssistantMessageStreamResult();
await foreach (string text in cl.RunCreateStreamAsync(p, result, CancellationToken.None))
{
Console.Write(text);
}
Console.WriteLine();
// You can get each server sent event data by these property.
Console.WriteLine(JsonConvert.SerializeObject(result.Thread));
Console.WriteLine(JsonConvert.SerializeObject(result.Run));
Console.WriteLine(JsonConvert.SerializeObject(result.RunStep));
Console.WriteLine(JsonConvert.SerializeObject(result.Message));
HigLabo.Anthropic is a C# library of Anthropic Claude AI. 2014-04-07 updated. It support tool feature.
You can use it like this. Really easy and intuitive.
var cl = new AhtnropicClient("API KEY");
var result = new MessagesStreamResult();
await foreach (string text in cl.MessagesStreamAsync("How to enjoy coffee?", ModelNames.Claude3Opus, result, CancellationToken.None))
{
Console.Write(text);
}
if (result.MessageDelta != null)
{
Console.WriteLine("StopReason: " + result.MessageDelta.Delta.Stop_Reason);
Console.WriteLine("Usage: " + result.MessageDelta.Usage.Output_Tokens);
}
A mapper library like AutoMapper,EmitMapper,FastMapper,ExpressMapper..etc. I posted article to CodeProject. https://www.codeproject.com/Articles/5275388/HigLabo-Mapper-Creating-Fastest-Object-Mapper-in-t
You can map object out of box without configuration. You can also customize completely as you can with AddPostAction,ReplaceMap method.
I completely rewrite HigLabo.Mapper. Now, HigLabo.Mapper is fastest mapper library in the world.
Performance test at 2024/02/02. Note) Mapperly is fast because it does not create new instance. That only pass reference. It does not map property values. Mapperly looks fastest but it is not on the test Address, Customer. HigLabo.Mapper is fastest than any other library. Only Address to AddressDTO is slower than Mapperly.
HigLabo.Mapper (version3.0.0 or later) is used expression tree. It generate il code on runtime, so it is nealy fast as handy code.
A code generator to call stored procedure on database(SQL server, MySQL)
https://www.codeproject.com/Articles/776811/DbSharp-DAL-Generator-Tool-on-NET-Core
A library of Mime parser. Fastest parser in the world for MIME format. It is used for HigLabo.Mail.
A mail library of SMTP,POP3,IMAP.
https://www.codeproject.com/Articles/399207/Understanding-the-Insides-of-the-SMTP-Mail-Protoco https://www.codeproject.com/Articles/404066/Understanding-the-insides-of-the-POP-mail-protoco https://www.codeproject.com/Articles/411018/Understanding-the-insides-of-the-IMAP-mail-protoco
A library for database access.
Converter library for Base64,QueryString,QuotedPrintable,Rfc2047,ModifiedUtf7,ISO8601...etc.
Slack client library to call Slack API. https://www.codeproject.com/Articles/5336184/Creating-best-Csharp-Slack-client-library-in-the-w