Interface IChunking
Defines configurable settings for text chunking. Implementations control how input text is partitioned into chunks suitable for retrieval and embedding workflows.
public interface IChunking
Examples
using LMKit.Model;
using LMKit.Retrieval;
LM embeddingModel = LM.LoadFromModelID("embeddinggemma-300m");
RagEngine ragEngine = new RagEngine(embeddingModel);
// Assign any IChunking implementation as the default chunker.
IChunking chunker = new TextChunking { MaxChunkSize = 400 };
ragEngine.DefaultIChunking = chunker;
// Or pass a chunker inline when importing text.
ragEngine.ImportText("Long document content...",
chunker: new MarkdownChunking { MaxChunkSize = 300 },
"docs", "chapter1");
Properties
- MaxChunkSize
Gets or sets the maximum target size of a produced chunk, expressed in tokens. The effective limit may be adjusted internally depending on model requirements (for example, reserved special tokens).