LangChain
LangChain copied to clipboard
Can't find LLamaSharpModelInstruction in getting started example
Describe the bug
I tried your example in Getting-started
I'm getting a CS0103 compiler error - it can't find LLamaSharpModelInstruction
Error (active) CS0103 The name 'LLamaSharpModelInstruction' does not exist in the current context
So is it because 'LLamaSharpModelInstruction' is called something else now?
Steps to reproduce the bug
- created a .net 8 console app
- installed Langchain, llamacharp.Backend
<ItemGroup>
<PackageReference Include="LangChain" Version="0.15.0" />
<PackageReference Include="LLamaSharp.Backend.Cpu" Version="0.13.0" />
<PackageReference Include="LLamaSharp.Backend.Cuda11" Version="0.13.0" />
<PackageReference Include="LLamaSharp.Backend.Cuda12" Version="0.13.0" />
</ItemGroup>
- added following code:
using LangChain.Chains;
using LangChain.Providers.Downloader;
using LangChain.Providers.HuggingFace.Downloader;
using LangChain.Providers.LLamaSharp;
// get model path
var modelPath = await HuggingFaceModelDownloader.Instance.GetModel("TheBloke/Thespis-13B-v0.5-GGUF", "thespis-13b-v0.5.Q2_K.gguf", "main");
// load model
var model = LLamaSharpModelInstruction.FromPath(modelPath);
model.PromptSent += Console.Write;
model.TokenGenerated += Console.Write;
// building a chain
var prompt = @"
You are an AI assistant that greets the world.
World: Hello, Assistant!
Assistant:";
var chain =
Chain.Set(prompt, outputKey: "prompt")
| Chain.LLM(model, inputKey: "prompt");
chain.Run().Wait();
Expected behavior
I can compile and run the console app.
Screenshots
NuGet package version
<PackageReference Include="LangChain" Version="0.15.0" />
<PackageReference Include="LLamaSharp.Backend.Cpu" Version="0.13.0" />
<PackageReference Include="LLamaSharp.Backend.Cuda11" Version="0.13.0" />
<PackageReference Include="LLamaSharp.Backend.Cuda12" Version="0.13.0" />