RAG Pipeline Preprocessing — Capability Boundary Description
This document defines the capability scope, known limitations, and risk thresholds of the RAG Pipeline preprocessing system for reference.
1. File Type Support Matrix
1.1 Directly Supported File Types
| File Type | Extension | Parsing Step | Notes |
|---|---|---|---|
.pdf | PDF_CONTENT_EXTRACTION / TEXTIN / AZURE_DI / ALI_OCR / LLM_CONTENT_EXTRACTION | Basic parsing only applies to text-based PDFs; scanned documents require an OCR step | |
| Word Document | .docx | DOCX_CONTENT_EXTRACTION | Converted to Markdown via pypandoc, supports paragraphs/tables/embedded images |
| Legacy Word | .doc | Must first be converted via FILE_CONVERT_WITH_SPIRE or FILE_CONVERT_WITH_LIBREOFFICE | Cannot be parsed directly; must first be converted to .docx or .pdf |
| Markdown | .md | MD_CONTENT_EXTRACTION | Natively supported |
| Plain Text | .txt | TXT_CONTENT_EXTRACTION | Natively supported |
| Excel | .xlsx .xls | TABULAR_CONTENT_EXTRACTION | Subject to row/column limits, see §2 |
| CSV / TSV | .csv .tsv | TABULAR_CONTENT_EXTRACTION | — |
| PowerPoint | .pptx .ppt | Must first be converted via FILE_CONVERT_WITH_SPIRE or FILE_CONVERT_WITH_LIBREOFFICE | Direct content extraction is not supported; must first be converted to PDF |
| Image | .png .jpg .jpeg .gif .webp .svg | IMAGE_CONTENT_EXTRACTION | Uses a Vision LLM (such as GPT-4o) to describe image content, up to 300 words |
| Video | .mp4 .avi .mkv .mov | VIDEO_CONTENT_EXTRACTION | Extract audio track → transcribe to text |
| Audio | .mp3 .wav .flac .aac | AUDIO_CONTENT_EXTRACTION | Split into 60-second segments and transcribe segment by segment |
1.2 Unsupported / Explicitly Prohibited File Types
| Type | Description |
|---|---|
.exe | Hardcoded blacklist (_UNSUPPORTED_EXTENSIONS) |
.zip / .rar and other archives | No decompression step; the Pipeline does not process them |
.html / .xml | No dedicated parsing step |
.json / .yaml | No dedicated parsing step |
.eml / .msg emails | Not supported |
.dwg / .dxf CAD files | Not supported |
.rtf | No dedicated step (conversion via LibreOffice may be attempted, but not guaranteed) |
| Encrypted / password-protected files | Encrypted files of all formats cannot be processed |
2. File Size and Resource Limits
2.1 Precheck Limits (file_limit_checker)
A lightweight precheck is performed during upload. Files exceeding the limits will be rejected from upload or flagged with a warning:
| Dimension | Default Threshold | Configurable | Description |
|---|---|---|---|
| Character count | 15,000 characters | ✅ Via the FILE_LIMIT_CHECK_CONFIG environment variable | Applies to text-based files such as PDF/DOCX/TXT/MD/CSV/XLSX |
| Page count | 25 pages | ✅ Same as above | PDF by physical pages, Excel by sheet count, PPT by slide count |
⚠️ Bulk import from knowledge base file sources is not subject to this precheck limit, but oversized files still carry an OOM risk.
2.2 Resource Thresholds Within Pipeline Processing
| Resource Dimension | Threshold / Configuration | Risk |
|---|---|---|
| Parallel PDF page conversion | 50 pages per batch (PDFConversionDefaultOptions.CHUNK_SIZE) | Very large PDFs (500+ pages) may consume high memory during pdf2image conversion, potentially causing OOM |
| Table row count | Single sheet ≤ 20,000 rows | Exceeding the limit causes direct failure and parsing rejection |
| Table column count | Single sheet ≤ 200 columns | Exceeding the limit causes direct failure and parsing rejection |
| Table images | Single file ≤ 150 images (_MAX_IMAGES) | Excess images are ignored |
| Vectorization batch | 100 segments per batch (batch_size) | — |
| Segment image density | Single segment ≤ 5~8 images | Exceeding the limit triggers early splitting to avoid token overflow |
| Audio slicing | 60 seconds / segment | Long audio/video files generate a large number of transcription API calls |
| TextIn OCR | API-level maximum of 1,000 pages | Quota exhaustion will cause errors |
2.3 OOM / Resource Overload Risk Scenarios
| Scenario | Risk Level | Cause | Recommendation |
|---|---|---|---|
PDF > 200 pages + pdf2image | 🔴 High | pdf2image renders each page as an in-memory bitmap at 300 DPI; 200 pages ≈ several GB of memory | Use OCR steps (TextIn/Azure DI) instead of basic parsing |
| Excel single sheet > 10,000 rows | 🟡 Medium | Fully loaded into memory, generating a large number of segments | Pre-split the file or increase worker memory |
| Video > 2 hours | 🟡 Medium | ffmpeg audio extraction + 120 transcription requests of 60s each | Limit video duration or pre-split it |
| Single file containing 100+ embedded images | 🟡 Medium | Each image requires a Vision LLM call, resulting in high time and cost | Extract only key images |
| Bulk import of 1,000+ files | 🟡 Medium | Celery worker queue backlog, gevent concurrency limit of 100 | Import in batches and monitor queue depth |
3. File Parsing Capability Levels
3.1 Parsing Engine Comparison
| Engine | Parsing Method | Applicable Scenarios | Inapplicable Scenarios | Dependencies |
|---|---|---|---|---|
| Basic(pypdf / pdfplumber) | Direct extraction from text layer | Native text PDFs (exported from Word, generated by LaTeX, etc.) | Scanned documents, image PDFs, complex layouts | No external dependencies |
| TextIn OCR | Cloud OCR + layout analysis | Scanned documents, receipts, mixed-layout PDFs | — | TEXTIN_APP_ID / TEXTIN_APP_SECRET |
| Azure Document Intelligence | Cloud Layout/Read models | Table structure preservation, multi-column layouts | — | azure_ocr_endpoint / azure_ocr_key |
| Ali OCR | Alibaba Cloud OCR | Chinese scanned-document scenarios | — | Alibaba Cloud API credentials |
| LLM Parsing(PDF LLM) | Page screenshots → Vision LLM recognition | Extremely complex layouts, mixed text-image layouts | Large files (high cost, slow speed) | Vision LLM (GPT-4o, etc.) |
| pypandoc | Pandoc format conversion | DOCX → Markdown | Complex macros, ActiveX controls | Pandoc binary |
| LibreOffice / Spire | Format conversion engine | .doc→.docx, .ppt→.pdf | — | LibreOffice or Spire runtime |
3.2 Detailed Parsing Capabilities by File Type
PDF
| Feature | Basic | TextIn | Azure DI | LLM |
|---|---|---|---|---|
| Plain text extraction | ✅ | ✅ | ✅ | ✅ |
| Scanned / image PDF | ❌ Returns empty | ✅ | ✅ | ✅ |
| Table structure preservation | ❌ Formatting lost | ✅ | ✅(Layout mode) | ✅ |
| Multi-column layout |