Skip to content

Incorrect Citation Rendering in "Ask Your Data" Mode Due to Missing Prompt Instruction #2473

Open
@fabod

Description

@fabod

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:

  1. Use the "Ask your data" mode in the application.
  2. Observe that citations are rendered with round brackets instead of the expected square bracket format and thus not being rendered.
  3. Compare pre-rendered answers from Chat mode and "Ask the data" mode by adding console.log(answer.message.content); to app/frontend/src/components/Answer/Answer.tsx as first command in export const Answer (e.g., before const 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.

Metadata

Metadata

Labels

bugSomething isn't workingragRelated to RAG flow/logic/approaches

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions