-
I'm testing the Q&A RAG demo app, but how to show the relevant fragments/snippets from the indexed documents as references? This is now it looks like in NotebookLM: Could you provide a Pathway example for that? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey there! You can replicate NotebookLM’s “hover to see references” feature by following these steps: Instruct the LLM to include citations:Modify your prompt_template in BaseRAGQuestionAnswerer to tell the LLM to insert citation markers ([1], [2], etc.) in the response:
Set return_context_docs=True:When calling the RAG endpoint, ensure that the response includes both the generated answer and the retrieved document snippets:
That way, the response contains two parts:
You can see the official RAGClient docs here in Pathway’s documentation to learn more. Link the citations to their corresponding snippets (UI side):Once you have the answer and context_docs, your front-end (or final processing step) needs to:
Right now, our demo-qna UI does not automatically map citations to snippets. This needs to be handled in the front-end.
|
Beta Was this translation helpful? Give feedback.
Hey there!
You can replicate NotebookLM’s “hover to see references” feature by following these steps:
Instruct the LLM to include citations:
Modify your prompt_template in BaseRAGQuestionAnswerer to tell the LLM to insert citation markers ([1], [2], etc.) in the response:
Set return_context_docs=True:
When calling the RAG endpoint, ensure that the response includes both the generated answer and the retrieved document snippets: