# create_qa_with_sources_chain

> **Function** in `langchain_classic`

📖 [View in docs](https://reference.langchain.com/python/langchain-classic/chains/openai_functions/qa_with_structure/create_qa_with_sources_chain)

Create a question answering chain that returns an answer with sources.

## Signature

```python
create_qa_with_sources_chain(
    llm: BaseLanguageModel,
    verbose: bool = False,
    **kwargs: Any = {},
) -> LLMChain
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `llm` | `BaseLanguageModel` | Yes | Language model to use for the chain. |
| `verbose` | `bool` | No | Whether to print the details of the chain (default: `False`) |
| `**kwargs` | `Any` | No | Keyword arguments to pass to `create_qa_with_structure_chain`. (default: `{}`) |

## Returns

`LLMChain`

Chain (LLMChain) that can be used to answer questions with citations.

## ⚠️ Deprecated

Deprecated since version 0.2.13. Use langchain.agents.create_agent instead. Will be removed in version 2.0.0. Build new RAG flows with `create_agent`, a retrieval tool, and `response_format` for structured responses. See https://docs.langchain.com/oss/python/langchain/rag and https://docs.langchain.com/oss/python/langchain/structured-output

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/42f8f79293cfb7589e5bc1d74a8ae4dfd0bf15e3/libs/langchain/langchain_classic/chains/openai_functions/qa_with_structure.py#L115)