Chunk by meaning, not by length.
Semantic Chunkers is a multi-modal chunking library for intelligent chunking of text, video, and audio. It makes your AI and data processing more efficient and accurate — retrieval returns whole thoughts, not fragments.
Our most robust method. Uses a varying similarity threshold to find dynamic, local splits — and finds a good threshold value on its own.
from semantic_router.encoders import OpenAIEncoder from semantic_chunkers import StatisticalChunker encoder = OpenAIEncoder( name="text-embedding-3-small" ) chunker = StatisticalChunker(encoder=encoder) chunks = chunker(docs=[content]) chunker.print(chunks[0])
Our most robust method. Uses a varying similarity threshold to find dynamic, local splits — and finds a good threshold value on its own.
The simplest form of semantic chunking: compare each split’s embedding to the next one and cut wherever similarity drops below the threshold.
Compares the embedding of the cumulative chunk so far against the next split. More compute, less noise — good for long, drifting documents.
No encoder at all. Splits on sentence delimiters and packs splits up to max_chunk_tokens — the cheap baseline to compare against.
Semantic chunkers build more context-aware chunks of information — boundaries land where the meaning changes, not at an arbitrary character count.
One library for text, video, and audio. The ConsecutiveChunker works on any sequence of embeddings, whatever produced them.
Better boundaries mean less bleed between topics, so your top-k actually contains the answer.
Text, video, audio — one chunker.
pip install -qU semantic-chunkers from semantic_router.encoders import OpenAIEncoder from semantic_chunkers import StatisticalChunker encoder = OpenAIEncoder(name="text-embedding-3-small") # the statistical chunker finds a good threshold on its own chunker = StatisticalChunker(encoder=encoder) chunks = chunker(docs=[content]) chunker.print(chunks[0]) # Split 1, tokens 300, triggered by: token limit # Split 2, tokens 300, triggered by: token limit # Split 3, tokens 112, triggered by: 0.32
Better chunks in nine lines.
Better boundaries mean retrieval that stays fast and accurate. Pairs directly with Semantic Router for a deterministic mesh.
Transparency in code, creativity in collaboration. Semantic Chunkers uses an MIT license so you can use it however and wherever you want. Find us at github.com/aurelio-labs/semantic-chunkers.