Skip to content

Retrieve context

Retrieve the most relevant documents from a vector store based on a user query.

Context retrieval is the step where semantic search happens: a query is embedded and compared against stored document embeddings to find the most similar content.

When this is useful

Retrieve context when you want to:

If you don’t yet have indexed documents, start with Create a vector store.

Retrieve context in KNIME

Prerequisites
  • A vector store (FAISS or Chroma)
  • The same embedding model used to create the store
  • A query provided as text (string column)

Retrieving context consists of three steps:

  1. Load the vector store
  2. Provide a query
  3. Retrieve the most similar entries

Step 1: Load the vector store

If the vector store was created in the same workflow, you can pass it directly to the retriever.

If the store was saved earlier, load it using:

This brings the vector store into memory so it can be queried.

Step 2: Provide a query

Provide the query you want to search for in the vector store. This is simply a string value and can come from any upstream node.

Step 3: Retrieve relevant context

Use the Vector Store Retriever node to perform the search.

The Vector Store Retriever performs two operations:

  1. Creates an embedding of the query
  2. Finds the most similar results from the vector store

To create the query embedding, the node needs the same embedding model that was used to embed the documents in the vector store. If a remote embedding model was used, this means you need:

  • an active internet connection
  • valid credentials to access the model

Configure the node to:

  • use the same embedding model as the vector store
  • embed the query automatically
  • return the top k most similar documents

The node compares the query embedding against the stored vectors and returns the most relevant entries.

Result

The output table contains the retrieved documents, ordered by semantic similarity.

Each row includes:

  • the original document text
  • a similarity score or distance

Next steps