langchain.callbacks.streamlit.streamlit_callback_handler.LLMThoughtLabeler

class langchain.callbacks.streamlit.streamlit_callback_handler.LLMThoughtLabeler[source]

Generates markdown labels for LLMThought containers. Pass a custom subclass of this to StreamlitCallbackHandler to override its default labeling logic.

Methods

__init__()

get_final_agent_thought_label()

Return the markdown label for the agent's final thought - the "Now I have the answer" thought, that doesn't involve a tool.

get_history_label()

Return a markdown label for the special 'history' container that contains overflow thoughts.

get_initial_label()

Return the markdown label for a new LLMThought that doesn't have an associated tool yet.

get_tool_label(tool, is_complete)

Return the label for an LLMThought that has an associated tool.

__init__()
get_final_agent_thought_label() str[source]

Return the markdown label for the agent’s final thought - the “Now I have the answer” thought, that doesn’t involve a tool.

get_history_label() str[source]

Return a markdown label for the special ‘history’ container that contains overflow thoughts.

get_initial_label() str[source]

Return the markdown label for a new LLMThought that doesn’t have an associated tool yet.

get_tool_label(tool: ToolRecord, is_complete: bool) str[source]

Return the label for an LLMThought that has an associated tool.

Parameters
  • tool – The tool’s ToolRecord

  • is_complete – True if the thought is complete; False if the thought is still receiving input.

Return type

The markdown label for the thought’s container.