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

# autogen.retrieve_utils.split_text_to_chunks

<code class="doc-symbol doc-symbol-heading doc-symbol-function" />

#### split\_text\_to\_chunks

```python theme={null}
split_text_to_chunks(
    text: str,
    max_tokens: int = 4000,
    chunk_mode: str = 'multi_lines',
    must_break_at_empty_line: bool = True,
    overlap: int = 0
) -> 
```

Split a long text into chunks of max\_tokens.

<b>Parameters:</b>

| Name                       | Description                                          |
| -------------------------- | ---------------------------------------------------- |
| `text`                     | **Type:** str                                        |
| `max_tokens`               | **Type:** int<br /><br />**Default:** 4000           |
| `chunk_mode`               | **Type:** str<br /><br />**Default:** 'multi\_lines' |
| `must_break_at_empty_line` | **Type:** bool<br /><br />**Default:** True          |
| `overlap`                  | **Type:** int<br /><br />**Default:** 0              |

<br />
