All nodes/AI/RAG
RAG Query
Performs a semantic search over the knowledge base and returns relevant context. Takes the query via the 'query' port and the KB via the 'kb' port. The result is passed to the LLM to generate an answer.
Type in the graph: rag_query
Exec
An error branch can be enabled (expose_error_output) to handle failures on their own path.
Ports can be split into separate execution and data handles.
Try it
Minimal working workflow
- Execute + Data
Pick your own connection or knowledge base first — the graph carries REPLACE_ME.
When to use it
Reach for RAG Query when the context from a base is needed every time: a reference answer, a documentation lookup, fragments injected into a prompt before generation. The search runs on every pass, its result is predictable and visible in the run log. If the model itself should decide whether to search, that is RAG Tool. If you need to re-rank what was already found, put Rerank after it.
How it works
The Query port carries both the trigger and the query text. When only execution arrives there, the
text comes from the Query field — a template such as {{ inputs.query }} or
{{ nodes.x.output.text }}. The query is then turned into a vector and compared against the chunks of
the base.
The output is an object: context (the joined chunks), chunks (an array with score,
document_id, chunk_id and metadata), query and kb_found. With the text format the chunks are
joined by a --- separator; with json the context holds the serialised array. The context window
adds neighbouring chunks of the same document around every hit, and a score threshold of 0 means “keep
everything”.
The Embedding port accepts a ready vector from Embed Text — the query is then not embedded a second time. That vector must come from the same model as the base, otherwise the dimensions do not match.
Common mistakes
- Reading an empty result as a breakage.
kb_found: truewith an emptycontextmeans the base is there and nothing matched;falsemeans the base was not found (deleted, or owned by another workspace). - Sending the whole object into a prompt. Use
{{ nodes.<id>.output.context }}in the template, otherwise the model receives JSON with scores and metadata instead of text. - Nothing connected to the Query port. The node will not run: it has no separate execution input, the trigger arrives through that very port.
- Editing Top K here while a Knowledge Base node is connected. Top K, the threshold and the context window then arrive from there and the fields here are inactive.
- Raising the threshold “just in case”. Similarity values depend on the embedding model; start at 0
and raise it while looking at the real
scorevalues in the log.
Inputs
| Port | Wire | Payload | Notes |
|---|---|---|---|
Queryquery | Execute + Dataexecute_data | — | Search text; replaces the Query template when connected |
KBkb | Datadata | — | Knowledge Base node config: kb_id/top_k/score_threshold/context_window override the fields here, metadata_filters are combined with them |
Embeddingembedding | Datadata | — | Precomputed query vector from an embed_text node; skips embedding the query text again |
Outputs
| Port | Wire | Payload | Notes |
|---|---|---|---|
Contextoutput | Execute + Dataexecute_data | object |
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
Queryquery_template | string | {{inputs.query}} | Query text. Supports {{inputs.query}}, {{nodes.x.output.text}} supports templates |
Knowledge Basekb_id | string | "" | Knowledge base to search. A connected Knowledge Base node supplies this value and wins over the field. overridden by port: kb |
Top Ktop_k | integer | 5 | Maximum number of chunks to return. A connected Knowledge Base node supplies this value and wins over the field. overridden by port: kb |
Output Formatformat | string | text | text: concatenated chunks separated by ---. json: array with metadata. Options: |
| Advanced | |||
Score Thresholdscore_threshold | number | 0 | Minimum similarity score a chunk must reach. A connected Knowledge Base node supplies this value and wins over the field. overridden by port: kb |
Context Windowcontext_window | integer | 0 | Neighboring chunks to include around each result (0 = disabled). A connected Knowledge Base node supplies this value and wins over the field. overridden by port: kb |
Metadata Filtersmetadata_filters | array | — | Hard filters over chunk metadata (AND). Operators: = != < > <= >=. Combined with the connected KB node's filters rather than replaced by them. |
Shared fields
Every node has these three — the platform adds them, not the node author.
expose_error_output— When enabled, show an execution output to connect nodes that run if this step fails.split_ports_in— Show separate execution and data input handles instead of one combined port.split_ports_out— Show separate execution and data output handles instead of one combined port.