> ## Documentation Index
> Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Chunking CLI

> CLI commands for text chunking in PraisonAI TypeScript

# Chunking CLI Commands

Text chunking is primarily an SDK feature for processing documents. The CLI provides knowledge management commands that use chunking internally.

## Knowledge Base Commands

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# 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" --json
```

## SDK Usage

For direct chunking control, use the SDK:

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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](/docs/js/chunking).
