rag.splitters.base
Define the abstract ChunkerBase interface and the TextChunk and HierarchicalTextChunk data classes.
Define the abstract ChunkerBase interface and the TextChunk and HierarchicalTextChunk data classes.
- class TextChunk(content, chunk_index, start_char, end_char, metadata=None)[source]
Bases:
objectA single chunk of text produced by a chunker.
- Parameters:
- class HierarchicalTextChunk(content, chunk_index, start_char, end_char, metadata=None, id='', parent_id=None, child_ids=None, hierarchy_level=0)[source]
Bases:
TextChunkA text chunk that participates in a parent-child hierarchy.
Used by hierarchical chunking strategies that maintain relationships between larger parent chunks and smaller child chunks.
- Parameters:
- class ChunkerBase(chunk_size=1000, chunk_overlap=200, metadata=None)[source]
Bases:
ABCAbstract base class for text chunking strategies.
- Parameters:
Classes
- class ChunkerBase(chunk_size=1000, chunk_overlap=200, metadata=None)[source]
Bases:
ABCAbstract base class for text chunking strategies.
- Parameters:
- class HierarchicalTextChunk(content, chunk_index, start_char, end_char, metadata=None, id='', parent_id=None, child_ids=None, hierarchy_level=0)[source]
Bases:
TextChunkA text chunk that participates in a parent-child hierarchy.
Used by hierarchical chunking strategies that maintain relationships between larger parent chunks and smaller child chunks.
- Parameters: