langchain.callbacks.stdout.StdOutCallbackHandler¶
- class langchain.callbacks.stdout.StdOutCallbackHandler(color: Optional[str] = None)[source]¶
Bases:
BaseCallbackHandlerCallback Handler that prints to std out.
Initialize callback handler.
Methods
__init__([color])Initialize callback handler.
on_agent_action(action[, color])Run on agent action.
on_agent_finish(finish[, color])Run on agent end.
on_chain_end(outputs, **kwargs)Print out that we finished a chain.
on_chain_error(error, **kwargs)Do nothing.
on_chain_start(serialized, inputs, **kwargs)Print out that we are entering a chain.
on_chat_model_start(serialized, messages, *, ...)Run when a chat model starts running.
on_llm_end(response, **kwargs)Do nothing.
on_llm_error(error, **kwargs)Do nothing.
on_llm_new_token(token, **kwargs)Do nothing.
on_llm_start(serialized, prompts, **kwargs)Print out the prompts.
on_retriever_end(documents, *, run_id[, ...])Run when Retriever ends running.
on_retriever_error(error, *, run_id[, ...])Run when Retriever errors.
on_retriever_start(serialized, query, *, run_id)Run when Retriever starts running.
on_text(text[, color, end])Run when agent ends.
on_tool_end(output[, color, ...])If not the final action, print out observation.
on_tool_error(error, **kwargs)Do nothing.
on_tool_start(serialized, input_str, **kwargs)Do nothing.
Attributes
Whether to ignore agent callbacks.
Whether to ignore chain callbacks.
Whether to ignore chat model callbacks.
Whether to ignore LLM callbacks.
Whether to ignore retriever callbacks.
Whether to ignore retry callbacks.
- on_agent_action(action: AgentAction, color: Optional[str] = None, **kwargs: Any) Any[source]¶
Run on agent action.
- on_agent_finish(finish: AgentFinish, color: Optional[str] = None, **kwargs: Any) None[source]¶
Run on agent end.
- on_chain_end(outputs: Dict[str, Any], **kwargs: Any) None[source]¶
Print out that we finished a chain.
- on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any) None[source]¶
Print out that we are entering a chain.
- on_chat_model_start(serialized: Dict[str, Any], messages: List[List[BaseMessage]], *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) Any¶
Run when a chat model starts running.
- on_llm_start(serialized: Dict[str, Any], prompts: List[str], **kwargs: Any) None[source]¶
Print out the prompts.
- on_retriever_end(documents: Sequence[Document], *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) Any¶
Run when Retriever ends running.
- on_retriever_error(error: Union[Exception, KeyboardInterrupt], *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) Any¶
Run when Retriever errors.
- on_retriever_start(serialized: Dict[str, Any], query: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) Any¶
Run when Retriever starts running.
- on_text(text: str, color: Optional[str] = None, end: str = '', **kwargs: Any) None[source]¶
Run when agent ends.
- on_tool_end(output: str, color: Optional[str] = None, observation_prefix: Optional[str] = None, llm_prefix: Optional[str] = None, **kwargs: Any) None[source]¶
If not the final action, print out observation.
- property ignore_agent: bool¶
Whether to ignore agent callbacks.
- property ignore_chain: bool¶
Whether to ignore chain callbacks.
- property ignore_chat_model: bool¶
Whether to ignore chat model callbacks.
- property ignore_llm: bool¶
Whether to ignore LLM callbacks.
- property ignore_retriever: bool¶
Whether to ignore retriever callbacks.
- property ignore_retry: bool¶
Whether to ignore retry callbacks.
- raise_error: bool = False¶
- run_inline: bool = False¶