Splitting documents into smaller pieces before embedding.
Breaking large documents into smaller pieces of information.
💡 Dividing a textbook into chapters and sections so a topic can be found quickly.
import { RecursiveCharacterTextSplitter } from "langchain/text_splitter";
const splitter = new RecursiveCharacterTextSplitter({
chunkSize: 500,
chunkOverlap: 50,
});
const chunks = await splitter.splitText(longDocument);Smaller chunks make retrieval more focused and provide relevant context without sending entire documents to the model.
with tapaScript
By clicking Sign Up you re confirming that you agree with our Terms and Conditions.
