Context
OpenRAG returns a source list after each RAG answer, but readers cannot tell which source supports a specific claim. Inline citations would make answers easier to verify and let users open the relevant document and page directly.
Problem
The current answer protocol asks the model to report sources only at the end. The backend then removes that marker and returns a filtered source list. This loses the visible relationship between individual claims and their evidence, and filtering can also obscure the original source number.
Expected behavior
Factual claims should include stable citations such as:
Water is essential for life. [Source 1]
The source list should preserve the same identifiers:
Source 1: water.pdf — page 3
Inline citations should map to the exact retrieved chunk, remain stable in streaming and non-streaming responses, and open the corresponding document or web source. Invalid or nonexistent source numbers must not be exposed. Answers without supporting evidence should return no citations.
Citation formatting should remain reliable when administrators use custom answer prompts. Initial validation only needs to guarantee that cited sources exist; semantic verification that a source truly supports a claim can be handled separately.
Context
OpenRAG returns a source list after each RAG answer, but readers cannot tell which source supports a specific claim. Inline citations would make answers easier to verify and let users open the relevant document and page directly.
Problem
The current answer protocol asks the model to report sources only at the end. The backend then removes that marker and returns a filtered source list. This loses the visible relationship between individual claims and their evidence, and filtering can also obscure the original source number.
Expected behavior
Factual claims should include stable citations such as:
The source list should preserve the same identifiers:
Inline citations should map to the exact retrieved chunk, remain stable in streaming and non-streaming responses, and open the corresponding document or web source. Invalid or nonexistent source numbers must not be exposed. Answers without supporting evidence should return no citations.
Citation formatting should remain reliable when administrators use custom answer prompts. Initial validation only needs to guarantee that cited sources exist; semantic verification that a source truly supports a claim can be handled separately.