Skip to content

[BUG]: Method 'GetTokens' in type 'LLamaSharp.KernelMemory.LLamaSharpTextEmbeddingGenerator' from assembly 'LLamaSharp.KernelMemory, Version=0.14.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation. #859

@srulyg

Description

@srulyg

Description

This is my code:

using LLama.Common;
using LLama;
using LLama.Native;
using System;
using LLamaSharp.KernelMemory;
using Microsoft.KernelMemory.Configuration;
using Microsoft.KernelMemory;
using System.Diagnostics;
using LLama.Abstractions;
using Microsoft.KernelMemory.AI;
using Microsoft.KernelMemory.AI.LlamaSharp;

namespace consoleapp_llamasharp
{
internal class Program
{
public static async Task Main(string[] args)
{
Program p = new Program();

        string modelPath = @"C:\Users\Llama-2-7b-chat-hf-finetune-q5_k_m-v1.0\Llama-2-7b-chat-hf-finetune-q5_k_m-v1.0.gguf";
        LLama.Common.InferenceParams infParams = new() { AntiPrompts = ["\n\n"], MaxTokens = 100, TokensKeep = 100 };
        LLamaSharpConfig lsConfig = new(modelPath) { DefaultInferenceParams = infParams };
        SearchClientConfig searchClientConfig = new() { MaxMatchesCount = 1, AnswerTokens = 100 };
        TextPartitioningOptions parseOptions = new() { MaxTokensPerParagraph = 300, MaxTokensPerLine = 100, OverlappingTokens = 30 };

        try
        {
            IKernelMemory memory = new KernelMemoryBuilder()
            .WithLLamaSharpDefaults(lsConfig)
            .WithSearchClientConfig(searchClientConfig)
            .With(parseOptions)
            .Build();



            // Ingest documents (format is automatically detected from the filename)
            string documentFolder = @"C:\Users\\te.pdf";
            string[] documentPaths = Directory.GetFiles(documentFolder, "*.txt");
            for (int i = 0; i < documentPaths.Length; i++)
            {
                await memory.ImportDocumentAsync(documentPaths[i], steps: Constants.PipelineWithoutSummary);
            }

            // Allow the user to ask questions forever
            while (true)
            {
                Console.Write("\nQuestion: ");
                string question = Console.ReadLine() ?? string.Empty;
                MemoryAnswer answer = await memory.AskAsync(question);
                Console.WriteLine($"Answer: {answer.Result}");
            }

        }
        catch (Exception e)
        {

            Console.WriteLine(e.Message);
        }

    }
}

}

Just try running this, and you'll get this error:

Method 'GetTokens' in type 'LLamaSharp.KernelMemory.LLamaSharpTextEmbeddingGenerator' from assembly 'LLamaSharp.KernelMemory, Version=0.14.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

Reproduction Steps

Just run the code provided above.

Environment & Configuration

  • Operating system:
  • .NET runtime version:
  • LLamaSharp version:
  • CUDA version (if you are using cuda backend):
  • CPU & GPU device:
    Latest version of LLamaSharp (14)

Known Workarounds

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions