# RetrievalQA

> **Class** in `langchain_classic`

📖 [View in docs](https://reference.langchain.com/python/langchain-classic/chains/retrieval_qa/base/RetrievalQA)

Chain for question-answering against an index.

This class is deprecated. See below for an example implementation using
`create_retrieval_chain`:

    ```python
    from langchain_classic.chains import create_retrieval_chain
    from langchain_classic.chains.combine_documents import (
        create_stuff_documents_chain,
    )
    from langchain_core.prompts import ChatPromptTemplate
    from langchain_openai import ChatOpenAI

    retriever = ...  # Your retriever
    model = ChatOpenAI()

    system_prompt = (
        "Use the given context to answer the question. "
        "If you don't know the answer, say you don't know. "
        "Use three sentence maximum and keep the answer concise. "
        "Context: {context}"
    )
    prompt = ChatPromptTemplate.from_messages(
        [
            ("system", system_prompt),
            ("human", "{input}"),
        ]
    )
    question_answer_chain = create_stuff_documents_chain(model, prompt)
    chain = create_retrieval_chain(retriever, question_answer_chain)

    chain.invoke({"input": query})
    ```

## Signature

```python
RetrievalQA()
```

## Description

**Example:**

```python
from langchain_openai import OpenAI
from langchain_classic.chains import RetrievalQA
from langchain_community.vectorstores import FAISS
from langchain_core.vectorstores import VectorStoreRetriever

retriever = VectorStoreRetriever(vectorstore=FAISS(...))
retrievalQA = RetrievalQA.from_llm(llm=OpenAI(), retriever=retriever)
```

## Extends

- `BaseRetrievalQA`

## Properties

- `retriever`

## ⚠️ Deprecated

Deprecated since version 0.1.17.

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/6fb37dba71da807af60aa7b909f71f0625a666bf/libs/langchain/langchain_classic/chains/retrieval_qa/base.py#L209)