langchain_community.callbacks.streamlit.mutable_expander
.MutableExpander¶
- class langchain_community.callbacks.streamlit.mutable_expander.MutableExpander(parent_container: DeltaGenerator, label: str, expanded: bool)[source]¶
A Streamlit expander that can be renamed and dynamically expanded/collapsed.
Create a new MutableExpander.
- Parameters
parent_container –
The st.container that the expander will be created inside.
The expander transparently deletes and recreates its underlying st.expander instance when its label changes, and it uses parent_container to ensure it recreates this underlying expander in the same location onscreen.
label – The expander’s initial label.
expanded – The expander’s initial expanded value.
Attributes
expanded
True if the expander was created with expanded=True.
label
The expander's label string.
Methods
__init__
(parent_container, label, expanded)Create a new MutableExpander.
append_copy
(other)Append a copy of another MutableExpander's children to this MutableExpander.
clear
()Remove the container and its contents entirely.
exception
(exception, *[, index])Add an Exception element to the container and return its index.
markdown
(body[, unsafe_allow_html, help, index])Add a Markdown element to the container and return its index.
update
(*[, new_label, new_expanded])Change the expander's label and expanded state
- __init__(parent_container: DeltaGenerator, label: str, expanded: bool)[source]¶
Create a new MutableExpander.
- Parameters
parent_container –
The st.container that the expander will be created inside.
The expander transparently deletes and recreates its underlying st.expander instance when its label changes, and it uses parent_container to ensure it recreates this underlying expander in the same location onscreen.
label – The expander’s initial label.
expanded – The expander’s initial expanded value.
- append_copy(other: MutableExpander) None [source]¶
Append a copy of another MutableExpander’s children to this MutableExpander.
- clear() None [source]¶
Remove the container and its contents entirely. A cleared container can’t be reused.
- exception(exception: BaseException, *, index: Optional[int] = None) int [source]¶
Add an Exception element to the container and return its index.