Skip to content
Docs

Knowledge Base Insert

Knowledge Base Insert writes the embedded chunks from Embed into a knowledge base. It is the final node of the ingest pipeline: after it runs, the chunks are searchable. You find it on the node picker’s AI shelf.

Ingest: Read a File as Text → Split Text → Contextualize Chunks (optional) → Embed → Knowledge Base Insert
Read back: Knowledge Base Query (search) or Read Knowledge Base (read whole)
A Carrier KB ingestion flow on the canvas: Start, then Load carrier document, Split into chunks, Embed chunks and Store in knowledge base, one after the other
A Carrier KB ingestion flow on the canvas: Start, then Load carrier document, Split into chunks, Embed chunks and Store in knowledge base, one after the other

The node has one input handle and one output handle.

Without a source key the node is append-only: a scheduled ingest re-stores its whole corpus every run, the knowledge base grows without bound, and retrieval decays as copies of the same chunk crowd out variety. With one, re-running the flow replaces each source’s stored chunks instead of appending, so a re-run is a refresh that also picks up edits to the source. Two ways to set it:

  • sourceKeyPath names a key inside each chunk’s own metadata (a dot path such as id or article.id), read per chunk, so one insert can carry chunks from many sources.
  • sourceKey names the single source all of this insert’s chunks came from, resolved once per run. Use it when the chunks carry no id of their own but the flow knows one:
{!! $start->url !!}

sourceKey takes precedence when both are set. Chunks whose key is missing or empty append.

The Knowledge Base Insert node's settings form, with the fields described below
The Knowledge Base Insert node's settings form, with the fields described below
FieldTypeDefaultDescription
Knowledge base (collectionId)string ✦ (required) — The knowledge base that the embedded chunks are written into.
Source key path (sourceKeyPath)string ✦ (optional) — The metadata key holding the id of the source each chunk came from, e.g. “id”. Set it, and re-running the flow refreshes each source instead of storing a second copy of it. Leave it empty and every run appends.
Source key (sourceKey)string ✦ (optional) — Identifies the single source that ALL of these chunks came from. Only needed when the source id is not in the chunk metadata — prefer the metadata key above.

Fields marked ✦ accept expressions.

Try this node — run it once against your own workspace, with your credentials, without building a flow first.

{
"inserted": 12,
"replaced": 12,
"collection_id": "01kta3s3r8292bh37btk6m947y"
}

inserted counts what actually landed; a chunk missing its text or embedding is skipped. replaced counts the previously stored chunks that were dropped for the same source keys.

The template Rag / VectorStore / Insert under Automation → Templates injects two chunks with metadata, embeds them with text-embedding-3-small, and inserts them into a demo knowledge base. The Rag / Contextualize template shows the same insert with a sourceKey set, so its re-runs refresh rather than duplicate.

  • The vectors must match the knowledge base’s dimension. A mismatch fails the node before anything is deleted or written.
  • The knowledge base records which provider and model embedded it, taken from the first write. A later insert embedded with a different model is refused, because vectors from two models are not comparable and mixing them silently breaks every search.
  • Writes are refused while the knowledge base is being re-embedded to another model; reads keep working throughout.
  • Each stored chunk’s metadata also records which flow and node wrote it, under a reserved _publicus key, so a mis-ingested corpus can name the flow to fix.