# Embed and Add to Knowledge Base

Generate document embeddings and write them to a knowledge base index for retrieval.

This node saves vectors to the knowledge base. Use [Text Embedding](https://omnifabric.cloudsigma.com/docs/guides/ai-studio/processing/workflow/nodes/ai-processing/text-embedding.html.md) if you only need vectors for further processing.

## Configure the knowledge base

Bind `documents` from parsing or chunking and select the target knowledge base.

| Setting | Description |
| --- | --- |
| Knowledge base | Required; select or create a target that provides the index table and embedding model settings |
| Multi-level retrieval | Enabled by default; builds document, section, and chunk indexes |
| Chunks per section | Default: 3; groups consecutive chunks into sections when multi-level retrieval is enabled |

The selected knowledge base supplies `table_name` and `embedding_model`. Retain document source metadata for index management and tracing.

## Use the output

| Output | Purpose |
| --- | --- |
| `written` | Number of document or index rows actually written |
| `table_name` | Table receiving the index |
| `embedding_model` | Model used to build the index |

With multi-level retrieval, `written` includes rows at document, section, and chunk levels.

## Example: index manuals

Flow: Read CloudSigma Volume → General Document Parsing → Segment → Embed and Add to Knowledge Base.

Select the manual knowledge base, keep multi-level retrieval enabled, and set chunks per section to 3. After running, check the target table and row count, then verify the content through knowledge base retrieval.

## Related pages

- [Variables and data flow](https://omnifabric.cloudsigma.com/docs/guides/ai-studio/processing/workflow/variables-and-data.html.md)
- [Run and debug](https://omnifabric.cloudsigma.com/docs/guides/ai-studio/processing/workflow/run-debug.html.md)
