# RetrievalQA output repeats prompt and context sources

**URL:** <https://discuss.huggingface.co/t/retrievalqa-output-repeats-prompt-and-context-sources/99587>\
**Category:** Models\
**Created:** [July 26, 2024, 6:51pm UTC](https://discuss.huggingface.co/t/retrievalqa-output-repeats-prompt-and-context-sources/99587 "2024-07-26T18:51:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marky2376](https://avatars.discourse-cdn.com/v4/letter/m/f14d63/32.png) [@marky2376](https://discuss.huggingface.co/u/marky2376)\
**Post date:** [July 26, 2024, 6:51pm UTC](https://discuss.huggingface.co/t/retrievalqa-output-repeats-prompt-and-context-sources/99587/1 "2024-07-26T18:51:03Z")

</div>

I have a python script that leverages langchain, huggingface and Llama3 to serve as a RAG for answering questions on our private data and to fallback to the LLM as well.

The output includes the prompt and also list all the context used in the answer. Is there a way to limit it from repeating the prompt and to hide the context sources?

Here is the goods on the code:

```auto
 # Initialize the RetrievalQA chain
    qa_chain = RetrievalQA.from_chain_type(
        llm=llm, chain_type="stuff", retriever=index.as_retriever()
    )

    result = qa_chain(query)
    print(result)

def main():
    query = input("Type in your question: \n")
    while query != "exit":
        query_docs(query)
        query = input("Type in your question: \n")

if __name__ == " __main__":
    main()

```
