The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
docs(core): clean up callbacks param descriptions (#34738)
Mason Daugherty2ff1d23bba66
diff --git a/libs/core/langchain_core/callbacks/base.py b/libs/core/langchain_core/callbacks/base.pyindex 271fcc5407..062cd7f90b 100644--- a/libs/core/langchain_core/callbacks/base.py+++ b/libs/core/langchain_core/callbacks/base.py@@ -21,7 +21,7 @@ _LOGGER = logging.getLogger(__name__)class RetrieverManagerMixin:- """Mixin for Retriever callbacks."""+ """Mixin for `Retriever` callbacks."""def on_retriever_error(self,@@ -31,12 +31,12 @@ class RetrieverManagerMixin:parent_run_id: UUID | None = None,**kwargs: Any,) -> Any:- """Run when Retriever errors.+ """Run when `Retriever` errors.Args:error: The error that occurred.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.**kwargs: Additional keyword arguments."""@@ -48,12 +48,12 @@ class RetrieverManagerMixin:parent_run_id: UUID | None = None,**kwargs: Any,) -> Any:- """Run when Retriever ends running.+ """Run when `Retriever` ends running.Args:documents: The documents retrieved.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.**kwargs: Additional keyword arguments."""@@ -78,8 +78,8 @@ class LLMManagerMixin:Args:token: The new token.chunk: The new generated chunk, containing content and other information.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -97,8 +97,8 @@ class LLMManagerMixin:Args:response: The response which was generated.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -116,8 +116,8 @@ class LLMManagerMixin:Args:error: The error that occurred.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -138,8 +138,8 @@ class ChainManagerMixin:Args:outputs: The outputs of the chain.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.**kwargs: Additional keyword arguments."""@@ -155,8 +155,8 @@ class ChainManagerMixin:Args:error: The error that occurred.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.**kwargs: Additional keyword arguments."""@@ -172,8 +172,8 @@ class ChainManagerMixin:Args:action: The agent action.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.**kwargs: Additional keyword arguments."""@@ -189,8 +189,8 @@ class ChainManagerMixin:Args:finish: The agent finish.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.**kwargs: Additional keyword arguments."""@@ -210,8 +210,8 @@ class ToolManagerMixin:Args:output: The output of the tool.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.**kwargs: Additional keyword arguments."""@@ -227,8 +227,8 @@ class ToolManagerMixin:Args:error: The error that occurred.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.**kwargs: Additional keyword arguments."""@@ -257,8 +257,8 @@ class CallbackManagerMixin:Args:serialized: The serialized LLM.prompts: The prompts.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.metadata: The metadata.**kwargs: Additional keyword arguments.@@ -284,8 +284,8 @@ class CallbackManagerMixin:Args:serialized: The serialized chat model.messages: The messages.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.metadata: The metadata.**kwargs: Additional keyword arguments.@@ -306,13 +306,13 @@ class CallbackManagerMixin:metadata: dict[str, Any] | None = None,**kwargs: Any,) -> Any:- """Run when the Retriever starts running.+ """Run when the `Retriever` starts running.Args:- serialized: The serialized Retriever.+ serialized: The serialized `Retriever`.query: The query.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.metadata: The metadata.**kwargs: Additional keyword arguments.@@ -334,8 +334,8 @@ class CallbackManagerMixin:Args:serialized: The serialized chain.inputs: The inputs.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.metadata: The metadata.**kwargs: Additional keyword arguments.@@ -358,8 +358,8 @@ class CallbackManagerMixin:Args:serialized: The serialized chain.input_str: The input string.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.metadata: The metadata.inputs: The inputs.@@ -382,8 +382,8 @@ class RunManagerMixin:Args:text: The text.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.**kwargs: Additional keyword arguments."""@@ -399,8 +399,8 @@ class RunManagerMixin:Args:retry_state: The retry state.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.**kwargs: Additional keyword arguments."""@@ -418,13 +418,12 @@ class RunManagerMixin:Args:name: The name of the custom event.- data: The data for the custom event. Format will match- the format specified by the user.+ data: The data for the custom event. Format will match the format specified+ by the user.run_id: The ID of the run.- tags: The tags associated with the custom event- (includes inherited tags).- metadata: The metadata associated with the custom event- (includes inherited metadata).+ tags: The tags associated with the custom event (includes inherited tags).+ metadata: The metadata associated with the custom event (includes inherited+ metadata)."""@@ -436,7 +435,7 @@ class BaseCallbackHandler(CallbackManagerMixin,RunManagerMixin,):- """Base callback handler for LangChain."""+ """Base callback handler."""raise_error: bool = False"""Whether to raise an error if an exception occurs."""@@ -481,7 +480,7 @@ class BaseCallbackHandler(class AsyncCallbackHandler(BaseCallbackHandler):- """Async callback handler for LangChain."""+ """Base async callback handler."""async def on_llm_start(self,@@ -504,8 +503,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:serialized: The serialized LLM.prompts: The prompts.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.metadata: The metadata.**kwargs: Additional keyword arguments.@@ -531,8 +530,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:serialized: The serialized chat model.messages: The messages.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.metadata: The metadata.**kwargs: Additional keyword arguments.@@ -559,8 +558,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:token: The new token.chunk: The new generated chunk, containing content and other information.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -578,8 +577,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:response: The response which was generated.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -597,10 +596,11 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:error: The error that occurred.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments.+- response (LLMResult): The response which was generated beforethe error occurred."""@@ -621,8 +621,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:serialized: The serialized chain.inputs: The inputs.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.metadata: The metadata.**kwargs: Additional keyword arguments.@@ -641,8 +641,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:outputs: The outputs of the chain.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -660,8 +660,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:error: The error that occurred.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -683,8 +683,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:serialized: The serialized tool.input_str: The input string.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.metadata: The metadata.inputs: The inputs.@@ -704,8 +704,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:output: The output of the tool.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -723,8 +723,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:error: The error that occurred.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -742,8 +742,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:text: The text.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -760,8 +760,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:retry_state: The retry state.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.**kwargs: Additional keyword arguments."""@@ -778,8 +778,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:action: The agent action.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -797,8 +797,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:finish: The agent finish.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -819,8 +819,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:serialized: The serialized retriever.query: The query.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.metadata: The metadata.**kwargs: Additional keyword arguments.@@ -839,8 +839,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:documents: The documents retrieved.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -858,8 +858,8 @@ class AsyncCallbackHandler(BaseCallbackHandler):Args:error: The error that occurred.- run_id: The run ID. This is the ID of the current run.- parent_run_id: The parent run ID. This is the ID of the parent run.+ run_id: The ID of the current run.+ parent_run_id: The ID of the parent run.tags: The tags.**kwargs: Additional keyword arguments."""@@ -889,7 +889,7 @@ class AsyncCallbackHandler(BaseCallbackHandler):class BaseCallbackManager(CallbackManagerMixin):- """Base callback manager for LangChain."""+ """Base callback manager."""def __init__(self,@@ -938,8 +938,9 @@ class BaseCallbackManager(CallbackManagerMixin):def merge(self, other: BaseCallbackManager) -> Self:"""Merge the callback manager with another callback manager.- May be overwritten in subclasses. Primarily used internally- within merge_configs.+ May be overwritten in subclasses.++ Primarily used internally within `merge_configs`.Returns:The merged callback manager of the same type as the current object.