Ë
    ´Œj“
  ã                  óT   — d dl mZ d dlmZmZ d dlmZmZ d dlm	Z	m
Z
 	 	 	 	 	 	 dd„Zy)é    )Úannotations)ÚAnyÚUnion)ÚBaseRetrieverÚRetrieverOutput)ÚRunnableÚRunnablePassthroughc                óÀ   — t        | t        «      s| }nd„ | z  }t        j                  |j	                  d¬«      ¬«      j                  |¬«      j	                  d¬«      S )ap  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:
        .. 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": "..."})

    c                ó   — | d   S )NÚinput© )Úxs    úd/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/langchain/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)Ú	retrieverÚcombine_docs_chainÚretrieval_docss      r   Úcreate_retrieval_chainr      s_   € ô\ �i¤Ô/Ø:C‰á.°)Ñ;ˆô 	×"Ñ"Ø"×.Ñ.Ð8LÐ.ÓMô	
ç
‰&Ð*ˆ&Ó
+ß�kÐ,€kÓ-ð	.r   N)r   z5Union[BaseRetriever, Runnable[dict, RetrieverOutput]]r   zRunnable[dict[str, Any], str]Úreturnr   )Ú
__future__r   Útypingr   r   Úlangchain_core.retrieversr   r   Úlangchain_core.runnablesr   r	   r   r   r   r   Ú<module>r#      s5   ðÝ "ç ÷÷ Cð7.ØDð7.à5ð7.ð ô7.r   