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]¶
LLM思维流中的一个思想。
初始化LLMThought。
- 参数:
parent_container:我们要写入的容器。 labeler:用于此思想的标签器。 expanded:思想是否应默认展开。 collapse_on_complete:思想是否应在完成时折叠。
Attributes
container
我们正在写入的容器。
last_tool
这个想法执行的最后一个工具
Methods
__init__
(parent_container, labeler, ...)初始化LLMThought。
clear
()从屏幕上移除这个想法。清除的想法无法被重复使用。
complete
([final_label])完成这个想法。
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)- Parameters
parent_container (DeltaGenerator) –
labeler (LLMThoughtLabeler) –
expanded (bool) –
collapse_on_complete (bool) –
- __init__(parent_container: DeltaGenerator, labeler: LLMThoughtLabeler, expanded: bool, collapse_on_complete: bool)[source]¶
初始化LLMThought。
- 参数:
parent_container:我们要写入的容器。 labeler:用于此思想的标签器。 expanded:思想是否应默认展开。 collapse_on_complete:思想是否应在完成时折叠。
- Parameters
parent_container (DeltaGenerator) –
labeler (LLMThoughtLabeler) –
expanded (bool) –
collapse_on_complete (bool) –
- complete(final_label: Optional[str] = None) None [source]¶
完成这个想法。
- Parameters
final_label (Optional[str]) –
- Return type
None
- on_agent_action(action: AgentAction, color: Optional[str] = None, **kwargs: Any) Any [source]¶
- Parameters
action (AgentAction) –
color (Optional[str]) –
kwargs (Any) –
- Return type
Any
- on_llm_end(response: LLMResult, **kwargs: Any) None [source]¶
- Parameters
response (LLMResult) –
kwargs (Any) –
- Return type
None
- on_llm_error(error: BaseException, **kwargs: Any) None [source]¶
- Parameters
error (BaseException) –
kwargs (Any) –
- Return type
None
- on_llm_new_token(token: str, **kwargs: Any) None [source]¶
- Parameters
token (str) –
kwargs (Any) –
- Return type
None
- on_llm_start(serialized: Dict[str, Any], prompts: List[str]) None [source]¶
- Parameters
serialized (Dict[str, Any]) –
prompts (List[str]) –
- Return type
None
- on_tool_end(output: Any, color: Optional[str] = None, observation_prefix: Optional[str] = None, llm_prefix: Optional[str] = None, **kwargs: Any) None [source]¶
- Parameters
output (Any) –
color (Optional[str]) –
observation_prefix (Optional[str]) –
llm_prefix (Optional[str]) –
kwargs (Any) –
- Return type
None