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

<Steps>
  <Step title="Simple Usage">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    praisonai-ts knowledge add document.pdf
    ```
  </Step>

  <Step title="With Configuration">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    praisonai-ts knowledge search "query" --json
    ```
  </Step>
</Steps>

***

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

## Related

<CardGroup cols={2}>
  <Card title="Chunking" icon="book" href="/docs/js/chunking">
    SDK chunking utilities
  </Card>

  <Card title="Knowledge Base CLI" icon="terminal" href="/docs/js/knowledge-base-cli">
    Manage knowledge
  </Card>
</CardGroup>
