Closed twentytwokhz closed 1 year ago
var @params = new ModelParams(modelPath);
var embedder = new LLamaEmbedder(@params);
var result = embedder.GetEmbeddings("Hello");
This seems to work for me. result
is filled with a load of numbers which are presumably the embedding vector of "Hello"
I might not have explained it accurately 🥲 After creating that vector how can I use it within LlamaSharp for an existing model?
I don't think LLamaSharp itself has anything that will consume embeddings, that's usually down to your own system (e.g. an external vector database). What are you actually trying to do with the embeddings?
I'm trying to get the embedding from a text extracted from a PDF File. I want to feed it into the llm model for a QA type bot
Maybe I'm misunderstanding what you're asking, but I don't think you'd feed the embeddings into the LLM. Instead you would retrieve some text (e.g. using a vector database to find knowledge "nearby" the question embedding vector) and then feed that into the context when you ask your question. That's not something LLamaSharp does - it'll do the start (generate embeddings) and the end (run the LLM) but not the middle bit (use the embeddings to retrieve some knowledge).
I know some people have been working on higher level things (e.g. BotSharp and SemanticKernel) which may do more of what you want (I'm not very familiar with those projects, so I'm not sure)
Thank you for clarifying!
@twentytwokhz @martindevans Here is the updated docs related to how to adpot the LlamaSharp in a high level bot framework. I'll keep update the docs and let me know if you can run it through according the latest docs.
How should I use the LlamaEmbedder after I created one? I was not able to find any relevant information or code snippets. Thanks!