def on_llm_error(        self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any    ) -> Any:        """Run when LLM errors."""    def on_chain_start(        self, serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any    ) -> Any:        """Run when chain starts running."""    def on_chain_end(self, outputs: Dict[str, Any], **kwargs: Any) -> Any:        """Run when chain ends running."""    def on_chain_error(        self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any    ) -> Any:        """Run when chain errors."""    def on_tool_start(        self, serialized: Dict[str, Any], input_str: str, **kwargs: Any    ) -> Any:        """Run when tool starts running."""    def on_tool_end(self, output: str, **kwargs: Any) -> Any:        """Run when tool ends running."""    def on_tool_error(        self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any    ) -> Any:        """Run when tool errors."""    def on_text(self, text: str, **kwargs: Any) -> Any:        """Run on arbitrary text."""    def on_agent_action(self, action: AgentAction, **kwargs: Any) -> Any:        """Run on agent action."""    def on_agent_finish(self, finish: AgentFinish, **kwargs: Any) -> Any:        """Run on agent end."""Get started‚ÄãLangChain provides a few built-in handlers that you can use to get started. These are available in the langchain/callbacks module. The most basic handler is the StdOutCallbackHandler, which simply logs all events to stdout.Note: when the verbose flag on the object is set to true, the StdOutCallbackHandler will be invoked even without being explicitly passed in.from langchain.callbacks import StdOutCallbackHandlerfrom langchain.chains import LLMChainfrom langchain.llms import OpenAIfrom langchain.prompts import PromptTemplatehandler = StdOutCallbackHandler()llm = OpenAI()prompt = PromptTemplate.from_template("1 + {number} = ")# Constructor callback: First, let's explicitly set the StdOutCallbackHandler when initializing our
Head to Integrations for documentation on built-in callbacks integrations with 3rd-party tools.
Head to Integrations for documentation on built-in callbacks integrations with 3rd-party tools. ->: def on_llm_error(        self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any    ) -> Any:        """Run when LLM errors."""    def on_chain_start(        self, serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any    ) -> Any:        """Run when chain starts running."""    def on_chain_end(self, outputs: Dict[str, Any], **kwargs: Any) -> Any:        """Run when chain ends running."""    def on_chain_error(        self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any    ) -> Any:        """Run when chain errors."""    def on_tool_start(        self, serialized: Dict[str, Any], input_str: str, **kwargs: Any    ) -> Any:        """Run when tool starts running."""    def on_tool_end(self, output: str, **kwargs: Any) -> Any:        """Run when tool ends running."""    def on_tool_error(        self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any    ) -> Any:        """Run when tool errors."""    def on_text(self, text: str, **kwargs: Any) -> Any:        """Run on arbitrary text."""    def on_agent_action(self, action: AgentAction, **kwargs: Any) -> Any:        """Run on agent action."""    def on_agent_finish(self, finish: AgentFinish, **kwargs: Any) -> Any:        """Run on agent end."""Get started‚ÄãLangChain provides a few built-in handlers that you can use to get started. These are available in the langchain/callbacks module. The most basic handler is the StdOutCallbackHandler, which simply logs all events to stdout.Note: when the verbose flag on the object is set to true, the StdOutCallbackHandler will be invoked even without being explicitly passed in.from langchain.callbacks import StdOutCallbackHandlerfrom langchain.chains import LLMChainfrom langchain.llms import OpenAIfrom langchain.prompts import PromptTemplatehandler = StdOutCallbackHandler()llm = OpenAI()prompt = PromptTemplate.from_template("1 + {number} = ")# Constructor callback: First, let's explicitly set the StdOutCallbackHandler when initializing our