# Prepare text and images for RAG

Choose [Prepare Document Knowledge Base](document-knowledge-base.md) for document text retrieval, or [Prepare Document Knowledge Base with Image Index](document-image-index.md) for page and document-image retrieval.

1. Prepare representative material containing text and images.
2. Select source files, a target knowledge base, and an output location.
3. Adjust parsing to the layout complexity, complete run parameters, and start processing.
4. Check parsed text, images, and indexes, then validate retrieval with known questions.

## Define retrieval goals

List the questions to answer. Use text knowledge base preparation for answers in prose, or the image-index variant for diagrams and page images. Use [Drawing Parsing](drawing-parsing.md) for engineering parts, regions, and relationships.

## Prepare validation material

Choose a representative file with text, tables, and images. Record known answers and page numbers. Prepare a knowledge base and output volume, plus matching image model settings when needed.

## Configure and inspect

Start with default chunking. Compare parsed content with the source, then inspect chunks and text indexing. For images, inspect page/object records and per-file status to confirm vectors were written.

| Validation | Method |
| --- | --- |
| Text questions | Compare retrieved passages with known answers |
| Table questions | Check numbers, units, and row/column relationships |
| Image retrieval | Check image records, source files, and index status |
| Saved results | Open the destination and inspect file lists and content |

## Adjust in order

Fix parsing before chunking when text is missing. Adjust chunks or overlap when correct text lacks context. For missing images, check manifests, models, and file status. Compare the same sample after each change before expanding scope.

[Back to workflow templates](index.md)
