§
    šŠtj6  ã                   ó`   — d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	  G d„ dee	¦  «        Z
dS )	é    )ÚList)ÚCallbackManagerForRetrieverRun)ÚDocument)ÚBaseRetriever)ÚArxivAPIWrapperc                   óB   — e Zd ZU dZdZeed<   dedede	e
         fd„ZdS )	ÚArxivRetrievera¢  `Arxiv` retriever.

    Setup:
        Install ``arxiv``:

        .. code-block:: bash

            pip install -U arxiv

    Key init args:
        load_max_docs: int
            maximum number of documents to load
        get_ful_documents: bool
            whether to return full document text or snippets

    Instantiate:
        .. code-block:: python

            from langchain_community.retrievers import ArxivRetriever

            retriever = ArxivRetriever(
                load_max_docs=2,
                get_ful_documents=True,
            )

    Usage:
        .. code-block:: python

            docs = retriever.invoke("What is the ImageBind model?")
            docs[0].metadata

        .. code-block:: none

            {'Entry ID': 'http://arxiv.org/abs/2305.05665v2',
            'Published': datetime.date(2023, 5, 31),
            'Title': 'ImageBind: One Embedding Space To Bind Them All',
            'Authors': 'Rohit Girdhar, Alaaeldin El-Nouby, Zhuang Liu, Mannat Singh, Kalyan Vasudev Alwala, Armand Joulin, Ishan Misra'}

    Use within a chain:
        .. code-block:: python

            from langchain_core.output_parsers import StrOutputParser
            from langchain_core.prompts import ChatPromptTemplate
            from langchain_core.runnables import RunnablePassthrough
            from langchain_openai import ChatOpenAI

            prompt = ChatPromptTemplate.from_template(
                """Answer the question based only on the context provided.

            Context: {context}

            Question: {question}"""
            )

            llm = ChatOpenAI(model="gpt-3.5-turbo-0125")

            def format_docs(docs):
                return "\n\n".join(doc.page_content for doc in docs)

            chain = (
                {"context": retriever | format_docs, "question": RunnablePassthrough()}
                | prompt
                | llm
                | StrOutputParser()
            )

            chain.invoke("What is the ImageBind model?")

        .. code-block:: none

             'The ImageBind model is an approach to learn a joint embedding across six different modalities - images, text, audio, depth, thermal, and IMU data...'
    FÚget_full_documentsÚqueryÚrun_managerÚreturnc                óf   — | j         r|                      |¬¦  «        S |                      |¦  «        S )N)r   )r
   ÚloadÚget_summaries_as_docs)Úselfr   r   s      úb/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langchain_community/retrievers/arxiv.pyÚ_get_relevant_documentsz&ArxivRetriever._get_relevant_documentsV   s7   € ð Ô"ð 	5Ø—9’9 5�9Ñ)Ô)Ð)à×-Ò-¨eÑ4Ô4Ð4ó    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   ÚboolÚ__annotations__Ústrr   r   r   r   © r   r   r	   r	   
   sf   € € € € € € ðGð GðR  %Ð˜Ð$Ð$Ñ$ð5Øð5Ø*Hð5à	ˆhŒð5ð 5ð 5ð 5ð 5ð 5r   r	   N)Útypingr   Úlangchain_core.callbacksr   Úlangchain_core.documentsr   Úlangchain_core.retrieversr   Ú#langchain_community.utilities.arxivr   r	   r   r   r   ú<module>r"      sŸ   ðØ Ð Ð Ð Ð Ð à CÐ CÐ CÐ CÐ CÐ CØ -Ð -Ð -Ð -Ð -Ð -Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3à ?Ð ?Ð ?Ð ?Ð ?Ð ?ðR5ð R5ð R5ð R5ð R5�] Oñ R5ô R5ð R5ð R5ð R5r   