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

> Optimize document chunking for better retrieval

# Chunking Strategies

Optimize how documents are split into chunks for better retrieval quality.

## Chunking Options

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Knowledge

knowledge = Knowledge(
    sources=["docs/"],
    chunk_size=500,        # Target chunk size
    chunk_overlap=50,      # Overlap between chunks
    chunking_strategy="semantic"  # Chunking method
)
```

## Strategies

### Fixed Size (Default)

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
knowledge = Knowledge(
    sources=["docs/"],
    chunking_strategy="fixed",
    chunk_size=500,
    chunk_overlap=50
)
```

### Semantic

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
knowledge = Knowledge(
    sources=["docs/"],
    chunking_strategy="semantic"
)
```

### Sentence-Based

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
knowledge = Knowledge(
    sources=["docs/"],
    chunking_strategy="sentence",
    sentences_per_chunk=5
)
```

## Best Practices

| Content Type   | Chunk Size | Overlap | Strategy |
| -------------- | ---------- | ------- | -------- |
| Technical docs | 500-800    | 50-100  | Semantic |
| FAQs           | 200-400    | 20-50   | Fixed    |
| Long articles  | 800-1200   | 100-200 | Semantic |
| Code           | 300-500    | 50      | Fixed    |

## Related

* [Knowledge Module](/docs/sdk/praisonaiagents/knowledge/knowledge) - Full API reference
