
    KKir
                    R    S SK Jr  S SKJr  S SKJrJr  S SKJrJ	r	        SS jr
g)    )annotations)Any)BaseRetrieverRetrieverOutput)RunnableRunnablePassthroughc                    [        U [        5      (       d  U nOS U -  n[        R                  " UR	                  SS9S9R                  US9R	                  SS9$ )a  Create retrieval chain that retrieves documents and then passes them on.

Args:
    retriever: Retriever-like object that returns list of documents. Should
        either be a subclass of BaseRetriever or a Runnable that returns
        a list of documents. If a subclass of BaseRetriever, then it
        is expected that an `input` key be passed in - this is what
        is will be used to pass into the retriever. If this is NOT a
        subclass of BaseRetriever, then all the inputs will be passed
        into this runnable, meaning that runnable should take a dictionary
        as input.
    combine_docs_chain: Runnable that takes inputs and produces a string output.
        The inputs to this will be any original inputs to this chain, a new
        context key with the retrieved documents, and chat_history (if not present
        in the inputs) with a value of `[]` (to easily enable conversational
        retrieval.

Returns:
    An LCEL Runnable. The Runnable return is a dictionary containing at the very
    least a `context` and `answer` key.

Example:
    ```python
    # pip install -U langchain langchain-openai

    from langchain_openai import ChatOpenAI
    from langchain_classic.chains.combine_documents import (
        create_stuff_documents_chain,
    )
    from langchain_classic.chains import create_retrieval_chain
    from langchain_classic import hub

    retrieval_qa_chat_prompt = hub.pull("langchain-ai/retrieval-qa-chat")
    model = ChatOpenAI()
    retriever = ...
    combine_docs_chain = create_stuff_documents_chain(
        model, retrieval_qa_chat_prompt
    )
    retrieval_chain = create_retrieval_chain(retriever, combine_docs_chain)

    retrieval_chain.invoke({"input": "..."})
    ```
c                    U S   $ )Ninput )xs    d/var/www/html/dynamic-report/venv/lib/python3.13/site-packages/langchain_classic/chains/retrieval.py<lambda>(create_retrieval_chain.<locals>.<lambda>>   s    AgJ    retrieve_documents)run_name)context)answerretrieval_chain)
isinstancer   r   assignwith_config)	retrievercombine_docs_chainretrieval_docss      r   create_retrieval_chainr      sb    ^ i//:C.); 	"""..8L.M	

&*&
+k,k-	.r   N)r   z/BaseRetriever | Runnable[dict, RetrieverOutput]r   zRunnable[dict[str, Any], str]returnr   )
__future__r   typingr   langchain_core.retrieversr   r   langchain_core.runnablesr   r   r   r   r   r   <module>r#      s5    "  C8.>8.58. 8.r   