React Native RAG - v0.2.0
    Preparing search index...

    Interface Embeddings

    Defines the essential operations for an embedding model. An embedding model converts text into high-dimensional numerical vectors (embeddings), capturing semantic meaning. These embeddings are crucial for tasks like similarity search, clustering, and other NLP applications. This interface covers model lifecycle (loading, unloading) and the core embedding generation capability.

    interface Embeddings {
        embed: (text: string) => Promise<number[]>;
        load: () => Promise<Embeddings>;
        unload: () => Promise<void>;
    }

    Implemented by

    Index

    Properties

    Properties

    embed: (text: string) => Promise<number[]>

    Generates a numerical embedding (vector) for a given text string.

    Type Declaration

      • (text: string): Promise<number[]>
      • Parameters

        • text: string

          The input text for which to generate an embedding.

        Returns Promise<number[]>

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

    load: () => Promise<Embeddings>

    Loads the embedding model and its necessary resources (e.g., weights, tokenizer) into memory. This method should be called before attempting to generate any embeddings.

    Type Declaration

      • (): Promise<Embeddings>
      • Returns Promise<Embeddings>

        A promise that resolves to the instance of the Embeddings class once loaded.

    unload: () => Promise<void>

    Unloads the embedding model and its associated resources from memory. This is typically used to free up system resources when the model is no longer needed.

    Type Declaration

      • (): Promise<void>
      • Returns Promise<void>

        A promise that resolves once the model unloading is complete.