Skip to main content
.NETFramework4.6.2net6.0net7.0net8.0.NETStandard2.0

Anyscale Endpoints Chat model provider.

Published
Feb 4, 2024
2y ago
Total Downloads
372.4K
372,352

Install

dotnet add package LangChain.Providers.Anyscale --version 0.12.3-dev.106
ProductVersions
.NET
net6.0net7.0net8.0
.NET Standard
netstandard2.0
Other
.NETFramework4.6.2

README

πŸ¦œοΈπŸ”— LangChain

Nuget package dotnet License: MIT Discord

All Contributors

⚑ Building applications with LLMs through composability ⚑
C# implementation of LangChain. We try to be as close to the original as possible in terms of abstractions, but are open to new entities.

While the SemanticKernel is good and we will use it wherever possible, we believe that it has many limitations and based on Microsoft technologies. We proceed from the position of the maximum choice of available options and are open to using third-party libraries within individual implementations.

I want to note:

  • I’m unlikely to be able to make serious progress alone, so my goal is to unite the efforts of C# developers to create a C# version of LangChain and control the quality of the final project
  • I try to accept any Pull Request within 24 hours (of course, it depends, but I will try)
  • I'm also looking for developers to join the core team. I will sponsor them whenever possible and also share any money received.
  • I also respond quite quickly on Discord for any questions related to the project

Usage

You can use our wiki to get started: https://github.com/tryAGI/LangChain/wiki
Also see examples for example usage or tests.

// Price to run from zero(create embeddings and request to LLM): 0,015$
// Price to re-run if database is exists: 0,0004$
// Dependencies: LangChain, LangChain.Databases.Sqlite, LangChain.Sources.Pdf
var gpt35 = new Gpt35TurboModel("OPENAI_API_KEY");

if (!File.Exists("vectors.db"))
{
    var documents = await PdfPigPdfSource.FromUriAsync(
        new Uri("https://canonburyprimaryschool.co.uk/wp-content/uploads/2016/01/Joanne-K.-Rowling-Harry-Potter-Book-1-Harry-Potter-and-the-Philosophers-Stone-EnglishOnlineClub.com_.pdf"));
    
    await SQLiteVectorStore.CreateIndexFromDocuments(
        embeddings: gpt35,
        documents: documents,
        filename: "vectors.db",
        tableName: "vectors",
        textSplitter: new RecursiveCharacterTextSplitter(
            chunkSize: 200,
            chunkOverlap: 50));
}

var database = new SQLiteVectorStore(
    filename: "vectors.db",
    tableName: "vectors",
    embeddings: gpt35);
const string question = "Who was drinking a unicorn blood?";
var similarDocuments = await database.GetSimilarDocuments(question, amount: 5);

var answer = await gpt35.GenerateAsync(
    $"""
     Use the following pieces of context to answer the question at the end.
     If the answer is not in context then just say that you don't know, don't try to make up an answer.
     Keep the answer as short as possible.

     {similarDocuments.AsString()}

     Question: {question}
     Helpful Answer:
     """, CancellationToken.None).ConfigureAwait(false);

Console.WriteLine($"LLM answer: {answer}"); // The cloaked figure.
Console.WriteLine($"Total usage: {gpt35.TotalUsage}");

Contributors

Konstantin S.
πŸš‡ ⚠️ πŸ’»

TesAnti
πŸš‡ ⚠️ πŸ’»

Khoroshev Evgeniy
πŸš‡ ⚠️ πŸ’»

SiegDuch
πŸš‡

gunpal5
πŸš‡ ⚠️ πŸ’»

Ketan Khare
πŸš‡ ⚠️ πŸ’»

Roderic Bos
πŸš‡ ⚠️ πŸ’»

Peter James
πŸš‡ ⚠️ πŸ’»

Ty Augustine
πŸš‡ ⚠️ πŸ’»

Support

Priority place for bugs: https://github.com/tryAGI/LangChain/issues
Priority place for ideas and general questions: https://github.com/tryAGI/LangChain/discussions
Discord: https://discord.gg/Ca2xhfBf3v

Changes from Previous Version

v0.12.3-dev.103v0.12.3-dev.106
Added Frameworks
.NETFramework4.6.2net6.0net7.0net8.0.NETStandard2.0
Added Dependencies
LangChain.Core(.NETFramework4.6.2)
Anyscale(.NETFramework4.6.2)
Anyscale(net6.0)
Anyscale(net7.0)
Anyscale(net8.0)
LangChain.Core(.NETStandard2.0)
Anyscale(.NETStandard2.0)

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 5 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.