🚀 Feature:
- Dominant language
- Python
- Stars
- 18.3k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 29
Description
### 🔖 Feature description
I propose adding support for advanced chunking and retrieval strategies, specifically Parent-Child Chunking and Sentence-Window Retrieval, to the DocsGPT ingestion pipeline. Instead of relying solely on the current character-based splitting, this feature would introduce a modular ChunkingStrategy interface, allowing users to select or switch between these hierarchical indexing methods to improve retrieval accuracy
### 🎤 Why is this feature needed ?
The current naive chunking approach often leads to "semantic dilution," where chunks are too small to contain meaningful context or too large to be precise, which negatively impacts retrieval quality.
Solving RAG Degradation: By implementing Parent-Child indexing, we can store small, granular "child" chunks for precise semantic matching, while retrieving the larger "parent" chunk to provide the LLM with full, coherent context for better responses.
Context Preservation: Sentence-Window retrieval would ensure that even when a specific sentence is matched, the LLM receives the necessary surrounding context (the window), eliminating the issue of fragmented or mid-sentence cut-offs that currently affect the platform.
Modular Architecture: This implementation would provide a scalable framework for future retrieval optimizations, making DocsGPT significantly more robust for complex documentation and technical datasets.
### ✌️ How do you aim to achieve this?
I plan to achieve this by refactoring the current ingestion pipeline to decouple the splitting logic from the main workflow. My proposed steps are:
Define a ChunkingStrategy Abstract Base Class (ABC): Create a standard interface that defines an extract() method, ensuring all future strategies follow the same structure.
Implement Strategy Modules: Develop standalone modules for ParentChildStrategy and SentenceWindowStrategy that utilize existing vector database integrations.
Update Configuration: Expose a new parameter in the configuration (e.g., CHUNK_STRATEGY) that allows users to toggle between standard, parent_child, or sentence_window via the settings/UI.
Integration: Map these strategies to the document processing Celery tasks to ensure they are triggered correctly during the data ingestion phase.
### 🔄️ Additional Information
I have considered simply refining the existing RecursiveCharacterTextSplitter parameters (such as chunk_overlap); however, while this helps mitigate some fragmentation, it does not solve the fundamental issue of losing global context in large documents. Implementing a modular ChunkingStrategy interface is a more scalable, long-term solution that avoids hard-coding logic and allows the DocsGPT community to easily add new, experimental strategies in the future.
### 👀 Have you spent some time to check if this feature request has been raised before?
- [x] I checked and didn't find similar issue
### Are you willing to submit PR?
Yes I am willing to submit a PR!
Contributor guide
Research direction
Start with the DocsGPT ingestion pipeline and its document-processing Celery tasks, then inspect how current character-based splitting and vector database integrations are connected. Review the proposed CHUNK_STRATEGY configuration and define how Parent-Child and Sentence-Window strategies should fit the modular interface. Done means users can select each strategy and ingestion triggers the selected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai, backend, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100