home/roleplay/deepset-question-answering-with-references

Deepset Question Answering With References

GPTClaudeGemini··1,302 copies·updated 2026-07-14
deepset-question-answering-with-references.prompt
This prompt is designed to answer a `query` given a list of `documents`. It will also reference which document the final answer came from. For example, if the answer was in the first document, the first document, the restult will indicate that the answer was 'stated in Document[1]'

## How to use in Haystack

To use this prompt with Haystack, we recommend defining an `output_parser` with `AnswerParser(reference_pattern=r"Document\[(\d+)\]")` in the `PromptTemplate`. This way, the result of the `PromptNode` will return Haystack `Answer` objects.

when to use it

Community prompt sourced from the open-source GitHub repo deepset-ai/prompthub (Apache-2.0). A "Deepset Question Answering With References" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

roleplaycommunitygeneral

source

deepset-ai/prompthub · Apache-2.0