| 8 | |
| 9 | @dataclass |
| 10 | class QueryParam: |
| 11 | mode: Literal["local", "global", "naive"] = "global" |
| 12 | only_need_context: bool = False |
| 13 | response_type: str = "Multiple Paragraphs" |
| 14 | level: int = 2 |
| 15 | top_k: int = 20 |
| 16 | # naive search |
| 17 | naive_max_token_for_text_unit = 12000 |
| 18 | # local search |
| 19 | local_max_token_for_text_unit: int = 4000 # 12000 * 0.33 |
| 20 | local_max_token_for_local_context: int = 4800 # 12000 * 0.4 |
| 21 | local_max_token_for_community_report: int = 3200 # 12000 * 0.27 |
| 22 | local_community_single_one: bool = False |
| 23 | # global search |
| 24 | global_min_community_rating: float = 0 |
| 25 | global_max_consider_community: float = 512 |
| 26 | global_max_token_for_community_report: int = 16384 |
| 27 | global_special_community_map_llm_kwargs: dict = field( |
| 28 | default_factory=lambda: {"response_format": {"type": "json_object"}} |
| 29 | ) |
| 30 | |
| 31 | |
| 32 | TextChunkSchema = TypedDict( |