§
    šŠtj—  ã                  óì   — d dl mZ d dlmZmZ d dlmZ d dlmZ d dl	m
Z
mZ 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 d dlmZ erd dlmZ n	 d dlmZ n# e$ r Y nw xY wdgZ G d„ de¦  «        ZdS )é    )Úannotations)ÚTYPE_CHECKINGÚList)ÚBaseTool)ÚBaseToolkit)Ú
ConfigDictÚField)ÚGmailCreateDraft)ÚGmailGetMessage)ÚGmailGetThread)ÚGmailSearch)ÚGmailSendMessage)Úbuild_resource_service)ÚResourcezhttps://mail.google.com/c                  óV   — e Zd ZU dZ ee¬¦  «        Zded<    ed¬¦  «        Z	dd	„Z
d
S )ÚGmailToolkitaY  Toolkit for interacting with Gmail.

    *Security Note*: This toolkit contains tools that can read and modify
        the state of a service; e.g., by reading, creating, updating, deleting
        data associated with this service.

        For example, this toolkit can be used to send emails on behalf of the
        associated account.

        See https://python.langchain.com/docs/security for more information.

    Setup:
        You will need a Google credentials.json file to use this toolkit.
        See instructions here: https://python.langchain.com/docs/integrations/tools/gmail/#setup

    Key init args:
        api_resource: Optional. The Google API resource. Default is None.

    Instantiate:
        .. code-block:: python

            from langchain_google_community import GmailToolkit

            toolkit = GmailToolkit()

    Tools:
        .. code-block:: python

            toolkit.get_tools()

        .. code-block:: none

            [GmailCreateDraft(api_resource=<googleapiclient.discovery.Resource object at 0x1094509d0>),
            GmailSendMessage(api_resource=<googleapiclient.discovery.Resource object at 0x1094509d0>),
            GmailSearch(api_resource=<googleapiclient.discovery.Resource object at 0x1094509d0>),
            GmailGetMessage(api_resource=<googleapiclient.discovery.Resource object at 0x1094509d0>),
            GmailGetThread(api_resource=<googleapiclient.discovery.Resource object at 0x1094509d0>)]

    Use within an agent:
        .. code-block:: python

            from langchain_openai import ChatOpenAI
            from langgraph.prebuilt import create_react_agent

            llm = ChatOpenAI(model="gpt-4o-mini")

            agent_executor = create_react_agent(llm, tools)

            example_query = "Draft an email to fake@fake.com thanking them for coffee."

            events = agent_executor.stream(
                {"messages": [("user", example_query)]},
                stream_mode="values",
            )
            for event in events:
                event["messages"][-1].pretty_print()

        .. code-block:: none

             ================================[1m Human Message [0m=================================

            Draft an email to fake@fake.com thanking them for coffee.
            ==================================[1m Ai Message [0m==================================
            Tool Calls:
            create_gmail_draft (call_slGkYKZKA6h3Mf1CraUBzs6M)
            Call ID: call_slGkYKZKA6h3Mf1CraUBzs6M
            Args:
                message: Dear Fake,

            I wanted to take a moment to thank you for the coffee yesterday. It was a pleasure catching up with you. Let's do it again soon!

            Best regards,
            [Your Name]
                to: ['fake@fake.com']
                subject: Thank You for the Coffee
            =================================[1m Tool Message [0m=================================
            Name: create_gmail_draft

            Draft created. Draft Id: r-7233782721440261513
            ==================================[1m Ai Message [0m==================================

            I have drafted an email to fake@fake.com thanking them for the coffee. You can review and send it from your email draft with the subject "Thank You for the Coffee".

    Parameters:
        api_resource: Optional. The Google API resource. Default is None.
    )Údefault_factoryr   Úapi_resourceT)Úarbitrary_types_allowedÚreturnúList[BaseTool]c                óÎ   — t          | j        ¬¦  «        t          | j        ¬¦  «        t          | j        ¬¦  «        t	          | j        ¬¦  «        t          | j        ¬¦  «        gS )zGet the tools in the toolkit.)r   )r
   r   r   r   r   r   )Úselfs    ún/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/langchain_community/agent_toolkits/gmail/toolkit.pyÚ	get_toolszGmailToolkit.get_tools|   sc   € õ ¨$Ô*;Ð<Ñ<Ô<Ý¨$Ô*;Ð<Ñ<Ô<Ý TÔ%6Ð7Ñ7Ô7Ý¨Ô):Ð;Ñ;Ô;Ý¨Ô(9Ð:Ñ:Ô:ð
ð 	
ó    N)r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   r   r   Ú__annotations__r   Úmodel_configr   © r   r   r   r      sq   € € € € € € ðUð Uðn #˜UÐ3IÐJÑJÔJ€LÐJÐJÐJÑJà�:Ø $ðñ ô €Lð
ð 
ð 
ð 
ð 
ð 
r   r   N)Ú
__future__r   Útypingr   r   Úlangchain_core.toolsr   Úlangchain_core.tools.baser   Úpydanticr   r	   Ú,langchain_community.tools.gmail.create_draftr
   Ú+langchain_community.tools.gmail.get_messager   Ú*langchain_community.tools.gmail.get_threadr   Ú&langchain_community.tools.gmail.searchr   Ú,langchain_community.tools.gmail.send_messager   Ú%langchain_community.tools.gmail.utilsr   Úgoogleapiclient.discoveryr   ÚImportErrorÚSCOPESr   r#   r   r   ú<module>r2      sv  ðØ "Ð "Ð "Ð "Ð "Ð "à &Ð &Ð &Ð &Ð &Ð &Ð &Ð &à )Ð )Ð )Ð )Ð )Ð )Ø 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø &Ð &Ð &Ð &Ð &Ð &Ð &Ð &à IÐ IÐ IÐ IÐ IÐ IØ GÐ GÐ GÐ GÐ GÐ GØ EÐ EÐ EÐ EÐ EÐ EØ >Ð >Ð >Ð >Ð >Ð >Ø IÐ IÐ IÐ IÐ IÐ IØ HÐ HÐ HÐ HÐ HÐ Hàð à2Ð2Ð2Ð2Ð2Ð2Ð2ðà6Ð6Ð6Ð6Ð6Ð6Ð6øØð ð ð Øˆðøøøð %Ð	%€ðf
ð f
ð f
ð f
ð f
�;ñ f
ô f
ð f
ð f
ð f
s   ÁA ÁA ÁA 