LangChain icon indicating copy to clipboard operation
LangChain copied to clipboard

Can't find LLamaSharpModelInstruction in getting started example

Open markat1 opened this issue 1 year ago • 0 comments

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

  1. created a .net 8 console app
  2. 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>

  1. 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

image

image

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" />

markat1 avatar Jun 29 '24 16:06 markat1