Spaces:
Sleeping
Sleeping
Download src/components/chunking/config.py from yashvasudeva/Adaptive_Rag: direct link, hf CLI and curl.
- Browser
- Download file 1.22 kB
-
https://huggingface.co/spaces/yashvasudeva/Adaptive_Rag/resolve/main/src/components/chunking/config.py
- Command line
-
hf download hf://spaces/yashvasudeva/Adaptive_Rag/src/components/chunking/config.py
-
curl -L -o config.py https://huggingface.co/spaces/yashvasudeva/Adaptive_Rag/resolve/main/src/components/chunking/config.py
1.22 kB
| from __future__ import annotations | |
| from dataclasses import dataclass, field | |
| from typing import List, Literal | |
| ChunkingStrategy = Literal[ | |
| "auto", | |
| "recursive", | |
| "structural", | |
| "markdown", | |
| "code", | |
| "table", | |
| "transcript", | |
| "parent_child", | |
| "semantic", | |
| ] | |
| class ChunkingConfig: | |
| """Configuration for chunking pipeline and specialized chunkers.""" | |
| # Default size in approx tokens (or characters / 4) | |
| chunk_size: int = 200 | |
| chunk_overlap: int = 30 | |
| min_chunk_size: int = 30 | |
| # Parent-child settings | |
| parent_chunk_size: int = 1200 | |
| child_chunk_size: int = 250 | |
| child_overlap: int = 40 | |
| # Strategy | |
| strategy: ChunkingStrategy = "auto" | |
| preserve_hierarchy: bool = True | |
| # Tokenizer estimation factor: approx characters per token | |
| chars_per_token: float = 4.0 | |
| # Separators for recursive splitting in order of precedence | |
| separators: List[str] = field( | |
| default_factory=lambda: [ | |
| "\n\n", | |
| "\n", | |
| ". ", | |
| "? ", | |
| "! ", | |
| "; ", | |
| ", ", | |
| " ", | |
| "", | |
| ] | |
| ) | |