langchain_community.callbacks.streamlit.streamlit_callback_handler.LLMThought¶

class langchain_community.callbacks.streamlit.streamlit_callback_handler.LLMThought(parent_container: DeltaGenerator, labeler: LLMThoughtLabeler, expanded: bool, collapse_on_complete: bool)[source]¶

A thought in the LLM’s thought stream.

Initialize the LLMThought.

Parameters
  • parent_container – The container we’re writing into.

  • labeler – The labeler to use for this thought.

  • expanded – Whether the thought should be expanded by default.

  • collapse_on_complete – Whether the thought should be collapsed.

Attributes

container

The container we're writing into.

last_tool

The last tool executed by this thought

Methods

__init__(parent_container, labeler, ...)

Initialize the LLMThought.

clear()

Remove the thought from the screen.

complete([final_label])

Finish the thought.

on_agent_action(action[, color])

on_llm_end(response, **kwargs)

on_llm_error(error, **kwargs)

on_llm_new_token(token, **kwargs)

on_llm_start(serialized, prompts)

on_tool_end(output[, color, ...])

on_tool_error(error, **kwargs)

on_tool_start(serialized, input_str, **kwargs)

__init__(parent_container: DeltaGenerator, labeler: LLMThoughtLabeler, expanded: bool, collapse_on_complete: bool)[source]¶

Initialize the LLMThought.

Parameters
  • parent_container – The container we’re writing into.

  • labeler – The labeler to use for this thought.

  • expanded – Whether the thought should be expanded by default.

  • collapse_on_complete – Whether the thought should be collapsed.

clear() None[source]¶

Remove the thought from the screen. A cleared thought can’t be reused.

complete(final_label: Optional[str] = None) None[source]¶

Finish the thought.

on_agent_action(action: AgentAction, color: Optional[str] = None, **kwargs: Any) Any[source]¶
on_llm_end(response: LLMResult, **kwargs: Any) None[source]¶
on_llm_error(error: BaseException, **kwargs: Any) None[source]¶
on_llm_new_token(token: str, **kwargs: Any) None[source]¶
on_llm_start(serialized: Dict[str, Any], prompts: List[str]) None[source]¶
on_tool_end(output: str, color: Optional[str] = None, observation_prefix: Optional[str] = None, llm_prefix: Optional[str] = None, **kwargs: Any) None[source]¶
on_tool_error(error: BaseException, **kwargs: Any) None[source]¶
on_tool_start(serialized: Dict[str, Any], input_str: str, **kwargs: Any) None[source]¶