
    Ng                     Z    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e          Z	dS )    N)AnyOptional)CallbackManagerForToolRun)SlackBaseToolc                   V    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ZdS )SlackGetChannelz)Tool that gets Slack channel information.get_channelid_name_dictnamezHUse this tool to get channelid-name dict. There is no input to this tooldescriptionN)run_managerargsr   returnc                   	 t          j        t                     | j                                        }|d         }d |D             }t          j        |d          S # t          $ r}d                    |          cY d }~S d }~ww xY w)Nchannelsc                 L    g | ] d v rdv rdv rdv fddD             !S )idr
   creatednum_membersc                 "    i | ]}||         S  r   ).0keychannels     g/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain_community/tools/slack/get_channel.py
<dictcomp>z3SlackGetChannel._run.<locals>.<listcomp>.<dictcomp>   s    WWWsgclWWW    )r   r
   r   r   r   )r   r   s    @r   
<listcomp>z(SlackGetChannel._run.<locals>.<listcomp>   se       7??g%%((!W,, XWWW.VWWW
 -,,r   F)ensure_asciizError creating conversation: {})	logging	getLogger__name__clientconversations_listjsondumps	Exceptionformat)selfr   r   resultr   filtered_resultes          r   _runzSlackGetChannel._run   s    	?h'''[3355Fj)H '  O :oEBBBB 	? 	? 	?4;;A>>>>>>>>	?s   AA 
B(B<BB)r!   
__module____qualname____doc__r
   str__annotations__r   r   r   r   r,   r   r   r   r   r   
   s         33)D#)))R    
 NR? ? ??'/0I'J?	? ? ? ? ? ?r   r   )
r$   r   typingr   r   langchain_core.callbacksr   $langchain_community.tools.slack.baser   r   r   r   r   <module>r5      s                      > > > > > > > > > > > >? ? ? ? ?m ? ? ? ? ?r   