Coder Social home page Coder Social logo

higty / higlabo Goto Github PK

View Code? Open in Web Editor NEW
176.0 176.0 82.0 341.92 MB

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)

C# 89.83% Batchfile 0.06% TSQL 0.29% TypeScript 1.70% CSS 0.33% SCSS 0.28% HTML 0.34% JavaScript 7.16%

higlabo's People

Contributors

dependabot[bot] avatar higty avatar koolru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

higlabo's Issues

What is the best approach to add more context to the question

I am building user support AI. I gave to the assistant basic knowledge about my product. Now when user asks some question the following algo happens:

  1. system uses embeddings to fetch FAQ and other docs data somehow related to the question (lets call them "context")
  2. I want to pass these fetched context along with original user request to assistant.

What is the best way to mark fetched data as additional context? Actually I can to that right into request or maybe send them as separate "system" roled message? Or what is the better way? If sending separate system message, how to send it both together with "user"-roled which I am sending now as below:

  {
      Thread_Id = internalThreadId,
      Role = "user",
      Content = userInput
  };
  await _client.MessageCreateAsync(messageCreateParams);```

Wrong Conversion of Special Characters

I found out that when a folder name contains one special character (i.e. löschen) ist not converted properly. The Problem is in
function EncodeWithoutInsertingNewline(Byte[] input)

on Line 156: startIndex += 3;
This Line of Code must be set in the for loop under c2 = input[startIndex + 2];

I fixed it.

Base64Converter.zip

Activate pop3 tls1.2

Hey, its possible to activate TLS 1.2 in your Pop3 library?
I dont find a fix for this.

Netwonsoft 4

It seems that the project is still referencing the old newtonsoft json 4. Can this be upgraded to 7.x?
thanks

Upload File Async Dropbox

I have been trying for quite awhile with the upload file async. You do not provide a example of this. also the normal upload file either fails or basically freezes up the machine that it is running on until the upload is finished and if this is a large file this can take sometime to complete. Can some one please provide a example of the the upload file Async please. I am new to this tech.

Any way to avoid using local files in whisper transcription?

Hello! Found this example. Works great. However is there a way to avoid using files, because using it from webapi, getting mp3 file as multipart/form-data ?

 var cl = new OpenAIClient(Environment.GetEnvironmentVariable(Consts.ENV_VAR_OPEN_API_KEY));

 var p = new AudioTranslationsParameter();
 p.File.SetFile("C:\\Users\\38097\\Music\\test-whisper\\rev.mp3", 
     new MemoryStream(File.ReadAllBytes("C:\\Users\\38097\\Music\\test-whisper\\rev.mp3")));
 p.Model = "whisper-1";

 var res = await cl.AudioTranslationsAsync(p);

Thank you in advance!

Assistants API with Azure OpenAI - Resource not found

Hi @higty - love this library.

I had used the assistants API via direct OpenAI subscription.

  • Everything works 👍

I now have access to Azure OpenAI subscription. With the AzureSettings class, created the OpenAIClient as per the documentation. Set the API Version too. However, unable to get the Assistatns API working.

  • I get Resource not found exception.

Please note:

  • I can make use of the Azure OpenAI studio and create assistant and run that on the web portal. - works
  • I created a postman request, and able to create assistant. - works

Request URL

Payload

{
    "tools": [],
    "name": "Math Tutor",
    "instructions": "You are a personal math tutor. Answer questions briefly, in a sentence or less.",
    "model": "gpt-4-1106-preview",
    "file_ids": []
}

AssistantCreateParameter class has a GetApiPath() set to /assistants. Should it be /openai/assistants instead?

  • I tried setting the endpointUri to - ending with /
  • I tried setting the endpointUri to - ending with /openai/ as well

No luck.

Please confirm if the library was tested with the Azure OpenAI?

Some guidance over this query would be helpful. Appreciate your time.

HigLabo.Mapper Can not Convert Array To List

.Net 5 version, HigLabo.Mapper.Test add two test cases, fail

` [TestMethod]
public void ObjectMapper_ArrayProperty_ListProperty()
{
var mapper = new ObjectMapper();
var src = new
{
Ids = new int[] { 1, 2, 3 }
};
var dst = new
{
Ids = new List()
};
dst = mapper.Map(src, dst);
Assert.AreEqual(src.Ids.Length, dst.Ids.Count);
Assert.AreEqual(src.Ids[0], dst.Ids[0]);
Assert.AreEqual(src.Ids[1], dst.Ids[1]);
Assert.AreEqual(src.Ids[1], dst.Ids[1]);
}

    [TestMethod]
    public void ObjectMapper_Array_List()
    {
        var mapper = new ObjectMapper();
        var src = new int[] { 1, 2, 3 };
        var dst = new List<int>();
        dst = mapper.Map(src, dst);
        Assert.AreEqual(src.Length, dst.Count);
        Assert.AreEqual(src[0], dst[0]);
        Assert.AreEqual(src[1], dst[1]);
        Assert.AreEqual(src[1], dst[1]);
    }`

Check if mail is bounced

Hi

Very cool project. I like to know if is possible see is mail is bounced like aspose

`  BounceResult bounced = mailMessage.CheckBounced();

    if (bounced.IsBounced == true)
    {
             continue;
     }              `

Enconding error

Wrong parse subject with text:
=?utf-8?B?0J7RgtGH0ZHRgiDQviDQtNCy0LjQttC10L3QuNC4INCy0LDQ?=\r\n =?utf-8?B?s9C+0L3QvtCyINGBINGD0LPQu9GR0Lwg0JDQniAi0KHQuNCx0YPQs9C7?=\r\n =?utf-8?B?0LXQvNC10YIiINC90LAg0YLQtdGA0LzQuNC90LDQu9C1INCe0J7QniAi?=\r\n =?utf-8?B?0JLQodCaIg==?=\r\n

01

InvalidMimeFormatException was thrown

I find the bug in MimeStreamBuffer, occurs when the loaded buffer end with char 10 and call the ReadLine function ( this._Current goto this._End +1) and the IsEnd fail.
For fix change
public Boolean IsEnd()
{
return this._Current == this._End || _IsLastOfLine;
}
To
public Boolean IsEnd()
{
return this._Current >= this._End || _IsLastOfLine;
}

Method not found: 'Boolean HigLabo.Core.ServerSentEventLine.IsEvent()

hi,

Method not found: 'Boolean HigLabo.Core.ServerSentEventLine.IsEvent()

i'm facing this issue when calling RunCreateStreamAsync => GetStreamAsync => item.IsEvent()

it says it doesn't exist.

in this ServerSentEventLine struct, i actually can't see it.

I am using latest vession

Thanks in advance

Unable to open the saved image file

@higty This is a great repo and an innovative way of generating code. Love this ❤️

I was trying to download the image and save it as PNG to disc. I am unable to get this working. Sample code is given below.

Note: Retrieving the same file content via Postman and saving it to disc as PNG is working; however not with the library.

Sample code

    [Fact]
    public async Task ShouldSaveImage()
    {
        var client = Singleton.Instance.OpenAIClient;
        var fileId = "file-P2UVwnSXOTx3KOcS8S6WCxxx";
        var fileContentGetResponse = await client.FileContentGetAsync(fileId);
        WriteToImageFile(fileId, fileContentGetResponse.GetResponseBodyText());
    }

    private static void WriteToImageFile(string fileName, string content)
    {
        using FileStream fs = new($"{fileName}.png", FileMode.Create);
        byte[] imageBytes = Encoding.ASCII.GetBytes(content);
        fs.Write(imageBytes, 0, imageBytes.Length);
        fs.Flush();
    }

Expected image (saved via Postman)
expected

Actual image (saved via code above)
actual

A quick help would be really helpful.

Please update package dependencies

It appears that HigLabo.Mail v.1.0.2.4 has undeclared dependencies to HigLabo.Core and HigLabo.Converter. Installing HigLabo.Mail without also installing the mentioned dependencies causes failures when sending mail.

[RSS] ArgumentNullException on valid endpoint

Hi,

I have test with a valide rss enpoint but in the RSS library an error throw

Endpoint RSS :
http://www.cannes.maville.com/flux/rss/actu.php

Error :
System.ArgumentNullException: Value cannot be null.
Parameter name: ns
at System.Xml.Linq.XNamespace.op_Addition(XNamespace ns, String localName)
at HigLabo.Rss.RssItem_2_0.Parse(XElement element)
at HigLabo.Rss.Rss_2_0_Parser.CreateRssItem(XElement element)
at HigLabo.Rss.RssParser.b__3_0(XElement el)

Can you check please ?

Thks a lot

Malformed Quoted-Printable MIME content in SmtpMessage with HTML body

I noticed that in messages with an HTML body, a '.' (period) may get dropped when in happens to be at the end, or beginning, of a line in the "Quoted-Printable" content.

Example from an actual e-mail (redacted):

[email protected]"=0D=0ATrue  : Sending "Xxxxxxxx Xxxxx Report for XXX XXX XXXX=
XX - XXX XXXXXX XXXX" to "[email protected]"=0D=0ATrue  : Sending "Xxxxxxx=
x Xxxxx Xxxxxx for XXX XXX XXXXXX - XXX XXXXXX XXXX" to "xxxxxxxxxxx@xxxxx=
gr"=0D=0ATrue  : Sending "Xxxxxxxx Xxxxx Report for XXX XXXXXXXXX - XXXXX=

In the last pair of lines there should be a period so that the resulting text is to "[email protected]"

It would appear that the last line should be one character longer, but I don't know how Quoted-Printable encoding works.

Are you planning to add vector store usage for file search support?

Hello! Cool news from OpenAI: https://platform.openai.com/docs/assistants/whats-new

We're launching an improved retrieval tool called file_search, which can ingest up to 10,000 files per assistant - 500x more than before. It is faster, supports parallel queries through multi-threaded searches, and features enhanced reranking and query rewriting.
Alongside file_search, we're introducing vector_store objects in the API. Once a file is added to a vector store, it's automatically parsed, chunked, and embedded, made ready to be searched. Vector stores can be used across assistants and threads, simplifying file management and billing.

Share, if you going to add vector stores support. Have a nice day! Thank you!

Missing HigLabo.Core.EnumToLowerStringConverter Type when executing code

I'm trying this library out to make use of the Assistants form OpenAI and after I've installed the nuget package HigLabo.OpenAI 7.0.0 I execute my application and on this line new OpenAIClient() it fails with this exception:

System.TypeLoadException: Could not load type 'HigLabo.Core.EnumToLowerStringConverter' from assembly 'HigLabo.NewtonsoftJson, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at HigLabo.OpenAI.OpenAIJsonConverter..ctor()
   at HigLabo.OpenAI.OpenAIClient..ctor(String apiKey)
   at Program.<Main>$(String[] args) in C:\Users\Dandre\RiderProjects\OpenAiTestbed\OpenAiTestbed\Program.cs:line 3
   at Program.<Main>(String[] args)

I'm not sure if the class is missing from those nuget packages but would you mind having a look to get this fixed? I have been able to compile the source code in the meantime which seems to work.

Also, I did run into an additional problem where the ThreadObject class was using string for Metadata instead of object or something like that. Please also update that part so that it can work against the latest API from OpenAI.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.