Class MarkdownChunking
Provides Markdown-aware chunking configuration for retrieval workflows. The underlying splitter favors Markdown structural boundaries (such as headings and paragraph breaks) to produce chunks that preserve semantic coherence.
public sealed class MarkdownChunking : IChunking
- Inheritance
-
MarkdownChunking
- Implements
- Inherited Members
Examples
using LMKit.Model;
using LMKit.Retrieval;
LM embeddingModel = LM.LoadFromModelID("embeddinggemma-300m");
RagEngine ragEngine = new RagEngine(embeddingModel);
// Use Markdown-aware chunking to split by headings and paragraphs.
var mdChunker = new MarkdownChunking { MaxChunkSize = 400 };
ragEngine.DefaultIChunking = mdChunker;
string markdown = File.ReadAllText("README.md");
ragEngine.ImportText(markdown, "docs", "readme");
Properties
- MaxChunkSize
Gets or sets the maximum target size of a produced chunk, expressed in tokens.