From 5fa92cbf99dc9b6225ae91a8773990afe6fe3b78 Mon Sep 17 00:00:00 2001 From: yangdx Date: Mon, 22 Sep 2025 10:53:03 +0800 Subject: [PATCH] Improve citation quality and reduce reference limits in prompts - Reduce max citations from 8 to 6 - Require direct fact referencing - Clarify relevance prioritization --- lightrag/prompt.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lightrag/prompt.py b/lightrag/prompt.py index 463b35ad..e5c4b011 100644 --- a/lightrag/prompt.py +++ b/lightrag/prompt.py @@ -244,9 +244,11 @@ Consider the conversation history if provided to maintain conversational flow an - For a Knowledge Graph Entity: [EN] - For a Knowledge Graph Relationship: [RE] ~ - For a Document Chunk: [DC] - - , , , and should be derived from the attribute values in `Source Data` and preserved in their original language. - - Merge citations that share the same file_path into one reference item, disregarding their distinct IDs. - - Provide a maximum of 8 unique and most relevant references, and list each citation on a separate line. + - , , , and should originate from attribute values in `Source Data` and be retained in their original language. + - Merge citations that share the same into one reference item, disregarding their distinct IDs. + - Only include citations that directly reference the facts presented in the answer. + - Prioritize the most relevant references, and provide maximum of 6 most relevant citations. + - List each citation on an individual line. 5. **Example of Section:** ``` @@ -295,9 +297,11 @@ Consider the conversation history if provided to maintain conversational flow an - Append a reference section at the end of the response. - The References section should be under a `### References` heading. - Output the citation in the following format: [DC] - - should be derived from the attribute values in `Source Data` and preserved in their original language. - - Merge citations that share the same file_path into one reference item, disregarding their distinct IDs. - - Provide a maximum of 8 unique and most relevant references, and list each citation on a separate line. + - should originate from attribute values in `Source Data` and be retained in their original language. + - Merge citations that share the same into one reference item, disregarding their distinct IDs. + - Only include citations that directly reference the facts presented in the answer. + - Prioritize the most relevant references, and provide maximum of 6 most relevant citations. + - List each citation on an individual line. 5. **Example of Section:** ```