Skip to content
/ higlabo Public

HigLabo library provide 1.AI client library(OpenAI, Anthoripic, Groq) 2.Object Mapper(fastest in the world) 3.DbSharp(DAL generator) 4.Other.(Mail, Ftp, Utility...etc)

Notifications You must be signed in to change notification settings

higty/higlabo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

higlabo

HigLabo library provide features

  1. OpenAI client library
  2. Object Mapper(fastest in the world)
  3. DbSharp(DAL generator)
  4. 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.

HigLabo.OpenAI

2024-06-05 updated. Support vector store chunking strategy.

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

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);
}

HigLabo.Mapper

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. image 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.

DbSharp

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

HigLabo.Mime

A library of Mime parser. Fastest parser in the world for MIME format. It is used for HigLabo.Mail.

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

HigLabo.Data.XXX

A library for database access.

HigLabo.Converter

Converter library for Base64,QueryString,QuotedPrintable,Rfc2047,ModifiedUtf7,ISO8601...etc.

HigLabo.Net.Slack

Slack client library to call Slack API. https://www.codeproject.com/Articles/5336184/Creating-best-Csharp-Slack-client-library-in-the-w

About

HigLabo library provide 1.AI client library(OpenAI, Anthoripic, Groq) 2.Object Mapper(fastest in the world) 3.DbSharp(DAL generator) 4.Other.(Mail, Ftp, Utility...etc)

Resources

Stars

Watchers

Forks

Packages

No packages published