
    3fi*                    n    d dl mZ d dlmZ d dlmZ erd dlmZ d dlm	Z	 ddddd		 	 	 	 	 	 	 	 	 	 	 dd
Z
y)    )annotations)TYPE_CHECKING)BaseCallbackHandler)LLMThoughtLabeler)DeltaGenerator   TNmax_thought_containersexpand_new_thoughtscollapse_completed_thoughtsthought_labelerc                   	 ddl m}  || ||||      S # t        $ r7 	 ddlm} n# t        $ r}d}t        |      |d}~ww xY w || ||||      cY S w xY w)a  Callback Handler that writes to a Streamlit app.

    This CallbackHandler is geared towards
    use with a LangChain Agent; it displays the Agent's LLM and tool-usage "thoughts"
    inside a series of Streamlit expanders.

    Parameters
    ----------
    parent_container
        The `st.container` that will contain all the Streamlit elements that the
        Handler creates.
    max_thought_containers
        The max number of completed LLM thought containers to show at once. When this
        threshold is reached, a new thought will cause the oldest thoughts to be
        collapsed into a "History" expander.
    expand_new_thoughts
        Each LLM "thought" gets its own `st.expander`. This param controls whether that
        expander is expanded by default.
    collapse_completed_thoughts
        If `True`, LLM thought expanders will be collapsed when completed.
    thought_labeler
        An optional custom LLMThoughtLabeler instance. If unspecified, the handler
        will use the default thought labeling logic.

    Returns:
    -------
    A new StreamlitCallbackHandler instance.

    Note that this is an "auto-updating" API: if the installed version of Streamlit
    has a more recent StreamlitCallbackHandler implementation, an instance of that class
    will be used.

    r   )StreamlitCallbackHandlerr	   zoTo use the StreamlitCallbackHandler, please install langchain-community with `pip install langchain-community`.N)streamlit.external.langchainr   ImportErrorBlangchain_community.callbacks.streamlit.streamlit_callback_handler)	parent_containerr
   r   r   r   r   !_InternalStreamlitCallbackHandleremsgs	            l/var/www/auto_recruiter/arenv/lib/python3.12/site-packages/langchain_classic/callbacks/streamlit/__init__.pyr   r      s    X
I (#9 3(C+
 	
  
		*  	*N  c")	* 1#9 3(C+
 	

s,    	A&A	A=AAA)r   r   r
   intr   boolr   r   r   zLLMThoughtLabeler | Nonereturnr   )
__future__r   typingr   langchain_core.callbacks.baser   langchain_community.callbacksr   streamlit.delta_generatorr   r        r   <module>r"      sk    "   =?8 #$ $(,04I
$I
  I
 	I

 "&I
 .I
 I
r!   