Chunk Text

This example demonstrates how to chunk text.


Chunk Text Example

Chunk Text Example

import {Langbase} from 'langbase';
import 'dotenv/config';

const langbase = new Langbase({
	apiKey: process.env.LANGBASE_API_KEY!,
});

async function main() {
	const content = `Langbase is the most powerful serverless AI platform for building AI agents with memory. Build, deploy, and scale AI agents with tools and memory (RAG). Simple AI primitives with a world-class developer experience without using any frameworks.`;

	const results = await langbase.chunker({
		content,
		chunkMaxLength: 1024,
		chunkOverlap: 256,
	});

	console.log(results);
}

main();