§
    ™Štjr
  ã                  óF   — d dl mZ d dlmZ d dlmZmZ d dlmZm	Z	 dd„Z
dS )é    )Úannotations)ÚAny)ÚBaseRetrieverÚRetrieverOutput)ÚRunnableÚRunnablePassthroughÚ	retrieverú/BaseRetriever | Runnable[dict, RetrieverOutput]Úcombine_docs_chainúRunnable[dict[str, Any], str]Úreturnr   c                óà   — t          | t          ¦  «        s| }nd„ | z  }t          j        |                     d¬¦  «        ¬¦  «                             |¬¦  «                             d¬¦  «        S )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                ó   — | d         S )NÚinput© )Úxs    ú`/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langchain_classic/chains/retrieval.pyú<lambda>z(create_retrieval_chain.<locals>.<lambda>>   s
   €  A g¤J€ ó    Úretrieve_documents)Úrun_name)Úcontext)ÚanswerÚretrieval_chain)Ú
isinstancer   r   ÚassignÚwith_config)r	   r   Úretrieval_docss      r   Úcreate_retrieval_chainr      s|   € õ^ �i¥Ñ/Ô/ð <Ø:Cˆˆà.Ð.°)Ñ;ˆõ 	Ô"Ø"×.Ò.Ð8LÐ.ÑMÔMð	
ñ 	
ô 	
ç
Š&Ð*ˆ&Ñ
+Ô
+ß‚kÐ,€kÑ-Ô-ð	.r   N)r	   r
   r   r   r   r   )Ú
__future__r   Útypingr   Úlangchain_core.retrieversr   r   Úlangchain_core.runnablesr   r   r   r   r   r   ú<module>r$      sŠ   ðØ "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð ðð ð ð ð ð ð ð ð CÐ BÐ BÐ BÐ BÐ BÐ BÐ Bð8.ð 8.ð 8.ð 8.ð 8.ð 8.r   