# AnalyzeDocumentChain

> **Class** in `langchain_classic`

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

Chain that splits documents, then analyzes it in pieces.

This chain is parameterized by a TextSplitter and a CombineDocumentsChain.
This chain takes a single document as input, and then splits it up into chunks
and then passes those chucks to the CombineDocumentsChain.

This class is deprecated. See below for alternative implementations which
supports async and streaming modes of operation.

If the underlying combine documents chain takes one `input_documents` argument
(e.g., chains generated by `load_summarize_chain`):

    ```python
    split_text = lambda x: text_splitter.create_documents([x])

    summarize_document_chain = split_text | chain
    ```

If the underlying chain takes additional arguments (e.g., `load_qa_chain`, which
takes an additional `question` argument), we can use the following:

    ```python
    from operator import itemgetter
    from langchain_core.runnables import RunnableLambda, RunnableParallel

    split_text = RunnableLambda(lambda x: text_splitter.create_documents([x]))
    summarize_document_chain = RunnableParallel(
        question=itemgetter("question"),
        input_documents=itemgetter("input_document") | split_text,
    ) | chain.pick("output_text")
    ```

To additionally return the input parameters, as `AnalyzeDocumentChain` does,
we can wrap this construction with `RunnablePassthrough`:

    ```python
    from operator import itemgetter
    from langchain_core.runnables import (
        RunnableLambda,
        RunnableParallel,
        RunnablePassthrough,
    )

    split_text = RunnableLambda(lambda x: text_splitter.create_documents([x]))
    summarize_document_chain = RunnablePassthrough.assign(
        output_text=RunnableParallel(
            question=itemgetter("question"),
            input_documents=itemgetter("input_document") | split_text,
        )
        | chain.pick("output_text")
    )
    ```

## Signature

```python
AnalyzeDocumentChain()
```

## Extends

- `Chain`

## Properties

- `input_key`
- `text_splitter`
- `combine_docs_chain`
- `input_keys`
- `output_keys`

## Methods

- [`get_input_schema()`](https://reference.langchain.com/python/langchain-classic/chains/combine_documents/base/AnalyzeDocumentChain/get_input_schema)
- [`get_output_schema()`](https://reference.langchain.com/python/langchain-classic/chains/combine_documents/base/AnalyzeDocumentChain/get_output_schema)

## ⚠️ Deprecated

Deprecated since version 0.2.7.

---

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