class LlamaCppEmbeddingsThe async caller should be used by subclasses to make any async calls, which will thus benefit from the concurrency and retry logic.
Method to generate embeddings for an array of documents. Splits the documents into batches and makes requests to the AlibabaTongyi API to generate embeddings.
Method to generate an embedding for a single document. Calls the embeddingWithRetry method with the document as the input.
Initializes the llama_cpp model for usage in the chat models wrapper.
// Initialize LlamaCppEmbeddings with the path to the model file
const embeddings = await LlamaCppEmbeddings.initialize({
modelPath: llamaPath,
});
// Embed a query string using the Llama embeddings
const res = embeddings.embedQuery("Hello Llama!");
// Output the resulting embeddings
console.log(res);