Documentation Index
Fetch the complete documentation index at: https://docs.upsonic.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Python splitter uses the Abstract Syntax Tree (AST) to identify precise boundaries of logical blocks like classes and functions. Provides semantically meaningful chunking that’s robust to formatting variations. Each chunk includes metadata about the code structure. Splitter Class:PythonChunker
Config Class: PythonChunkingConfig
Dependencies
No additional dependencies required. Uses standard library.Examples
Parameters
| Parameter | Type | Description | Default | Source |
|---|---|---|---|---|
chunk_size | int | Target size of each chunk | 1024 | Base |
chunk_overlap | int | Overlapping units between chunks | 200 | Base |
min_chunk_size | int | None | Minimum size for a chunk | None | Base |
length_function | Callable[[str], int] | Function to measure text length | len | Base |
strip_whitespace | bool | Strip leading/trailing whitespace | False | Base |
split_on_nodes | list[str] | AST node types for boundaries | ["ClassDef", "FunctionDef", "AsyncFunctionDef"] | Specific |
min_chunk_lines | int | Minimum lines for standalone chunk | 1 | Specific |
include_docstrings | bool | Include docstrings in chunks | True | Specific |
strip_decorators | bool | Strip decorator syntax | False | Specific |
text_chunker_to_use | BaseChunker | Chunker for oversized blocks | RecursiveChunker | Specific |

