o
    Zh                     @   sL   d dl Z d dlZd dlmZmZ d dlmZ d dlmZ G dd deZ	dS )    N)AnyOptional)CallbackManagerForToolRun)SlackBaseToolc                   @   sJ   e Zd ZU dZdZeed< dZeed< ddded	e	e
 d
efddZdS )SlackGetChannelz)Tool that gets Slack channel information.Zget_channelid_name_dictnamezHUse this tool to get channelid-name dict. There is no input to this tooldescriptionN)run_managerargsr	   returnc             
   G   sj   zt t | j }|d }dd |D }tj|ddW S  ty4 } zd|W  Y d }~S d }~ww )Nchannelsc                    s>   g | ] d  v rd v rd v rd v r fdddD qS )idr   creatednum_membersc                    s   i | ]}| | qS  r   ).0keyZchannelr   b/var/www/html/lang_env/lib/python3.10/site-packages/langchain_community/tools/slack/get_channel.py
<dictcomp>   s    z3SlackGetChannel._run.<locals>.<listcomp>.<dictcomp>)r   r   r   r   r   )r   r   r   r   
<listcomp>   s    z(SlackGetChannel._run.<locals>.<listcomp>F)ensure_asciizError creating conversation: {})	logging	getLogger__name__clientZconversations_listjsondumps	Exceptionformat)selfr	   r
   resultr   Zfiltered_resulter   r   r   _run   s   

zSlackGetChannel._run)r   
__module____qualname____doc__r   str__annotations__r   r   r   r   r#   r   r   r   r   r   
   s   
 
r   )
r   r   typingr   r   Zlangchain_core.callbacksr   Z$langchain_community.tools.slack.baser   r   r   r   r   r   <module>   s    