Description
Description:
When using the "Ask your data" mode, the citations are not rendered correctly. Unlike Chat mode, which renders citations using footnotes and a list of linked citations at the end , the "Ask your data" mode only appends the source names in round brackets within the text. This appears to be caused by a missing instruction in the prompt file.
Steps to Reproduce:
- Use the "Ask your data" mode in the application.
- Observe that citations are rendered with round brackets instead of the expected square bracket format and thus not being rendered.
- Compare pre-rendered answers from Chat mode and "Ask the data" mode by adding
console.log(answer.message.content);
toapp/frontend/src/components/Answer/Answer.tsx
as first command inexport const Answer
(e.g., beforeconst followupQuestions = answer.context?.followup_questions;
Expected Behavior:
Answers are rendered with a footnote at the respective position and a linked list of citations at the end of the answer.
Actual Behavior:
Citations are displayes as plain text with round brackets, which does not follow the intended format.
Proposed Fix:
Update the file app/backend/approaches/prompts/ask_answer_question.prompty
to include the following instruction, similar to the one in chat_answer_question.prompty
:
Each source has a name followed by the actual information, always include the source name for each fact you use in the response. Use square brackets to reference the source, for example [info1.txt]. Don't combine sources, list each source separately, for example [info1.txt][info2.pdf].
By adding this instruction, the "Ask your data" mode should render citations correctly.
Additional Context:
The chat_answer_question.prompty file already includes the correct instruction.
The discrepancy in prompt instructions between the two modes leads to inconsistent citation rendering.