
    Ng*                     z    d dl mZmZmZ d dlmZ d dlmZmZ d dl	m
Z
  G d de          Z G d de
          Zd	S )
    )DictOptionalType)CallbackManagerForToolRun)	BaseModelField)GmailBaseToolc                   8    e Zd ZU dZ edd          Zeed<   dS )GetThreadSchemazInput for GetMessageTool..zThe thread ID.)description	thread_idN)__name__
__module____qualname____doc__r   r   str__annotations__     f/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/tools/gmail/get_thread.pyr   r   	   sK         ## U$  Is     r   r   c                   n    e Zd ZU dZdZeed<   dZeed<   eZ	e
e         ed<   	 dded	ee         d
efdZdS )GmailGetThreadz)Tool that gets a thread by ID from Gmail.get_gmail_threadnamezyUse this tool to search for email messages. The input must be a valid Gmail query. The output is a JSON list of messages.r   args_schemaNr   run_managerreturnc                 r   | j                                                                                             d|          }|                                }t          |t                    st          d          |d         }g |d<   g d}|D ])|d                             fd|D                        *|S )zRun the tool.me)userIdidz'The output of the query must be a list.messages)r!   snippetr#   c                 *    i | ]}|v ||         S r   r   ).0kmessages     r   
<dictcomp>z'GmailGetThread._run.<locals>.<dictcomp>.   s$    EEE1WGAJr   )	api_resourceusersthreadsgetexecute
isinstancedict
ValueErrorappend)selfr   r   querythread_datar"   keys_to_keepr'   s          @r   _runzGmailGetThread._run   s     !''))113377t	7RRmmoo+t,, 	HFGGGz*"$J333 	 	G
#**EEEEEEE    r   )N)r   r   r   r   r   r   r   r   r   r   r   r   r   r   r6   r   r   r   r   r      s         33"D#"""	2    
 *9Ko&888
 <@  78 
	     r   r   N)typingr   r   r   langchain_core.callbacksr   pydanticr   r   $langchain_community.tools.gmail.baser	   r   r   r   r   r   <module>r;      s    ' ' ' ' ' ' ' ' ' ' > > > > > > % % % % % % % % > > > > > >    i       ]     r   