§
    ‡ìNgO  ã                  ó^   — d dl mZ d dlmZ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dS )é    )Úannotations)ÚTYPE_CHECKINGÚOptional)ÚBaseCallbackHandler)ÚLLMThoughtLabeler)ÚDeltaGeneratoré   TN©Úmax_thought_containersÚexpand_new_thoughtsÚcollapse_completed_thoughtsÚthought_labelerÚparent_containerr   r   Úintr   Úboolr   r   úOptional[LLMThoughtLabeler]Úreturnr   c               óº   — 	 ddl m}  || ||||¬¦  «        S # t          $ r8 	 ddlm} n# t          $ r t          d¦  «        ‚w xY w || ||||¬¦  «        cY S w xY w)ab  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`.)Ústreamlit.external.langchainr   ÚImportErrorÚBlangchain_community.callbacks.streamlit.streamlit_callback_handler)r   r   r   r   r   r   Ú!_InternalStreamlitCallbackHandlers          úb/var/www/html/ai-engine/env/lib/python3.11/site-packages/langchain/callbacks/streamlit/__init__.pyr   r      sô   € ðZ
ØIÐIÐIÐIÐIÐIð (Ð'ØØ#9Ø 3Ø(CØ+ð
ñ 
ô 
ð 	
øõ ð 
ð 
ð 
ð	ðð ð ð ð ð ð øõ ð 	ð 	ð 	ÝðNñô ð ð	øøøð 1Ð0ØØ#9Ø 3Ø(CØ+ð
ñ 
ô 
ð 	
ð 	
ð 	
ð
øøøs#   ‚ ˜
A£*©AªAÁAÁA)r   r   r   r   r   r   r   r   r   r   r   r   )Ú
__future__r   Útypingr   r   Úlangchain_core.callbacks.baser   Úlangchain_community.callbacksr   Ústreamlit.delta_generatorr   r   © ó    r   ú<module>r"      s«   ðØ "Ð "Ð "Ð "Ð "Ð "à *Ð *Ð *Ð *Ð *Ð *Ð *Ð *à =Ð =Ð =Ð =Ð =Ð =àð 9Ø?Ð?Ð?Ð?Ð?Ð?Ø8Ð8Ð8Ð8Ð8Ð8ð #$Ø $Ø(,Ø37ðI
ð I
ð I
ð I
ð I
ð I
ð I
ð I
r!   