Chunking CLI
CLI commands for text chunking in PraisonAI TypeScript
Text chunking is primarily an SDK feature; the CLI exposes knowledge commands that chunk documents internally.
Quick Start
- Simple Usage
bash praisonai-ts knowledge add document.pdf - With Configuration
bash praisonai-ts knowledge search "query" --json
Knowledge Base Commands
# Add a document (automatically chunked)
praisonai-ts knowledge add document.pdf
# Add text content
praisonai-ts knowledge add "Your text content here"
# Search knowledge base
praisonai-ts knowledge search "query" --jsonSDK Usage
For direct chunking control, use the SDK:
import { Chunking } from 'praisonai';
// Chunk by size
const chunker = new Chunking({ chunkSize: 100 });
const chunks = chunker.chunk(text);
// Chunk by sentence
const sentenceChunker = new Chunking({ strategy: 'sentence' });
const sentences = sentenceChunker.chunkBySentence(text);
// Chunk by paragraph
const paraChunker = new Chunking({ strategy: 'paragraph' });
const paragraphs = paraChunker.chunkByParagraph(text);
// Chunk with overlap
const overlapChunker = new Chunking({ chunkSize: 50, overlap: 10 });
const overlappedChunks = overlapChunker.chunk(text);Available Strategies
| Strategy | Description |
|---|---|
size | Fixed character size chunks |
sentence | Split by sentence boundaries |
paragraph | Split by paragraph boundaries |
semantic | Semantic-aware chunking |
For more details, see the Chunking SDK documentation.