Skip to content

feat(config): add ENABLE_CITATIONS environment variable#2736

Open
Br1an67 wants to merge 1 commit intoHKUDS:mainfrom
Br1an67:fix/issue-2097-enable-citations
Open

feat(config): add ENABLE_CITATIONS environment variable#2736
Br1an67 wants to merge 1 commit intoHKUDS:mainfrom
Br1an67:fix/issue-2097-enable-citations

Conversation

@Br1an67
Copy link

@Br1an67 Br1an67 commented Mar 1, 2026

Description

Add an ENABLE_CITATIONS environment variable (default true) that controls whether citation references are included in query responses. When set to false, the reference list and reference_id fields are omitted from the LLM context, producing cleaner answers without source citations. Useful for Docker-based deployments where only .env configuration is available.

Related Issues

Fixes #2097

Changes Made

  • lightrag/lightrag.py: Added enable_citations: bool field (default True) to the LightRAG dataclass
  • lightrag/api/config.py: Parse ENABLE_CITATIONS env var via get_env_value()
  • lightrag/api/lightrag_server.py: Wire enable_citations through to the LightRAG instance and debug log
  • lightrag/operate.py: Conditionally skip reference list generation and reference_id in chunk context for both KG and naive query paths when citations are disabled
  • env.example: Added commented ENABLE_CITATIONS entry

Checklist

  • Changes tested locally
  • Code reviewed
  • Documentation updated (if necessary)
  • Unit tests added (if applicable)

Additional Notes

Follows the same pattern as the existing ENABLE_LLM_CACHE / ENABLE_LLM_CACHE_FOR_EXTRACT configuration flags. Default is true so existing behavior is unchanged.

Add an ENABLE_CITATIONS env var (default true) that controls whether
citation references are included in query responses.  When disabled,
the reference list and reference_id fields are omitted from the LLM
context, producing cleaner answers without source citations.
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.

[Feature Request]: Override System Prompt via .env

1 participant