IMPORTANT! This package is currently in an early alpha preview, please provide any feedback via GitHub issues.
โก Building applications with LLMs through composability โก
This is the .NET language implementation of LangChain.
You should install LangChain.NET with NuGet:
Install-Package LangChain.NET
Or via the .NET Core command line interface:
dotnet add package LangChain.NET
Either commands, from Package Manager Console or .NET Core CLI, will download and install LangChain.NET and all required dependencies.
See examples for example usage.
var model = new OpenAI();
var result = await model.Call("What is a good name for a company that sells colourful socks?");
Console.WriteLine(result);
$ dotnet run .
Socktastic!
Or using chains
var llm = new OpenAi();
var template = "What is a good name for a company that makes {product}?";
var prompt = new PromptTemplate(new PromptTemplateInput(template, new List<string>(1){"product"}));
var chain = new LlmChain(new LlmChainInput(llm, prompt));
var result = await chain.Call(new ChainValues(new Dictionary<string, object>(1)
{
{ "product", "colourful socks" }
}));
// The result is an object with a `text` property.
Console.WriteLine(result.Value["text"]);
$ dotnet run .
Socktastic!