Skip to content
KNIME Documentation
Main Navigation Get startedBuildWork with KnimeAccount and adminRelease notesDeveloper tools
Community Hub
DevelopersKnime 2.0
Sidebar Navigation

Getting Started

Installation

User Guide

Release Notes

Install Extensions

Building Workflows

Components

Flow Control

Expressions

File Handling

Deployment

Integrated Deployment

Workflow Invocation

Best Practices

Advanced Features

AI Extension

Get Started

Build an Agent

Inject context with RAG

LLM Providers

Tutorials

Summarize product reviews

Product FAQ assistant

Restaurant agent

Your first local agent

Task extractor

Reporting

Kerberos

Extensions

Database

Overview

Tutorials

Read and filter data from a database

Write a transformed dataset to a database

Concepts

Ports and Sessions

Query Generation

Type Mapping

Deprecated Framework

Connecting

Connect: Dedicated Node

Connect: File-Based Database

Connect: Generic DB Connector

Register a JDBC Driver

Install Third-Party Driver Plug-in

Drivers on Hub and Server

Kerberos Constrained Delegation

Reading and Transforming

Read Data

Transform Data Visually

Run a Custom SQL Query

Parameterize a Query

Writing and Modifying

Insert, Update, or Merge

Delete Rows

Bulk Load Data

Create and Remove Tables

Use Transactions

Reference

Connector Node Settings

JDBC Driver Reference

Deprecated Node Mapping

Migrate Deprecated Workflows

Python

Overview

Tutorials

Python Scripting Quickstart

Data App Development Using Plotly

Data Processing

K-AI Scripting Assistant

Data Type Conversion

Batch Processing

Jupyter Integration

Environment Management

Pixi Configuration

Dependency Management

Environment Persistence

Channel Mirrors & Air-Gapped Setups

Conda Migration

Alternative Configurations

Conda and Miniforge Setup

Conda Environment Propagation

Manual Python Configuration

Legacy Node Migration

Concepts

Pixi Backend Architecture

Storage Logic

Python Environments on Executors

Reference

Python Scripting API

Bundled Packages

Executor and Hub Configuration

Troubleshooting Guide

API Reference

Inputs and outputs

Classes

Views

Utility functions

R

Deep Learning

Snowflake

Google Cloud

Azure

AWS

Big Data

Big Data Admin

Big Data Secured Cluster

Databricks

Microsoft Fabric

Power BI

Tableau

Report Designer

H2O

Changelogs

Version 5.12

Version 5.11

Version 5.10

Version 5.9

Version 5.8

Version 5.7

Version 5.6

Version 5.5

Version 5.3

Extensions

What is Retrieval-Augmented Generation (RAG)? ​

Retrieval-Augmented Generation (RAG) is a pipeline that combines a language model with external knowledge at query time.

Instead of relying only on the model’s internal training data, RAG retrieves relevant information from your own documents and injects it into the prompt, allowing the model to generate responses that are grounded in up-to-date or private data.

Why RAG is needed ​

Large language models are powerful, but they have important limitations:

  • they cannot access private documents by default
  • they do not know about newly created or frequently changing data
  • they may hallucinate when asked about unknown topics

RAG addresses these limitations by separating knowledge storage from generation.

The model remains general-purpose, while your data is retrieved dynamically and provided as context only when needed.

The core idea behind RAG ​

At a high level, RAG works by:

  1. Converting documents into embeddings
  2. Storing those embeddings in a vector store
  3. Retrieving the most relevant content for a given query
  4. Injecting that content into the prompt sent to the model

The model then generates an answer using both:

  • the user’s question
  • the retrieved context

This keeps responses grounded in your data without retraining the model.

The main building blocks ​

Vector stores ​

A vector store holds embeddings that represent your documents in numerical form.

Similarity search is used to find the most relevant documents for a given query.

How to create one:

  • Create a vector store

Context retrieval ​

When a user asks a question, the query is embedded and compared against the vector store.

The most relevant entries are retrieved and passed downstream.

How to retrieve context:

  • Retrieve context

Prompt augmentation ​

Retrieved content must be merged into a prompt in a controlled way.

This step defines:

  • how much context is included
  • how it is framed
  • how the model should use it

How to inject context:

  • Inject context into a prompt
Pager
Next pageInstallation