Skip to main content

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 TypeExtensionParsing StepNotes
PDF.pdfPDF_CONTENT_EXTRACTION / TEXTIN / AZURE_DI / ALI_OCR / LLM_CONTENT_EXTRACTIONBasic parsing only applies to text-based PDFs; scanned documents require an OCR step
Word Document.docxDOCX_CONTENT_EXTRACTIONConverted to Markdown via pypandoc, supports paragraphs/tables/embedded images
Legacy Word.docMust first be converted via FILE_CONVERT_WITH_SPIRE or FILE_CONVERT_WITH_LIBREOFFICECannot be parsed directly; must first be converted to .docx or .pdf
Markdown.mdMD_CONTENT_EXTRACTIONNatively supported
Plain Text.txtTXT_CONTENT_EXTRACTIONNatively supported
Excel.xlsx .xlsTABULAR_CONTENT_EXTRACTIONSubject to row/column limits, see §2
CSV / TSV.csv .tsvTABULAR_CONTENT_EXTRACTION
PowerPoint.pptx .pptMust first be converted via FILE_CONVERT_WITH_SPIRE or FILE_CONVERT_WITH_LIBREOFFICEDirect content extraction is not supported; must first be converted to PDF
Image.png .jpg .jpeg .gif .webp .svgIMAGE_CONTENT_EXTRACTIONUses a Vision LLM (such as GPT-4o) to describe image content, up to 300 words
Video.mp4 .avi .mkv .movVIDEO_CONTENT_EXTRACTIONExtract audio track → transcribe to text
Audio.mp3 .wav .flac .aacAUDIO_CONTENT_EXTRACTIONSplit into 60-second segments and transcribe segment by segment

1.2 Unsupported / Explicitly Prohibited File Types

TypeDescription
.exeHardcoded blacklist (_UNSUPPORTED_EXTENSIONS)
.zip / .rar and other archivesNo decompression step; the Pipeline does not process them
.html / .xmlNo dedicated parsing step
.json / .yamlNo dedicated parsing step
.eml / .msg emailsNot supported
.dwg / .dxf CAD filesNot supported
.rtfNo dedicated step (conversion via LibreOffice may be attempted, but not guaranteed)
Encrypted / password-protected filesEncrypted 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:

DimensionDefault ThresholdConfigurableDescription
Character count15,000 characters✅ Via the FILE_LIMIT_CHECK_CONFIG environment variableApplies to text-based files such as PDF/DOCX/TXT/MD/CSV/XLSX
Page count25 pages✅ Same as abovePDF 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 DimensionThreshold / ConfigurationRisk
Parallel PDF page conversion50 pages per batch (PDFConversionDefaultOptions.CHUNK_SIZE)Very large PDFs (500+ pages) may consume high memory during pdf2image conversion, potentially causing OOM
Table row countSingle sheet ≤ 20,000 rowsExceeding the limit causes direct failure and parsing rejection
Table column countSingle sheet ≤ 200 columnsExceeding the limit causes direct failure and parsing rejection
Table imagesSingle file ≤ 150 images (_MAX_IMAGES)Excess images are ignored
Vectorization batch100 segments per batch (batch_size)
Segment image densitySingle segment ≤ 5~8 imagesExceeding the limit triggers early splitting to avoid token overflow
Audio slicing60 seconds / segmentLong audio/video files generate a large number of transcription API calls
TextIn OCRAPI-level maximum of 1,000 pagesQuota exhaustion will cause errors

2.3 OOM / Resource Overload Risk Scenarios

ScenarioRisk LevelCauseRecommendation
PDF > 200 pages + pdf2image🔴 Highpdf2image renders each page as an in-memory bitmap at 300 DPI; 200 pages ≈ several GB of memoryUse OCR steps (TextIn/Azure DI) instead of basic parsing
Excel single sheet > 10,000 rows🟡 MediumFully loaded into memory, generating a large number of segmentsPre-split the file or increase worker memory
Video > 2 hours🟡 Mediumffmpeg audio extraction + 120 transcription requests of 60s eachLimit video duration or pre-split it
Single file containing 100+ embedded images🟡 MediumEach image requires a Vision LLM call, resulting in high time and costExtract only key images
Bulk import of 1,000+ files🟡 MediumCelery worker queue backlog, gevent concurrency limit of 100Import in batches and monitor queue depth

3. File Parsing Capability Levels

3.1 Parsing Engine Comparison

EngineParsing MethodApplicable ScenariosInapplicable ScenariosDependencies
Basic(pypdf / pdfplumber)Direct extraction from text layerNative text PDFs (exported from Word, generated by LaTeX, etc.)Scanned documents, image PDFs, complex layoutsNo external dependencies
TextIn OCRCloud OCR + layout analysisScanned documents, receipts, mixed-layout PDFsTEXTIN_APP_ID / TEXTIN_APP_SECRET
Azure Document IntelligenceCloud Layout/Read modelsTable structure preservation, multi-column layoutsazure_ocr_endpoint / azure_ocr_key
Ali OCRAlibaba Cloud OCRChinese scanned-document scenariosAlibaba Cloud API credentials
LLM Parsing(PDF LLM)Page screenshots → Vision LLM recognitionExtremely complex layouts, mixed text-image layoutsLarge files (high cost, slow speed)Vision LLM (GPT-4o, etc.)
pypandocPandoc format conversionDOCX → MarkdownComplex macros, ActiveX controlsPandoc binary
LibreOffice / SpireFormat conversion engine.doc.docx, .ppt.pdfLibreOffice or Spire runtime

3.2 Detailed Parsing Capabilities by File Type

PDF

FeatureBasicTextInAzure DILLM
Plain text extraction
Scanned / image PDF❌ Returns empty
Table structure preservation❌ Formatting lost✅(Layout mode)
Multi-column layout❌ Text disorder
Hyperlink extraction✅(pdfplumber
Embedded image extraction✅(converted to PNG)
Processing speed⚡ Fast🐢 Medium🐢 Medium🐌 Slow
CostFree💰 Charged per page💰 Charged per page💰💰 Charged per token

DOCX

FeatureSupport Status
Paragraph text
Tables✅(converted to Markdown tables)
Embedded images✅(extracted as separate files + Markdown markers)
TOC / bookmarks⚠️ Partial (may be lost during Pandoc conversion)
Macros / VBA❌ Ignored
Revision marks / comments❌ Lost
Complex nested tables⚠️ Pandoc behavior is unstable

Tabular Files (Excel / CSV)

FeatureSupport Status
Multiple sheets✅ Processed sheet by sheet
Formulas⚠️ Only calculated values are read (data_only=True)
Charts / pivot tables❌ Ignored
Embedded images✅(up to 150 images / file)
Merged cells⚠️ May cause data misalignment
More than 20,000 rows❌ Parsing rejected
More than 200 columns❌ Parsing rejected

Audio and Video

FeatureSupport Status
Speech-to-text✅(60s segmented transcription)
Multilingual recognitionDepends on the transcription service model
Speaker diarization
Background music / noise⚠️ Affects transcription quality
Video visual content recognition❌ Audio track only is extracted
Subtitle / CC extraction

Images

FeatureSupport Status
Image content description✅ Vision LLM description(≤ 300 words)
OCR text recognition⚠️ Depends on Vision LLM capability; not professional OCR
Chart / flowchart understanding⚠️ Limited (determined by LLM comprehension)
SVG vector graphics⚠️ Depends on whether the LLM can render them

4. Segmentation Capabilities and Limitations

Segmentation MethodApplicable ScenariosParametersLimitations
Fixed character countFIXED_SIZEGeneral textchunk_size=1024May split in the middle of a sentence; single segment ≤ 5~8 images
By pagePAGEPDF documentsOnly valid for PDF; segment quality may vary greatly when page content differs significantly
By titleTITLEMarkdown documentschunk_size=1024Only recognizes # / ## / ### headings; without headings, degrades to one segment for the entire document
TabularTABULARExcel / CSVDedicated to tabular files
LLM intelligentLLMScenarios requiring semantic coherenceSlow and costly; uneconomical for large files
RefineREFINESecondary optimization of coarse segmentation resultsMust be used together with upstream coarse segmentation steps

General limitations:

  • Protects tables / code blocks from being split during segmentation (RecursiveCharacterTextSplitter fallback separators)
  • Overlong segments (> 65% of chunk_size) use spaCy for sentence-level refinement
  • Too many images in a single segment (> 5 images) trigger forced splitting

5. Field Extraction Capabilities

StepFunctionDependencyLimitation
METADATA_EXTRACTIONDocument-level metadata (title/author/date, etc.)LLMSchema must be predefined
SEGMENT_METADATA_EXTRACTIONSegment-level metadataLLMOne LLM call per segment; costly for large files
KEYWORDS_EXTRACTIONKeyword extractionLLM
SEGMENT_SUMMARYSegment summaryLLMOne LLM call per segment
DOCUMENT_SUMMARYFull-document summaryLLMLong documents require truncation or batch aggregation
TABLE_CAPTIONINGTable description generationLLM
TABLE_CAPTIONING_ADVANCEDTable-level summary + row-level narrative groupingLLMEffectiveness on complex tables depends on LLM comprehension
IMAGE_CAPTIONINGImage description generationVision LLMOne LLM call per image

6. Postprocessing Capabilities

StepFunctionConfigurationLimitation
EMBEDDINGText vectorizationbatch_size=100Depends on the Embedding model; image placeholders are automatically stripped
TOKENIZERFull-text indexing tokenizationspaCy language modelPostgreSQL tsvector length limit
EMBEDDING_STOREWrite vectors into VectorDBBatch writes; depends on VectorDB performance
TOKENIZER_STOREWrite tokens into PostgreSQL

7. Format Conversion Capabilities

Input FormatOutput FormatConversion EngineLimitation
.doc.docx / .pdfLibreOffice / SpireRequires the corresponding runtime to be installed on the server
.ppt.pdfLibreOffice / SpireAnimations/transitions are lost
.pptx.pdfLibreOffice / SpireSame as above

8. External Service Dependencies

ServiceEnvironment VariablePurposeImpact if Not Configured
TextIn OCRTEXTIN_APP_ID / TEXTIN_APP_SECRET / TEXTIN_APP_ENDPOINTPDF/image OCRThe corresponding OCR step is unavailable
Azure Document Intelligenceazure_ocr_endpoint / azure_ocr_keyPDF layout analysisThe corresponding step is unavailable
Ali OCRAlibaba Cloud credentialsChinese OCRThe corresponding step is unavailable
Embedding modelLLM Gateway configurationText vectorizationThe EMBEDDING step is unavailable
Vision LLMLLM Gateway configurationImage description / LLM PDF parsingIMAGE/LLM steps are unavailable
General LLMLLM Gateway configurationSummary/keyword/metadata extractionField extraction steps are unavailable
LibreOfficeServer-side binaryFormat conversion.doc/.ppt cannot be processed
PandocServer-side binaryDOCX → MarkdownDOCX parsing is unavailable
ffmpegServer-side binaryVideo audio-track extractionVideo processing is unavailable
spaCyPython package + language modelTokenization/sentence splittingTOKENIZER step and refinement features are unavailable

9. Summary of Known Boundary Cases

#ScenarioBehaviorRecommended Handling
1Scanned PDF + Basic parsingExtracted content is emptySwitch to TextIn / Azure DI / LLM steps
2Multi-column PDF + Basic parsingText order is disordered, paragraphs overlapUse Azure DI Layout mode
3Complex tables in PDF + Basic parsingTable structure is lost, data becomes proseUse TextIn / Azure DI
4Encrypted / password-protected PDFpypdf throws an exceptionRemove password protection during preprocessing
5Direct upload of .doc (legacy Word)No native parserEnsure the Pipeline includes a file conversion step
6Excel exceeds 20,000 rowsParsing rejected, error thrownSplit into multiple files
7Excel merged cellsData may be misalignedUnmerge before upload
8Excel formulasOnly result values are read, not the formulas themselvesExpected behavior
9Video extracts audio track onlyVisual content cannot be recognizedIf visual information is needed, extract key frames and process separately
10Image OCR accuracyVision LLM is not professional OCR, accuracy is limitedUse TextIn for OCR-demanding scenarios
11Large files + LLM parsingExtremely high cost (charged by page/token)Use LLM parsing only for key documents
12Markdown without heading structure + TITLE segmentationThe entire document becomes one segmentSwitch to FIXED_SIZE segmentation
13PPT animations/video embeddingLost after conversion to PDFNo solution
14DOCX containing macros/VBA/ActiveXAll macro content is ignoredExpected behavior
15DOCX revision marks/commentsLostAccept all revisions before upload

10. Capacity Planning Recommendations

File TypeRecommended Upper Limit (Single File)Reason
PDF (Basic parsing)≤ 50 pagespdf2image memory consumption; OOM risk beyond 50 pages
PDF (OCR parsing)≤ 100 pagesLimited by OCR service API constraints and cost
DOCX≤ 20,000 charactersPandoc conversion memory usage
Excel≤ 20,000 rows × 200 columns / sheetHard limit
CSV≤ 20 MBFully loaded into memory
Audio≤ 60 minutes60 transcription API calls
Video≤ 30 minutesffmpeg extraction + transcription; the longer the duration, the higher the failure probability
Image≤ 10 MB / imageVision LLM input limit

This document is generated based on code analysis. Actual runtime behavior may vary depending on the deployment environment (memory / CPU / network) and the status of external services. It is recommended to conduct targeted stress testing before use in production environments.