Example

// Initialize LlamaCppEmbeddings with the path to the model file
const embeddings = new LlamaCppEmbeddings({
modelPath: "/Replace/with/path/to/your/model/gguf-llama2-q4_0.bin",
});

// Embed a query string using the Llama embeddings
const res = embeddings.embedQuery("Hello Llama!");

// Output the resulting embeddings
console.log(res);

Hierarchy (view full)

Constructors

Methods

  • Generates embeddings for an array of texts.

    Parameters

    • texts: string[]

      An array of strings to generate embeddings for.

    Returns Promise<number[][]>

    A Promise that resolves to an array of embeddings.

  • Generates an embedding for a single text.

    Parameters

    • text: string

      A string to generate an embedding for.

    Returns Promise<number[]>

    A Promise that resolves to an array of numbers representing the embedding.

Generated using TypeDoc