Document_Processing_Chunking
Describes a pluggable document processing architecture with a base class, registry, and two concrete processors for text and complex formats.
What this file does
Describes a pluggable document processing architecture with a base class, registry, and two concrete processors for text and complex formats.
When to use it
- Designing an extensible document ingestion pipeline
- Needing to support multiple file types with different parsers
- Implementing a registry pattern for processor selection
- Integrating an external parsing service like Apache Tika
Assumes this stack
graph LR
ProcessorBase["ProcessorBase"]
ProcessorRegistry["ProcessorRegistry"]
SimpleTxtProcessor["SimpleTxtProcessor"]
TikaProcessor["TikaProcessor"]
External_Caller["External Caller"]
External_Apache_Tika_service["External Apache Tika service"]
External_Caller -- "requests processor from" --> ProcessorRegistry
ProcessorRegistry -- "returns instance to" --> External_Caller
SimpleTxtProcessor -- "implements" --> ProcessorBase
TikaProcessor -- "implements" --> ProcessorBase
TikaProcessor -- "communicates with" --> External_Apache_Tika_service
ProcessorRegistry -- "manages registration of" --> ProcessorBase
Details
The document processing subsystem in quivr is designed for extensibility and efficient handling of various document types. At its core, the ProcessorBase abstract class establishes a common interface for all document processors, ensuring consistent behavior. Concrete implementations, such as SimpleTxtProcessor for plain text and TikaProcessor for complex formats (leveraging an external Apache Tika service), extend ProcessorBase to provide specialized processing logic. The ProcessorRegistry serves as a central hub, managing the registration of these diverse processors and dynamically providing the correct processor instance to external callers based on the document's characteristics. This architecture facilitates a plug-and-play approach, allowing new document processing capabilities to be integrated seamlessly.
ProcessorBase
This abstract base class serves as the core interface for all document processors. It defines the process_file contract and handles common, format-agnostic steps like metadata retrieval and initial support checks, ensuring a consistent API for all concrete processors.
Related Classes/Methods:
- <a href="https://github.com/QuivrHQ/quivr/blob/main/core/quivr_core/processor/processor_base.py" target="_blank" rel="noopener noreferrer">
core.quivr_core.processor.processor_base</a>
ProcessorRegistry
This component acts as a central factory and management system for document processors. It's responsible for registering new processor types and dynamically selecting the appropriate processor based on file characteristics, enabling a plugin-like architecture.
Related Classes/Methods:
- <a href="https://github.com/QuivrHQ/quivr/blob/main/core/quivr_core/processor/registry.py" target="_blank" rel="noopener noreferrer">
core.quivr_core.processor.registry</a>
SimpleTxtProcessor
A concrete implementation of ProcessorBase specifically designed for plain text files. Its primary function is content extraction and intelligent chunking, which is crucial for preparing text for vectorization in a RAG pipeline.
Related Classes/Methods:
- <a href="https://github.com/QuivrHQ/quivr/blob/main/core/quivr_core/processor/implementations/simple_txt_processor.py" target="_blank" rel="noopener noreferrer">
core.quivr_core.processor.implementations.simple_txt_processor</a>
TikaProcessor
Another concrete implementation of ProcessorBase, leveraging an external Apache Tika service for processing a wide array of complex document formats (e.g., PDF, DOCX). It abstracts the complexity of interacting with external parsing tools.
Related Classes/Methods:
- <a href="https://github.com/QuivrHQ/quivr/blob/main/core/quivr_core/processor/implementations/tika_processor.py" target="_blank" rel="noopener noreferrer">
core.quivr_core.processor.implementations.tika_processor</a>
External Caller
Represents any component or system outside the immediate document processing subsystem that initiates the document ingestion and processing workflow. This could be a user interface, an API endpoint, or another part of the RAG pipeline.
Related Classes/Methods: None
External Apache Tika service
An external, third-party service that TikaProcessor interacts with to perform robust parsing and content extraction from various complex document formats. It is critical for handling non-plain text files.
Related Classes/Methods: None
FAQ
What's inside
1 Mermaid diagram, 6 component descriptions, 4 code links, 1 FAQ section
Change this for your project
- Replace
QuivrHQ/quivrwith your own repository URL - Replace
core/quivr_core/processor/paths with your project's module structure - Replace
SimpleTxtProcessorandTikaProcessorwith your own processor class names
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Worth borrowing
- Use a registry to dynamically select processor implementations based on file type
- Define an abstract base class with a common interface for all processors
Related Documents
基于命题分块以增强RAG
Implements proposition chunking for RAG: decomposes documents into atomic facts, evaluates quality, and compares retrieval against standard chunking.
TileMap Chunk Manager
Divides a large tilemap into fixed-size chunks, loading and rendering only those visible to reduce memory and draw calls by over 99%.
🤖 n8n AI Agent Mastery Course 2025
Serves as the main README for an n8n course repository, listing 10+ AI agent workflow projects with links to YouTube tutorials and Docker setup instructions.
Message Chunking for MCP stdio Transport
Explains macOS 64KB pipe write limit and provides a chunking layer for MCP stdio transport that splits and reassembles large messages transparently.