- Notifications
You must be signed in to change notification settings - Fork1.2k
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
I'm testing theQ&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! |
BetaWas this translation helpful?Give feedback.
All reactions
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:
prompt_template=( "Given the following documents:\n{context}\n\n" "Answer the question in detail, and include citations in the format [number] " "that map to the corresponding document snippets.\n\n" "Question: {query}")Set return_context_docs=True:
When calling the RAG endpoint, ensure that the response includes both the generated answer and the retrieved document snippets:
response = pathway_client.p…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 inPathway’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.
|
BetaWas this translation helpful?Give feedback.
