|
3 | 3 |
|
4 | 4 | """Parameterization settings for the default configuration.""" |
5 | 5 |
|
6 | | -from pydantic import BaseModel, Field |
| 6 | +from pydantic import BaseModel, ConfigDict, Field |
7 | 7 |
|
8 | 8 | from graphrag.chunking.chunk_strategy_type import ChunkStrategyType |
9 | | -from graphrag.config.defaults import graphrag_config_defaults |
10 | 9 |
|
11 | 10 |
|
12 | 11 | class ChunkingConfig(BaseModel): |
13 | 12 | """Configuration section for chunking.""" |
14 | 13 |
|
| 14 | + model_config = ConfigDict(extra="allow") |
| 15 | + """Allow extra fields to support custom cache implementations.""" |
| 16 | + |
15 | 17 | strategy: str = Field( |
16 | 18 | description="The chunking strategy to use.", |
17 | | - default=ChunkStrategyType.tokens, |
| 19 | + default=ChunkStrategyType.Tokens, |
18 | 20 | ) |
19 | | - size: int = Field( |
| 21 | + size: int | None = Field( |
20 | 22 | description="The chunk size to use.", |
21 | | - default=graphrag_config_defaults.chunks.size, |
| 23 | + default=None, |
22 | 24 | ) |
23 | | - overlap: int = Field( |
| 25 | + overlap: int | None = Field( |
24 | 26 | description="The chunk overlap to use.", |
25 | | - default=graphrag_config_defaults.chunks.overlap, |
| 27 | + default=None, |
26 | 28 | ) |
27 | | - encoding_model: str = Field( |
| 29 | + encoding_model: str | None = Field( |
28 | 30 | description="The encoding model to use.", |
29 | | - default=graphrag_config_defaults.chunks.encoding_model, |
| 31 | + default=None, |
30 | 32 | ) |
31 | | - prepend_metadata: bool = Field( |
| 33 | + prepend_metadata: bool | None = Field( |
32 | 34 | description="Prepend metadata into each chunk.", |
33 | | - default=graphrag_config_defaults.chunks.prepend_metadata, |
| 35 | + default=None, |
34 | 36 | ) |
35 | | - chunk_size_includes_metadata: bool = Field( |
| 37 | + chunk_size_includes_metadata: bool | None = Field( |
36 | 38 | description="Count metadata in max tokens.", |
37 | | - default=graphrag_config_defaults.chunks.chunk_size_includes_metadata, |
| 39 | + default=None, |
38 | 40 | ) |
0 commit comments