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

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

#### split\_files\_to\_chunks

```python theme={null}
split_files_to_chunks(
    files: list[tuple[str, str] | str],
    max_tokens: int = 4000,
    chunk_mode: str = 'multi_lines',
    must_break_at_empty_line: bool = True,
    custom_text_split_function: Callable[[str], list[str]] | None = None
) -> tuple[list[str], list[dict[str, Any]]]
```

Split a list of files into chunks of max\_tokens.

<b>Parameters:</b>

| Name                         | Description                                                                  |
| ---------------------------- | ---------------------------------------------------------------------------- |
| `files`                      | **Type:** list\[tuple\[str, str] \| 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                                  |
| `custom_text_split_function` | **Type:** Callable\[\[str], list\[str]] \| None<br /><br />**Default:** None |

<br />
