-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[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
Comments
Facing the same issue |
Do you have any workaround? |
It's because of changes in the latest version of the Microsoft.KernelMemory packages. One can either use older versions or work around the problem by implementing the GetTokens method themselves: edit: this was wrong, as far as I can tell from looking in the Microsoft.KernelMemory repository GetTokens is supposed to return text tokens, not embeddings. Here's a version that returns the proper tokens:
The classes that need updating are LLamaSharpTextEmbeddingGenerator and LLamaSharpTextGenerator which you can copy/paste to your project from the repository. Add GetTokens and change
to
where TextEmbeddingGenerator is whatever you named your LLamaSharpTextEmbeddingGenerator with GetTokens added, same with TextGenerator. The code that registers the above is found in method WithLLamaSharpDefaults in BuilderExtensions.cs in project LLamaSharp.KernelMemory, as are LLamaSharpTextEmbeddingGenerator and LlamaSharpTextGenerator. |
Is there any workaround for my project that is using the NuGet package? |
A PR to bring us up to date to the latest KernelMemory version would be appreciated :) |
@srulyg using the same version of the Microsoft.KernelMemory.Abstractions as LLamaSharp.KernelMemory as of 0.14 should eliminate the error, but if you need something that only works in later versions of Microsoft.KernelMemory you would probably be out of luck.
|
Thank you @SpaceAntelope ! This finally worked for me. |
I gave it a shot here #862 |
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();
}
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
Latest version of LLamaSharp (14)
Known Workarounds
No response
The text was updated successfully, but these errors were encountered: