HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/langchain/chains/__pycache__/retrieval.cpython-310.pyc
o

���g�
�@sNddlmZddlmZmZmZddlmZmZddl	m
Z
mZddd�Zd
S)�)�annotations)�Any�Dict�Union)�
BaseRetriever�RetrieverOutput)�Runnable�RunnablePassthrough�	retriever�5Union[BaseRetriever, Runnable[dict, RetrieverOutput]]�combine_docs_chain�Runnable[Dict[str, Any], str]�returnrcCsDt|t�s|}ndd�|B}tj|jdd�d�j|d�jdd�}|S)apCreate 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:
        .. code-block:: python

            # pip install -U langchain langchain-community

            from langchain_community.chat_models import ChatOpenAI
            from langchain.chains.combine_documents import create_stuff_documents_chain
            from langchain.chains import create_retrieval_chain
            from langchain import hub

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

            retrieval_chain.invoke({"input": "..."})

    cSs|dS)N�input�)�xrr�E/usr/local/lib/python3.10/dist-packages/langchain/chains/retrieval.py�<lambda>=sz(create_retrieval_chain.<locals>.<lambda>�retrieve_documents)�run_name)�context)�answer�retrieval_chain)�
isinstancerr	�assign�with_config)r
r�retrieval_docsrrrr�create_retrieval_chains
.
���rN)r
rrr
rr)
�
__future__r�typingrrr�langchain_core.retrieversrr�langchain_core.runnablesrr	rrrrr�<module>s