SemanticChunkingStrategy
Models & Types · AiDotNet.RetrievalAugmentedGeneration.ChunkingStrategies
Semantic text chunking. When an embedding function is supplied, it embeds each sentence and starts a new chunk at semantic breakpoints — consecutive-sentence cosine distances above a percentile threshold (Kamradt / LlamaIndex SemanticSplitter). Without an embedding function it falls back to size-based sentence packing.
Inheritance: ChunkingStrategyBase → SemanticChunkingStrategy
How It Works
Previously this “semantic” splitter used no embeddings at all — it just packed sentences to a size budget. It now performs real embedding-distance breakpoint detection when given an embedder.
Constructors
| Constructor | Summary |
|---|---|
SemanticChunkingStrategy(int maxChunkSize, int chunkOverlap, Func<IReadOnlyList<string>, IReadOnlyList<double[]>> embedBatch, double breakpointPercentile) |