langchain.js
    Preparing search index...

    Class that extends the Embeddings class and provides methods for generating embeddings using Hugging Face models through the HuggingFaceInference API.

    Hierarchy (View Summary)

    • Toolkit
      • HuggingFaceInferenceEmbeddings

    Implements

    Index

    Constructors

    Properties

    apiKey?: string
    client: InferenceClient
    endpointUrl?: string
    model: string
    provider?:
        | "cohere"
        | "auto"
        | "novita"
        | "black-forest-labs"
        | "cerebras"
        | "fal-ai"
        | "featherless-ai"
        | "fireworks-ai"
        | "groq"
        | "hf-inference"
        | "hyperbolic"
        | "nebius"
        | "nscale"
        | "openai"
        | "ovhcloud"
        | "replicate"
        | "sambanova"
        | "together"

    Methods

    • Parameters

      • texts: string[]

      Returns Promise<number[][]>

    • Method that takes an array of documents as input and returns a promise that resolves to a 2D array of embeddings for each document. It calls the _embed method with the documents as the input.

      Parameters

      • documents: string[]

        Array of documents to generate embeddings for.

      Returns Promise<number[][]>

      Promise that resolves to a 2D array of embeddings for each document.

    • Method that takes a document as input and returns a promise that resolves to an embedding for the document. It calls the _embed method with the document as the input and returns the first embedding in the resulting array.

      Parameters

      • document: string

        Document to generate an embedding for.

      Returns Promise<number[]>

      Promise that resolves to an embedding for the document.