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

# 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.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    User([User]) --> CLI[CLI]
    CLI --> KB[Knowledge Base]

    classDef agent fill:#8B0000,stroke:#7C90A0,color:#fff
    classDef tool fill:#189AB4,stroke:#7C90A0,color:#fff

    class KB agent
    class User,CLI tool
    classDef agent fill:#8B0000,color:#fff
    classDef tool fill:#189AB4,color:#fff
```

## Quick Start

**1. Simple Usage**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai-ts knowledge add document.pdf
```

**2. With Configuration**

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai-ts knowledge search "query" --json
```

***

## 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](https://praison.ai/docs/js/chunking.md).

## Related

> [card] [Chunking](https://praison.ai/docs/js/chunking.md)
>
> SDK chunking utilities

> [card] [Knowledge Base CLI](https://praison.ai/docs/js/knowledge-base-cli.md)
>
> Manage knowledge


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.