Function
The Corpus Server is the core component in UltraRAG for processing raw corpus documents. It supports parsing, extracting, and standardizing text or image content from various data sources, and provides multiple chunking strategies to convert raw documents into formats that can be directly used for subsequent retrieval and generation. The main functions of the Corpus Server include:- Document Parsing: Supports content extraction from multiple file types (such as .pdf, .txt, .md, .docx, etc.).
- Corpus Construction: Saves parsed content as a standardized .jsonl structure, where each line corresponds to an independent document.
- Image Conversion: Supports converting PDF pages into image corpora, preserving layout and visual structure information.
- Text Chunking: Provides multiple splitting strategies such as Token, Sentence, Recursive, etc.
data/corpus_example.jsonl
Document Parsing Examples
Text Parsing
The Corpus Server supports multiple text parsing formats, including.pdf, .txt, .md, .docx, .xps, .oxps, .epub, .mobi, .fb2, etc.
examples/build_text_corpus.yaml
examples/parameters/build_text_corpus_parameter.yaml
parse_file_path can be a single file or a folder path — when specified as a folder, the system will automatically traverse and batch read all parsable files within it.
Run Pipeline:
PDF to Image
In multi-modal RAG scenarios, one approach is to directly convert document pages into images and perform retrieval and generation in the form of complete images. The advantage of this method is that it can preserve the document’s layout, format, and visual structure, making retrieval and understanding closer to real reading scenarios.examples/build_image_corpus.yaml
examples/parameters/build_image_corpus_parameter.yaml
parse_file_path parameter can be specified as either a single file or a folder path. When set to a folder, the system will automatically traverse and process all files within it.
Run Pipeline:
MinerU Parsing
MinerU is an industry-acclaimed PDF parsing framework that supports high-precision text and layout structure extraction. UltraRAG seamlessly integrates MinerU as a built-in tool, which can be called directly in the Pipeline to achieve one-stop PDF → Text + Image corpus construction.examples/build_mineru_corpus.yaml
examples/parameters/build_mineru_corpus_parameter.yaml
parse_file_path parameter can be either a single file or a folder path.
Run Pipeline (downloading MinerU model is required for the first execution, which may be slow):
build_text_corpus and build_image_corpus, and can be directly used for multi-modal retrieval and generation tasks.
Document Chunking Examples
UltraRAG integrates the chonkie document chunking library and has built-in three mainstream chunking strategies:Token Chunker, Sentence Chunker, and Recursive Chunker, flexibly coping with different types of text structures.
Token Chunker: Chunks by tokenizer, word, or character, suitable for general text.Sentence Chunker: Splits by sentence boundaries, ensuring semantic integrity.Recursive Chunker: Suitable for well-structured long documents (such as books, papers), capable of automatically dividing content by hierarchy.
examples/corpus_chunk.yaml
examples/parameters/corpus_chunk_parameter.yaml
You can call parsing tools and chunking tools in the same Pipeline to build your own personalized knowledge base.