
    @hs                        S SK Jr  S SKJrJr  S SKJr  \(       a  S SKJr  S SK	J
r
  SSSSS	.           SS
 jjrg)    )annotations)TYPE_CHECKINGOptional)BaseCallbackHandler)LLMThoughtLabeler)DeltaGenerator   TNmax_thought_containersexpand_new_thoughtscollapse_completed_thoughtsthought_labelerc          	          SSK Jn  U" U UUUUS9$ ! [         a5     SSKJn  O ! [         a  nSn[        U5      UeSnAff = fU" U UUUUS9s $ f = f)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. Defaults to 4.
expand_new_thoughts
    Each LLM "thought" gets its own `st.expander`. This param controls whether that
    expander is expanded by default. Defaults to True.
collapse_completed_thoughts
    If True, LLM thought expanders will be collapsed when completed.
    Defaults to True.
thought_labeler
    An optional custom LLMThoughtLabeler instance. If unspecified, the handler
    will use the default thought labeling logic. Defaults to None.

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	            ^/var/www/html/shao/venv/lib/python3.13/site-packages/langchain/callbacks/streamlit/__init__.pyr   r      s    Z
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Optional[LLMThoughtLabeler]returnr   )
__future__r   typingr   r   langchain_core.callbacks.baser   langchain_community.callbacksr   streamlit.delta_generatorr   r        r   <module>r#      sk    " * =?8 #$ $(,37J
$J
  J
 	J

 "&J
 1J
 J
r"   