LangChain.Providers.Anthropic
Anthropic API LLM and Chat model provider.
Install
| Product | Versions |
|---|---|
| .NET | |
| .NET Standard | |
| Other |
README
๐ฆ๏ธ๐ LangChain
โก 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.
โค๏ธ Our project includes https://github.com/jeastham1993/langchain-dotnet and tries to be updated with the latest changes there โค๏ธ
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.
var gpt4 = new Gpt4Model("OPENAI_API_KEY");
var index = await InMemoryVectorStore.CreateIndexFromDocuments(gpt4, new[]
{
"I spent entire day watching TV",
"My dog name is Bob",
"This ice cream is delicious",
"It is cold in space"
}.ToDocuments());
var chainQuestion =
Set("What is the good name for a pet?", outputKey: "question") |
RetrieveDocuments(index, inputKey: "question", outputKey: "documents") |
StuffDocuments(inputKey: "documents", outputKey: "context") |
Template("""
Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.
{context}
Question: {question}
Helpful Answer:
""", outputKey: "prompt") |
LLM(gpt4, inputKey: "prompt", outputKey: "pet_sentence");
var chainFilter =
// do not move the entire dictionary from the other chain
chainQuestion.AsIsolated(outputKey: "pet_sentence") |
Template("""
Human will provide you with sentence about pet. You need to answer with pet name.
Human: My dog name is Jack
Answer: Jack
Human: I think the best name for a pet is "Jerry"
Answer: Jerry
Human: {pet_sentence}
Answer:
""", outputKey: "prompt") |
LLM(gpt4, inputKey: "prompt", outputKey: "text");
var result = await chainFilter.Run(resultKey: "text");
// Bob
Contributors
Konstantin S.
๐ โ ๏ธ ๐ป
TesAnti
๐ โ ๏ธ ๐ป
Khoroshev Evgeniy
๐ โ ๏ธ ๐ป
SiegDuch
๐
gunpal5
๐ โ ๏ธ ๐ป
Ketan Khare
๐ โ ๏ธ ๐ป
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
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.