Skip to content

HuggingFace Embeddings

HuggingFace Embeddings turns text into a numeric fingerprint of its meaning using a Hugging Face model served by an inference service. With that fingerprint, NappAI can find the documents that say something similar to what you are looking for, even when they use different words, for example in a knowledge base.

You connect the component to a vector database, which uses it both to store your documents and to search them. Use it if your company works with Hugging Face or has its own inference service running a Hugging Face model.

When to use it

  • Give an agent the knowledge in your manuals, contracts or FAQs by storing them in a vector database.
  • Build an internal search that finds documents by their meaning, not only by exact words.
  • You want to use a specific model published on Hugging Face.

Configuration

FieldWhat it does
Credential (required)The credential of the service HuggingFace API. Pick one with Choose an option or create one with Add new credential. See Credentials.
Model NameThe name of the Hugging Face model that calculates the fingerprints. Default: BAAI/bge-large-en-v1.5, a model for English text.

Advanced options

FieldWhat it does
API KeyThe key of your Hugging Face account; it is shown hidden. The component needs it to work. The value can also come from another component, for example Environment Variable.
API URLThe address of the Hugging Face inference service the component connects to. Type the address of your service.

Batch processing

With the Batch Mode switch on, the component runs once for each item of the list you connect to Batch Input and returns all the results together as a list. Parallel Executions sets how many items are processed at the same time (1 to 5). Skip if Empty Batch Input skips the component when the list arrives empty, and Skip Branch if Empty Output stops the following components when the result is empty. More in Key concepts.

Output

Example

An architecture firm, Estudio Albar, wants its assistant to answer using its archive of project reports.

  1. In a loading flow, split the documents into chunks with Recursive Character Text Splitter and pass them to Chroma DB with Operation set to Add.
  2. Add HuggingFace Embeddings and connect its Embeddings output to the Embedding input of Chroma DB.
  3. In the assistant flow, use the same Chroma DB collection with the same HuggingFace Embeddings component to find the chunks that answer each question.

Good practices

  • The default model is designed for English text. If your documents are in Spanish or in several languages, type a multilingual Hugging Face model in Model Name.