Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

LightRAG query parameters had hardcoded defaults scattered across Field(default=...) declarations, requiring updates in multiple places when changing defaults.

Changes

  • Add LightRAGQueryDefaults class as single source of truth for all query parameter defaults
  • Update LightRAGQueryConfig to reference constants from LightRAGQueryDefaults

Usage

from src.config import LightRAGQueryDefaults

# Access defaults directly
print(LightRAGQueryDefaults.TOP_K)  # 20
print(LightRAGQueryDefaults.CHUNK_TOP_K)  # 10

# Config still works with env var overrides
config = LightRAGQueryConfig()
print(config.top_k)  # Uses default or TOP_K env var

Environment variable overrides continue to work as before.

Original prompt

This section details on the original issue you should resolve

<issue_title>LightRAG query parameters hardcoded - difficult to maintain</issue_title>
<issue_description>## 问题描述
LightRAG 查询参数硬编码,维护困难。

受影响的文件

  • src/config.py 行 216-225

硬编码的默认值

  • top_k=20
  • chunk_top_k=10
  • max_entity_tokens=6000

问题

虽然都有环境变量配置,但每个值都硬编码了默认值,维护困难,每个配置需要在两个地方同时更新。

解决方案

应该将默认值统一放在一个地方管理。</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…aults class

Co-authored-by: BukeLy <19304666+BukeLy@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor LightRAG query parameters for better maintainability feat: centralize LightRAG query config defaults Dec 15, 2025
Copilot AI requested a review from BukeLy December 15, 2025 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LightRAG query parameters hardcoded - difficult to maintain

2 participants