langchain_core.callbacks.base
.CallbackManagerMixin¶
- class langchain_core.callbacks.base.CallbackManagerMixin[source]¶
Mixin for callback manager.
Methods
__init__
()on_chain_start
(serialized, inputs, *, run_id)Run when chain starts running.
on_chat_model_start
(serialized, messages, *, ...)Run when a chat model starts running.
on_llm_start
(serialized, prompts, *, run_id)Run when LLM starts running.
on_retriever_start
(serialized, query, *, run_id)Run when Retriever starts running.
on_tool_start
(serialized, input_str, *, run_id)Run when tool starts running.
- __init__()¶
- on_chain_start(serialized: Dict[str, Any], inputs: Dict[str, Any], *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) Any [source]¶
Run when chain starts running.
- Parameters
serialized (Dict[str, Any]) –
inputs (Dict[str, Any]) –
run_id (UUID) –
parent_run_id (Optional[UUID]) –
tags (Optional[List[str]]) –
metadata (Optional[Dict[str, Any]]) –
kwargs (Any) –
- Return type
Any
- 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 [source]¶
Run when a chat model starts running.
- ATTENTION: This method is called for chat models. If you’re implementing
a handler for a non-chat model, you should use on_llm_start instead.
- Parameters
serialized (Dict[str, Any]) –
messages (List[List[BaseMessage]]) –
run_id (UUID) –
parent_run_id (Optional[UUID]) –
tags (Optional[List[str]]) –
metadata (Optional[Dict[str, Any]]) –
kwargs (Any) –
- Return type
Any
- on_llm_start(serialized: Dict[str, Any], prompts: List[str], *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) Any [source]¶
Run when LLM starts running.
- ATTENTION: This method is called for non-chat models (regular LLMs). If
you’re implementing a handler for a chat model, you should use on_chat_model_start instead.
- Parameters
serialized (Dict[str, Any]) –
prompts (List[str]) –
run_id (UUID) –
parent_run_id (Optional[UUID]) –
tags (Optional[List[str]]) –
metadata (Optional[Dict[str, Any]]) –
kwargs (Any) –
- Return type
Any
- 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 [source]¶
Run when Retriever starts running.
- Parameters
serialized (Dict[str, Any]) –
query (str) –
run_id (UUID) –
parent_run_id (Optional[UUID]) –
tags (Optional[List[str]]) –
metadata (Optional[Dict[str, Any]]) –
kwargs (Any) –
- Return type
Any
- on_tool_start(serialized: Dict[str, Any], input_str: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, inputs: Optional[Dict[str, Any]] = None, **kwargs: Any) Any [source]¶
Run when tool starts running.
- Parameters
serialized (Dict[str, Any]) –
input_str (str) –
run_id (UUID) –
parent_run_id (Optional[UUID]) –
tags (Optional[List[str]]) –
metadata (Optional[Dict[str, Any]]) –
inputs (Optional[Dict[str, Any]]) –
kwargs (Any) –
- Return type
Any