The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
chore(core): remove arg types from docstrings (#33388)
Christophe Bornetf405a2c57d08
diff --git a/libs/core/langchain_core/_api/beta_decorator.py b/libs/core/langchain_core/_api/beta_decorator.pyindex 6c801f672a..eef83f04d2 100644--- a/libs/core/langchain_core/_api/beta_decorator.py+++ b/libs/core/langchain_core/_api/beta_decorator.py@@ -51,16 +51,16 @@ def beta(own (annotation-emitting) `C.__init__`).Args:- message : str, optional+ message:Override the default beta message. The %(since)s,%(name)s, %(alternative)s, %(obj_type)s, %(addendum)s,and %(removal)s format specifiers will be replaced by thevalues of the respective arguments passed to this function.- name : str, optional+ name:The name of the beta object.- obj_type : str, optional+ obj_type:The object type being beta.- addendum : str, optional+ addendum:Additional text appended directly to the final message.Returns:diff --git a/libs/core/langchain_core/_api/deprecation.py b/libs/core/langchain_core/_api/deprecation.pyindex 6abcc7a396..91efcbae54 100644--- a/libs/core/langchain_core/_api/deprecation.py+++ b/libs/core/langchain_core/_api/deprecation.py@@ -97,34 +97,34 @@ def deprecated(property, and 'function' otherwise.Args:- since : str+ since:The release at which this API became deprecated.- message : str, optional+ message:Override the default deprecation message. The %(since)s,%(name)s, %(alternative)s, %(obj_type)s, %(addendum)s,and %(removal)s format specifiers will be replaced by thevalues of the respective arguments passed to this function.- name : str, optional+ name:The name of the deprecated object.- alternative : str, optional+ alternative:An alternative API that the user may use in place of thedeprecated API. The deprecation warning will tell the userabout this alternative if provided.- alternative_import: str, optional+ alternative_import:An alternative import that the user may use instead.- pending : bool, optional+ pending:If `True`, uses a `PendingDeprecationWarning` instead of aDeprecationWarning. Cannot be used together with removal.- obj_type : str, optional+ obj_type:The object type being deprecated.- addendum : str, optional+ addendum:Additional text appended directly to the final message.- removal : str, optional+ removal:The expected removal version. With the default (an emptystring), a removal version is automatically computed fromsince. Set to other Falsy values to not schedule a removaldate. Cannot be used together with pending.- package: str, optional+ package:The package of the deprecated object.Returns:diff --git a/libs/core/langchain_core/callbacks/base.py b/libs/core/langchain_core/callbacks/base.pyindex 022c3d867e..d7ea77b99f 100644--- a/libs/core/langchain_core/callbacks/base.py+++ b/libs/core/langchain_core/callbacks/base.py@@ -35,10 +35,10 @@ class RetrieverManagerMixin:"""Run when Retriever errors.Args:- error (BaseException): The error that occurred.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""def on_retriever_end(@@ -52,10 +52,10 @@ class RetrieverManagerMixin:"""Run when Retriever ends running.Args:- documents (Sequence[Document]): The documents retrieved.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""@@ -76,12 +76,11 @@ class LLMManagerMixin:For both chat models and non-chat models (legacy LLMs).Args:- token (str): The new token.- chunk (GenerationChunk | ChatGenerationChunk): The new generated chunk,- containing content and other information.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""def on_llm_end(@@ -95,10 +94,10 @@ class LLMManagerMixin:"""Run when LLM ends running.Args:- response (LLMResult): The response which was generated.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""def on_llm_error(@@ -112,10 +111,10 @@ class LLMManagerMixin:"""Run when LLM errors.Args:- error (BaseException): The error that occurred.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""@@ -133,10 +132,10 @@ class ChainManagerMixin:"""Run when chain ends running.Args:- outputs (dict[str, Any]): The outputs of the chain.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""def on_chain_error(@@ -150,10 +149,10 @@ class ChainManagerMixin:"""Run when chain errors.Args:- error (BaseException): The error that occurred.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""def on_agent_action(@@ -167,10 +166,10 @@ class ChainManagerMixin:"""Run on agent action.Args:- action (AgentAction): The agent action.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""def on_agent_finish(@@ -184,10 +183,10 @@ class ChainManagerMixin:"""Run on the agent end.Args:- finish (AgentFinish): The agent finish.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""@@ -205,10 +204,10 @@ class ToolManagerMixin:"""Run when the tool ends running.Args:- output (Any): The output of the tool.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""def on_tool_error(@@ -222,10 +221,10 @@ class ToolManagerMixin:"""Run when tool errors.Args:- error (BaseException): The error that occurred.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""@@ -251,13 +250,13 @@ class CallbackManagerMixin:``on_chat_model_start`` instead.Args:- serialized (dict[str, Any]): The serialized LLM.- prompts (list[str]): The prompts.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- metadata (dict[str, Any] | None): The metadata.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ metadata: The metadata.+ **kwargs: Additional keyword arguments."""def on_chat_model_start(@@ -278,13 +277,13 @@ class CallbackManagerMixin:a non-chat model, you should use ``on_llm_start`` instead.Args:- serialized (dict[str, Any]): The serialized chat model.- messages (list[list[BaseMessage]]): The messages.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- metadata (dict[str, Any] | None): The metadata.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ metadata: The metadata.+ **kwargs: Additional keyword arguments."""# NotImplementedError is thrown intentionally# Callback handler will fall back to on_llm_start if this is exception is thrown@@ -305,13 +304,13 @@ class CallbackManagerMixin:"""Run when the Retriever starts running.Args:- serialized (dict[str, Any]): The serialized Retriever.- query (str): The query.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- metadata (dict[str, Any] | None): The metadata.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ metadata: The metadata.+ **kwargs: Additional keyword arguments."""def on_chain_start(@@ -328,13 +327,13 @@ class CallbackManagerMixin:"""Run when a chain starts running.Args:- serialized (dict[str, Any]): The serialized chain.- inputs (dict[str, Any]): The inputs.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- metadata (dict[str, Any] | None): The metadata.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ metadata: The metadata.+ **kwargs: Additional keyword arguments."""def on_tool_start(@@ -352,14 +351,14 @@ class CallbackManagerMixin:"""Run when the tool starts running.Args:- serialized (dict[str, Any]): The serialized tool.- input_str (str): The input string.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- metadata (dict[str, Any] | None): The metadata.- inputs (dict[str, Any] | None): The inputs.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ metadata: The metadata.+ inputs: The inputs.+ **kwargs: Additional keyword arguments."""@@ -377,10 +376,10 @@ class RunManagerMixin:"""Run on an arbitrary text.Args:- text (str): The text.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""def on_retry(@@ -394,10 +393,10 @@ class RunManagerMixin:"""Run on a retry event.Args:- retry_state (RetryCallState): The retry state.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""def on_custom_event(@@ -500,13 +499,13 @@ class AsyncCallbackHandler(BaseCallbackHandler):``on_chat_model_start`` instead.Args:- serialized (dict[str, Any]): The serialized LLM.- prompts (list[str]): The prompts.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- metadata (dict[str, Any] | None): The metadata.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ metadata: The metadata.+ **kwargs: Additional keyword arguments."""async def on_chat_model_start(@@ -527,13 +526,13 @@ class AsyncCallbackHandler(BaseCallbackHandler):a non-chat model, you should use ``on_llm_start`` instead.Args:- serialized (dict[str, Any]): The serialized chat model.- messages (list[list[BaseMessage]]): The messages.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- metadata (dict[str, Any] | None): The metadata.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ metadata: The metadata.+ **kwargs: Additional keyword arguments."""# NotImplementedError is thrown intentionally# Callback handler will fall back to on_llm_start if this is exception is thrown@@ -555,13 +554,12 @@ class AsyncCallbackHandler(BaseCallbackHandler):For both chat models and non-chat models (legacy LLMs).Args:- token (str): The new token.- chunk (GenerationChunk | ChatGenerationChunk): The new generated chunk,- containing content and other information.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ **kwargs: Additional keyword arguments."""async def on_llm_end(@@ -576,11 +574,11 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run when the model ends running.Args:- response (LLMResult): The response which was generated.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ **kwargs: Additional keyword arguments."""async def on_llm_error(@@ -599,7 +597,7 @@ class AsyncCallbackHandler(BaseCallbackHandler):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.tags: The tags.- kwargs (Any): Additional keyword arguments.+ **kwargs: Additional keyword arguments.- response (LLMResult): The response which was generated beforethe error occurred."""@@ -618,13 +616,13 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run when a chain starts running.Args:- serialized (dict[str, Any]): The serialized chain.- inputs (dict[str, Any]): The inputs.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- metadata (dict[str, Any] | None): The metadata.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ metadata: The metadata.+ **kwargs: Additional keyword arguments."""async def on_chain_end(@@ -639,11 +637,11 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run when a chain ends running.Args:- outputs (dict[str, Any]): The outputs of the chain.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ **kwargs: Additional keyword arguments."""async def on_chain_error(@@ -658,11 +656,11 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run when chain errors.Args:- error (BaseException): The error that occurred.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ **kwargs: Additional keyword arguments."""async def on_tool_start(@@ -680,14 +678,14 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run when the tool starts running.Args:- serialized (dict[str, Any]): The serialized tool.- input_str (str): The input string.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- metadata (dict[str, Any] | None): The metadata.- inputs (dict[str, Any] | None): The inputs.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ metadata: The metadata.+ inputs: The inputs.+ **kwargs: Additional keyword arguments."""async def on_tool_end(@@ -702,11 +700,11 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run when the tool ends running.Args:- output (Any): The output of the tool.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ **kwargs: Additional keyword arguments."""async def on_tool_error(@@ -721,11 +719,11 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run when tool errors.Args:- error (BaseException): The error that occurred.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ **kwargs: Additional keyword arguments."""async def on_text(@@ -740,11 +738,11 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run on an arbitrary text.Args:- text (str): The text.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ **kwargs: Additional keyword arguments."""async def on_retry(@@ -758,10 +756,10 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run on a retry event.Args:- retry_state (RetryCallState): The retry state.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- kwargs (Any): Additional keyword arguments.+ 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.+ **kwargs: Additional keyword arguments."""async def on_agent_action(@@ -776,11 +774,11 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run on agent action.Args:- action (AgentAction): The agent action.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ **kwargs: Additional keyword arguments."""async def on_agent_finish(@@ -795,11 +793,11 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run on the agent end.Args:- finish (AgentFinish): The agent finish.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ **kwargs: Additional keyword arguments."""async def on_retriever_start(@@ -816,13 +814,13 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run on the retriever start.Args:- serialized (dict[str, Any]): The serialized retriever.- query (str): The query.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- metadata (dict[str, Any] | None): The metadata.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ metadata: The metadata.+ **kwargs: Additional keyword arguments."""async def on_retriever_end(@@ -837,11 +835,11 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run on the retriever end.Args:- documents (Sequence[Document]): The documents retrieved.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ **kwargs: Additional keyword arguments."""async def on_retriever_error(@@ -856,11 +854,11 @@ class AsyncCallbackHandler(BaseCallbackHandler):"""Run on retriever error.Args:- error (BaseException): The error that occurred.- run_id (UUID): The run ID. This is the ID of the current run.- parent_run_id (UUID): The parent run ID. This is the ID of the parent run.- tags (list[str] | None): The tags.- kwargs (Any): Additional keyword arguments.+ 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.+ tags: The tags.+ **kwargs: Additional keyword arguments."""async def on_custom_event(@@ -943,8 +941,7 @@ class BaseCallbackManager(CallbackManagerMixin):within merge_configs.Returns:- BaseCallbackManager: The merged callback manager of the same type- as the current object.+ The merged callback manager of the same type as the current object.Example: Merging two callback managers.@@ -1008,8 +1005,8 @@ class BaseCallbackManager(CallbackManagerMixin):"""Add a handler to the callback manager.Args:- handler (BaseCallbackHandler): The handler to add.- inherit (bool): Whether to inherit the handler. Default is True.+ handler: The handler to add.+ inherit: Whether to inherit the handler. Default is True."""if handler not in self.handlers:self.handlers.append(handler)@@ -1020,7 +1017,7 @@ class BaseCallbackManager(CallbackManagerMixin):"""Remove a handler from the callback manager.Args:- handler (BaseCallbackHandler): The handler to remove.+ handler: The handler to remove."""if handler in self.handlers:self.handlers.remove(handler)@@ -1035,8 +1032,8 @@ class BaseCallbackManager(CallbackManagerMixin):"""Set handlers as the only handlers on the callback manager.Args:- handlers (list[BaseCallbackHandler]): The handlers to set.- inherit (bool): Whether to inherit the handlers. Default is True.+ handlers: The handlers to set.+ inherit: Whether to inherit the handlers. Default is True."""self.handlers = []self.inheritable_handlers = []@@ -1051,8 +1048,8 @@ class BaseCallbackManager(CallbackManagerMixin):"""Set handler as the only handler on the callback manager.Args:- handler (BaseCallbackHandler): The handler to set.- inherit (bool): Whether to inherit the handler. Default is True.+ handler: The handler to set.+ inherit: Whether to inherit the handler. Default is True."""self.set_handlers([handler], inherit=inherit)@@ -1064,8 +1061,8 @@ class BaseCallbackManager(CallbackManagerMixin):"""Add tags to the callback manager.Args:- tags (list[str]): The tags to add.- inherit (bool): Whether to inherit the tags. Default is True.+ tags: The tags to add.+ inherit: Whether to inherit the tags. Default is True."""for tag in tags:if tag in self.tags:@@ -1078,7 +1075,7 @@ class BaseCallbackManager(CallbackManagerMixin):"""Remove tags from the callback manager.Args:- tags (list[str]): The tags to remove.+ tags: The tags to remove."""for tag in tags:if tag in self.tags:@@ -1094,8 +1091,8 @@ class BaseCallbackManager(CallbackManagerMixin):"""Add metadata to the callback manager.Args:- metadata (dict[str, Any]): The metadata to add.- inherit (bool): Whether to inherit the metadata. Default is True.+ metadata: The metadata to add.+ inherit: Whether to inherit the metadata. Default is True."""self.metadata.update(metadata)if inherit:@@ -1105,7 +1102,7 @@ class BaseCallbackManager(CallbackManagerMixin):"""Remove metadata from the callback manager.Args:- keys (list[str]): The keys to remove.+ keys: The keys to remove."""for key in keys:self.metadata.pop(key, None)diff --git a/libs/core/langchain_core/callbacks/manager.py b/libs/core/langchain_core/callbacks/manager.pyindex 5deddddacc..7061adc67f 100644--- a/libs/core/langchain_core/callbacks/manager.py+++ b/libs/core/langchain_core/callbacks/manager.py@@ -78,20 +78,14 @@ def trace_as_chain_group(they aren't composed in a single chain.Args:- group_name (str): The name of the chain group.- callback_manager (CallbackManager, optional): The callback manager to use.- Defaults to `None`.- inputs (dict[str, Any], optional): The inputs to the chain group.- Defaults to `None`.- project_name (str, optional): The name of the project.- Defaults to `None`.- example_id (str or UUID, optional): The ID of the example.- Defaults to `None`.- run_id (UUID, optional): The ID of the run.- tags (list[str], optional): The inheritable tags to apply to all runs.- Defaults to `None`.- metadata (dict[str, Any], optional): The metadata to apply to all runs.- Defaults to `None`.+ group_name: The name of the chain group.+ callback_manager: The callback manager to use. Defaults to `None`.+ inputs: The inputs to the chain group. Defaults to `None`.+ project_name: The name of the project. Defaults to `None`.+ example_id: The ID of the example. Defaults to `None`.+ run_id: The ID of the run.+ tags: The inheritable tags to apply to all runs. Defaults to `None`.+ metadata: The metadata to apply to all runs. Defaults to `None`.!!! noteMust have `LANGCHAIN_TRACING_V2` env var set to true to see the trace in@@ -162,21 +156,15 @@ async def atrace_as_chain_group(they aren't composed in a single chain.Args:- group_name (str): The name of the chain group.- callback_manager (AsyncCallbackManager, optional): The async callback manager- to use, which manages tracing and other callback behavior. Defaults to- `None`.- inputs (dict[str, Any], optional): The inputs to the chain group.- Defaults to `None`.- project_name (str, optional): The name of the project.- Defaults to `None`.- example_id (str or UUID, optional): The ID of the example.- Defaults to `None`.- run_id (UUID, optional): The ID of the run.- tags (list[str], optional): The inheritable tags to apply to all runs.- Defaults to `None`.- metadata (dict[str, Any], optional): The metadata to apply to all runs.- Defaults to `None`.+ group_name: The name of the chain group.+ callback_manager: The async callback manager to use,+ which manages tracing and other callback behavior. Defaults to `None`.+ inputs: The inputs to the chain group. Defaults to `None`.+ project_name: The name of the project. Defaults to `None`.+ example_id: The ID of the example. Defaults to `None`.+ run_id: The ID of the run.+ tags: The inheritable tags to apply to all runs. Defaults to `None`.+ metadata: The metadata to apply to all runs. Defaults to `None`.Yields:The async callback manager for the chain group.@@ -236,10 +224,10 @@ def shielded(func: Func) -> Func:"""Makes so an awaitable method is always shielded from cancellation.Args:- func (Callable): The function to shield.+ func: The function to shield.Returns:- Callable: The shielded function+ The shielded function"""@@ -475,19 +463,14 @@ class BaseRunManager(RunManagerMixin):"""Initialize the run manager.Args:- run_id (UUID): The ID of the run.- handlers (list[BaseCallbackHandler]): The list of handlers.- inheritable_handlers (list[BaseCallbackHandler]):- The list of inheritable handlers.- parent_run_id (UUID, optional): The ID of the parent run.- Defaults to `None`.- tags (list[str] | None): The list of tags. Defaults to `None`.- inheritable_tags (list[str] | None): The list of inheritable tags.- Defaults to `None`.- metadata (dict[str, Any] | None): The metadata.- Defaults to `None`.- inheritable_metadata (dict[str, Any] | None): The inheritable metadata.- Defaults to `None`.+ run_id: The ID of the run.+ handlers: The list of handlers.+ inheritable_handlers: The list of inheritable handlers.+ parent_run_id: The ID of the parent run. Defaults to `None`.+ tags: The list of tags. Defaults to `None`.+ inheritable_tags: The list of inheritable tags. Defaults to `None`.+ metadata: The metadata. Defaults to `None`.+ inheritable_metadata: The inheritable metadata. Defaults to `None`."""self.run_id = run_id@@ -504,7 +487,7 @@ class BaseRunManager(RunManagerMixin):"""Return a manager that doesn't perform any operations.Returns:- BaseRunManager: The noop manager.+ The noop manager."""return cls(@@ -529,8 +512,8 @@ class RunManager(BaseRunManager):"""Run when a text is received.Args:- text (str): The received text.- **kwargs (Any): Additional keyword arguments.+ text: The received text.+ **kwargs: Additional keyword arguments."""if not self.handlers:return@@ -553,8 +536,8 @@ class RunManager(BaseRunManager):"""Run when a retry is received.Args:- retry_state (RetryCallState): The retry state.- **kwargs (Any): Additional keyword arguments.+ retry_state: The retry state.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -578,11 +561,10 @@ class ParentRunManager(RunManager):"""Get a child callback manager.Args:- tag (str, optional): The tag for the child callback manager.- Defaults to `None`.+ tag: The tag for the child callback manager. Defaults to `None`.Returns:- CallbackManager: The child callback manager.+ The child callback manager."""manager = CallbackManager(handlers=[], parent_run_id=self.run_id)@@ -602,7 +584,7 @@ class AsyncRunManager(BaseRunManager, ABC):"""Get the equivalent sync RunManager.Returns:- RunManager: The sync RunManager.+ The sync RunManager."""@@ -614,8 +596,8 @@ class AsyncRunManager(BaseRunManager, ABC):"""Run when a text is received.Args:- text (str): The received text.- **kwargs (Any): Additional keyword arguments.+ text: The received text.+ **kwargs: Additional keyword arguments."""if not self.handlers:return@@ -638,8 +620,8 @@ class AsyncRunManager(BaseRunManager, ABC):"""Async run when a retry is received.Args:- retry_state (RetryCallState): The retry state.- **kwargs (Any): Additional keyword arguments.+ retry_state: The retry state.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -663,11 +645,10 @@ class AsyncParentRunManager(AsyncRunManager):"""Get a child callback manager.Args:- tag (str, optional): The tag for the child callback manager.- Defaults to `None`.+ tag: The tag for the child callback manager. Defaults to `None`.Returns:- AsyncCallbackManager: The child callback manager.+ The child callback manager."""manager = AsyncCallbackManager(handlers=[], parent_run_id=self.run_id)@@ -715,8 +696,8 @@ class CallbackManagerForLLMRun(RunManager, LLMManagerMixin):"""Run when LLM ends running.Args:- response (LLMResult): The LLM result.- **kwargs (Any): Additional keyword arguments.+ response: The LLM result.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -740,8 +721,8 @@ class CallbackManagerForLLMRun(RunManager, LLMManagerMixin):"""Run when LLM errors.Args:- error (Exception or KeyboardInterrupt): The error.- kwargs (Any): Additional keyword arguments.+ error: The error.+ **kwargs: Additional keyword arguments.- response (LLMResult): The response which was generated beforethe error occurred."""@@ -766,7 +747,7 @@ class AsyncCallbackManagerForLLMRun(AsyncRunManager, LLMManagerMixin):"""Get the equivalent sync RunManager.Returns:- CallbackManagerForLLMRun: The sync RunManager.+ The sync RunManager."""return CallbackManagerForLLMRun(@@ -814,8 +795,8 @@ class AsyncCallbackManagerForLLMRun(AsyncRunManager, LLMManagerMixin):"""Run when LLM ends running.Args:- response (LLMResult): The LLM result.- **kwargs (Any): Additional keyword arguments.+ response: The LLM result.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -840,8 +821,8 @@ class AsyncCallbackManagerForLLMRun(AsyncRunManager, LLMManagerMixin):"""Run when LLM errors.Args:- error (Exception or KeyboardInterrupt): The error.- kwargs (Any): Additional keyword arguments.+ error: The error.+ **kwargs: Additional keyword arguments.- response (LLMResult): The response which was generated beforethe error occurred.@@ -869,8 +850,8 @@ class CallbackManagerForChainRun(ParentRunManager, ChainManagerMixin):"""Run when chain ends running.Args:- outputs (Union[dict[str, Any], Any]): The outputs of the chain.- **kwargs (Any): Additional keyword arguments.+ outputs: The outputs of the chain.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -894,8 +875,8 @@ class CallbackManagerForChainRun(ParentRunManager, ChainManagerMixin):"""Run when chain errors.Args:- error (Exception or KeyboardInterrupt): The error.- **kwargs (Any): Additional keyword arguments.+ error: The error.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -915,8 +896,8 @@ class CallbackManagerForChainRun(ParentRunManager, ChainManagerMixin):"""Run when agent action is received.Args:- action (AgentAction): The agent action.- **kwargs (Any): Additional keyword arguments.+ action: The agent action.+ **kwargs: Additional keyword arguments."""if not self.handlers:return@@ -935,8 +916,8 @@ class CallbackManagerForChainRun(ParentRunManager, ChainManagerMixin):"""Run when agent finish is received.Args:- finish (AgentFinish): The agent finish.- **kwargs (Any): Additional keyword arguments.+ finish: The agent finish.+ **kwargs: Additional keyword arguments."""if not self.handlers:return@@ -959,7 +940,7 @@ class AsyncCallbackManagerForChainRun(AsyncParentRunManager, ChainManagerMixin):"""Get the equivalent sync RunManager.Returns:- CallbackManagerForChainRun: The sync RunManager.+ The sync RunManager."""return CallbackManagerForChainRun(run_id=self.run_id,@@ -977,8 +958,8 @@ class AsyncCallbackManagerForChainRun(AsyncParentRunManager, ChainManagerMixin):"""Run when a chain ends running.Args:- outputs (Union[dict[str, Any], Any]): The outputs of the chain.- **kwargs (Any): Additional keyword arguments.+ outputs: The outputs of the chain.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -1003,8 +984,8 @@ class AsyncCallbackManagerForChainRun(AsyncParentRunManager, ChainManagerMixin):"""Run when chain errors.Args:- error (Exception or KeyboardInterrupt): The error.- **kwargs (Any): Additional keyword arguments.+ error: The error.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -1024,8 +1005,8 @@ class AsyncCallbackManagerForChainRun(AsyncParentRunManager, ChainManagerMixin):"""Run when agent action is received.Args:- action (AgentAction): The agent action.- **kwargs (Any): Additional keyword arguments.+ action: The agent action.+ **kwargs: Additional keyword arguments."""if not self.handlers:return@@ -1044,8 +1025,8 @@ class AsyncCallbackManagerForChainRun(AsyncParentRunManager, ChainManagerMixin):"""Run when agent finish is received.Args:- finish (AgentFinish): The agent finish.- **kwargs (Any): Additional keyword arguments.+ finish: The agent finish.+ **kwargs: Additional keyword arguments."""if not self.handlers:return@@ -1072,8 +1053,8 @@ class CallbackManagerForToolRun(ParentRunManager, ToolManagerMixin):"""Run when the tool ends running.Args:- output (Any): The output of the tool.- **kwargs (Any): The keyword arguments to pass to the event handler+ output: The output of the tool.+ **kwargs: The keyword arguments to pass to the event handler"""if not self.handlers:@@ -1097,8 +1078,8 @@ class CallbackManagerForToolRun(ParentRunManager, ToolManagerMixin):"""Run when tool errors.Args:- error (Exception or KeyboardInterrupt): The error.- **kwargs (Any): Additional keyword arguments.+ error: The error.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -1122,7 +1103,7 @@ class AsyncCallbackManagerForToolRun(AsyncParentRunManager, ToolManagerMixin):"""Get the equivalent sync RunManager.Returns:- CallbackManagerForToolRun: The sync RunManager.+ The sync RunManager."""return CallbackManagerForToolRun(run_id=self.run_id,@@ -1139,8 +1120,8 @@ class AsyncCallbackManagerForToolRun(AsyncParentRunManager, ToolManagerMixin):"""Async run when the tool ends running.Args:- output (Any): The output of the tool.- **kwargs (Any): Additional keyword arguments.+ output: The output of the tool.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -1164,8 +1145,8 @@ class AsyncCallbackManagerForToolRun(AsyncParentRunManager, ToolManagerMixin):"""Run when tool errors.Args:- error (Exception or KeyboardInterrupt): The error.- **kwargs (Any): Additional keyword arguments.+ error: The error.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -1193,8 +1174,8 @@ class CallbackManagerForRetrieverRun(ParentRunManager, RetrieverManagerMixin):"""Run when retriever ends running.Args:- documents (Sequence[Document]): The retrieved documents.- **kwargs (Any): Additional keyword arguments.+ documents: The retrieved documents.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -1218,8 +1199,8 @@ class CallbackManagerForRetrieverRun(ParentRunManager, RetrieverManagerMixin):"""Run when retriever errors.Args:- error (BaseException): The error.- **kwargs (Any): Additional keyword arguments.+ error: The error.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -1246,7 +1227,7 @@ class AsyncCallbackManagerForRetrieverRun("""Get the equivalent sync RunManager.Returns:- CallbackManagerForRetrieverRun: The sync RunManager.+ The sync RunManager."""return CallbackManagerForRetrieverRun(@@ -1267,8 +1248,8 @@ class AsyncCallbackManagerForRetrieverRun("""Run when the retriever ends running.Args:- documents (Sequence[Document]): The retrieved documents.- **kwargs (Any): Additional keyword arguments.+ documents: The retrieved documents.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -1293,8 +1274,8 @@ class AsyncCallbackManagerForRetrieverRun("""Run when retriever errors.Args:- error (BaseException): The error.- **kwargs (Any): Additional keyword arguments.+ error: The error.+ **kwargs: Additional keyword arguments."""if not self.handlers:@@ -1324,14 +1305,13 @@ class CallbackManager(BaseCallbackManager):"""Run when LLM starts running.Args:- serialized (dict[str, Any]): The serialized LLM.- prompts (list[str]): The list of prompts.- run_id (UUID, optional): The ID of the run. Defaults to `None`.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized LLM.+ prompts: The list of prompts.+ run_id: The ID of the run. Defaults to `None`.+ **kwargs: Additional keyword arguments.Returns:- list[CallbackManagerForLLMRun]: A callback manager for each- prompt as an LLM run.+ A callback manager for each prompt as an LLM run."""managers = []@@ -1376,14 +1356,13 @@ class CallbackManager(BaseCallbackManager):"""Run when chat model starts running.Args:- serialized (dict[str, Any]): The serialized LLM.- messages (list[list[BaseMessage]]): The list of messages.- run_id (UUID, optional): The ID of the run. Defaults to `None`.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized LLM.+ messages: The list of messages.+ run_id: The ID of the run. Defaults to `None`.+ **kwargs: Additional keyword arguments.Returns:- list[CallbackManagerForLLMRun]: A callback manager for each- list of messages as an LLM run.+ A callback manager for each list of messages as an LLM run."""managers = []@@ -1431,13 +1410,13 @@ class CallbackManager(BaseCallbackManager):"""Run when chain starts running.Args:- serialized (dict[str, Any] | None): The serialized chain.- inputs (Union[dict[str, Any], Any]): The inputs to the chain.- run_id (UUID, optional): The ID of the run. Defaults to `None`.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized chain.+ inputs: The inputs to the chain.+ run_id: The ID of the run. Defaults to `None`.+ **kwargs: Additional keyword arguments.Returns:- CallbackManagerForChainRun: The callback manager for the chain run.+ The callback manager for the chain run."""if run_id is None:@@ -1489,10 +1468,10 @@ class CallbackManager(BaseCallbackManager):input is needed.If provided, the inputs are expected to be formatted as a dict.The keys will correspond to the named-arguments in the tool.- **kwargs (Any): The keyword arguments to pass to the event handler+ **kwargs: The keyword arguments to pass to the event handlerReturns:- CallbackManagerForToolRun: The callback manager for the tool run.+ The callback manager for the tool run."""if run_id is None:@@ -1535,12 +1514,11 @@ class CallbackManager(BaseCallbackManager):"""Run when the retriever starts running.Args:- serialized (dict[str, Any] | None): The serialized retriever.- query (str): The query.- run_id (UUID, optional): The ID of the run. Defaults to `None`.- parent_run_id (UUID, optional): The ID of the parent run. Defaults to- `None`.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized retriever.+ query: The query.+ run_id: The ID of the run. Defaults to `None`.+ parent_run_id: The ID of the parent run. Defaults to `None`.+ **kwargs: Additional keyword arguments.Returns:The callback manager for the retriever run.@@ -1642,7 +1620,7 @@ class CallbackManager(BaseCallbackManager):local_metadata: The local metadata.Returns:- CallbackManager: The configured callback manager.+ The configured callback manager."""return _configure(cls,@@ -1710,8 +1688,8 @@ class CallbackManagerForChainGroup(CallbackManager):from the current object.Returns:- CallbackManagerForChainGroup: A copy of the current object with the- handlers, tags, and other attributes merged from the other object.+ A copy of the current object with the handlers, tags, and other attributes+ merged from the other object.Example: Merging two callback managers.@@ -1770,8 +1748,8 @@ class CallbackManagerForChainGroup(CallbackManager):"""Run when traced chain group ends.Args:- outputs (Union[dict[str, Any], Any]): The outputs of the chain.- **kwargs (Any): Additional keyword arguments.+ outputs: The outputs of the chain.+ **kwargs: Additional keyword arguments."""self.ended = True@@ -1785,8 +1763,8 @@ class CallbackManagerForChainGroup(CallbackManager):"""Run when chain errors.Args:- error (Exception or KeyboardInterrupt): The error.- **kwargs (Any): Additional keyword arguments.+ error: The error.+ **kwargs: Additional keyword arguments."""self.ended = True@@ -1811,15 +1789,14 @@ class AsyncCallbackManager(BaseCallbackManager):"""Run when LLM starts running.Args:- serialized (dict[str, Any]): The serialized LLM.- prompts (list[str]): The list of prompts.- run_id (UUID, optional): The ID of the run. Defaults to `None`.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized LLM.+ prompts: The list of prompts.+ run_id: The ID of the run. Defaults to `None`.+ **kwargs: Additional keyword arguments.Returns:- list[AsyncCallbackManagerForLLMRun]: The list of async- callback managers, one for each LLM Run corresponding- to each prompt.+ The list of async callback managers, one for each LLM Run corresponding to+ each prompt."""inline_tasks = []non_inline_tasks = []@@ -1900,15 +1877,14 @@ class AsyncCallbackManager(BaseCallbackManager):"""Async run when LLM starts running.Args:- serialized (dict[str, Any]): The serialized LLM.- messages (list[list[BaseMessage]]): The list of messages.- run_id (UUID, optional): The ID of the run. Defaults to `None`.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized LLM.+ messages: The list of messages.+ run_id: The ID of the run. Defaults to `None`.+ **kwargs: Additional keyword arguments.Returns:- list[AsyncCallbackManagerForLLMRun]: The list of- async callback managers, one for each LLM Run- corresponding to each inner message list.+ The list of async callback managers, one for each LLM Run corresponding to+ each inner message list."""inline_tasks = []non_inline_tasks = []@@ -1972,14 +1948,13 @@ class AsyncCallbackManager(BaseCallbackManager):"""Async run when chain starts running.Args:- serialized (dict[str, Any] | None): The serialized chain.- inputs (Union[dict[str, Any], Any]): The inputs to the chain.- run_id (UUID, optional): The ID of the run. Defaults to `None`.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized chain.+ inputs: The inputs to the chain.+ run_id: The ID of the run. Defaults to `None`.+ **kwargs: Additional keyword arguments.Returns:- AsyncCallbackManagerForChainRun: The async callback manager- for the chain run.+ The async callback manager for the chain run."""if run_id is None:run_id = uuid.uuid4()@@ -2020,16 +1995,14 @@ class AsyncCallbackManager(BaseCallbackManager):"""Run when the tool starts running.Args:- serialized (dict[str, Any] | None): The serialized tool.- input_str (str): The input to the tool.- run_id (UUID, optional): The ID of the run. Defaults to `None`.- parent_run_id (UUID, optional): The ID of the parent run.- Defaults to `None`.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized tool.+ input_str: The input to the tool.+ run_id: The ID of the run. Defaults to `None`.+ parent_run_id: The ID of the parent run. Defaults to `None`.+ **kwargs: Additional keyword arguments.Returns:- AsyncCallbackManagerForToolRun: The async callback manager- for the tool run.+ The async callback manager for the tool run."""if run_id is None:run_id = uuid.uuid4()@@ -2116,16 +2089,14 @@ class AsyncCallbackManager(BaseCallbackManager):"""Run when the retriever starts running.Args:- serialized (dict[str, Any] | None): The serialized retriever.- query (str): The query.- run_id (UUID, optional): The ID of the run. Defaults to `None`.- parent_run_id (UUID, optional): The ID of the parent run. Defaults to- `None`.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized retriever.+ query: The query.+ run_id: The ID of the run. Defaults to `None`.+ parent_run_id: The ID of the parent run. Defaults to `None`.+ **kwargs: Additional keyword arguments.Returns:- AsyncCallbackManagerForRetrieverRun: The async callback manager- for the retriever run.+ The async callback manager for the retriever run."""if run_id is None:run_id = uuid.uuid4()@@ -2177,7 +2148,7 @@ class AsyncCallbackManager(BaseCallbackManager):local_metadata: The local metadata.Returns:- AsyncCallbackManager: The configured async callback manager.+ The configured async callback manager."""return _configure(cls,@@ -2304,8 +2275,8 @@ class AsyncCallbackManagerForChainGroup(AsyncCallbackManager):"""Run when traced chain group ends.Args:- outputs (Union[dict[str, Any], Any]): The outputs of the chain.- **kwargs (Any): Additional keyword arguments.+ outputs: The outputs of the chain.+ **kwargs: Additional keyword arguments."""self.ended = Trueawait self.parent_run_manager.on_chain_end(outputs, **kwargs)@@ -2318,8 +2289,8 @@ class AsyncCallbackManagerForChainGroup(AsyncCallbackManager):"""Run when chain errors.Args:- error (Exception or KeyboardInterrupt): The error.- **kwargs (Any): Additional keyword arguments.+ error: The error.+ **kwargs: Additional keyword arguments."""self.ended = Trueawait self.parent_run_manager.on_chain_error(error, **kwargs)@@ -2355,7 +2326,7 @@ def _configure(RuntimeError: If `LANGCHAIN_TRACING` is set but `LANGCHAIN_TRACING_V2` is not.Returns:- T: The configured callback manager.+ The configured callback manager."""tracing_context = get_tracing_context()tracing_metadata = tracing_context["metadata"]@@ -2512,8 +2483,8 @@ async def adispatch_custom_event(Args:name: The name of the adhoc event.data: The data for the adhoc event. Free form data. Ideally should be- JSON serializable to avoid serialization issues downstream, but- this is not enforced.+ JSON serializable to avoid serialization issues downstream, but+ this is not enforced.config: Optional config object. Mirrors the async API but not strictly needed.Raises:@@ -2638,8 +2609,8 @@ def dispatch_custom_event(Args:name: The name of the adhoc event.data: The data for the adhoc event. Free form data. Ideally should be- JSON serializable to avoid serialization issues downstream, but- this is not enforced.+ JSON serializable to avoid serialization issues downstream, but+ this is not enforced.config: Optional config object. Mirrors the async API but not strictly needed.Raises:diff --git a/libs/core/langchain_core/callbacks/stdout.py b/libs/core/langchain_core/callbacks/stdout.pyindex 30a5e2b125..c2a1cfe805 100644--- a/libs/core/langchain_core/callbacks/stdout.py+++ b/libs/core/langchain_core/callbacks/stdout.py@@ -31,9 +31,9 @@ class StdOutCallbackHandler(BaseCallbackHandler):"""Print out that we are entering a chain.Args:- serialized (dict[str, Any]): The serialized chain.- inputs (dict[str, Any]): The inputs to the chain.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized chain.+ inputs: The inputs to the chain.+ **kwargs: Additional keyword arguments."""if "name" in kwargs:name = kwargs["name"]@@ -48,8 +48,8 @@ class StdOutCallbackHandler(BaseCallbackHandler):"""Print out that we finished a chain.Args:- outputs (dict[str, Any]): The outputs of the chain.- **kwargs (Any): Additional keyword arguments.+ outputs: The outputs of the chain.+ **kwargs: Additional keyword arguments."""print("\n\033[1m> Finished chain.\033[0m") # noqa: T201@@ -60,9 +60,9 @@ class StdOutCallbackHandler(BaseCallbackHandler):"""Run on agent action.Args:- action (AgentAction): The agent action.- color (str | None): The color to use for the text. Defaults to `None`.- **kwargs (Any): Additional keyword arguments.+ action: The agent action.+ color: The color to use for the text. Defaults to `None`.+ **kwargs: Additional keyword arguments."""print_text(action.log, color=color or self.color)@@ -78,12 +78,11 @@ class StdOutCallbackHandler(BaseCallbackHandler):"""If not the final action, print out observation.Args:- output (Any): The output to print.- color (str | None): The color to use for the text. Defaults to `None`.- observation_prefix (str | None): The observation prefix.- Defaults to `None`.- llm_prefix (str | None): The LLM prefix. Defaults to `None`.- **kwargs (Any): Additional keyword arguments.+ output: The output to print.+ color: The color to use for the text. Defaults to `None`.+ observation_prefix: The observation prefix. Defaults to `None`.+ llm_prefix: The LLM prefix. Defaults to `None`.+ **kwargs: Additional keyword arguments."""output = str(output)if observation_prefix is not None:@@ -103,10 +102,10 @@ class StdOutCallbackHandler(BaseCallbackHandler):"""Run when the agent ends.Args:- text (str): The text to print.- color (str | None): The color to use for the text. Defaults to `None`.- end (str): The end character to use. Defaults to "".- **kwargs (Any): Additional keyword arguments.+ text: The text to print.+ color: The color to use for the text. Defaults to `None`.+ end: The end character to use. Defaults to "".+ **kwargs: Additional keyword arguments."""print_text(text, color=color or self.color, end=end)@@ -117,8 +116,8 @@ class StdOutCallbackHandler(BaseCallbackHandler):"""Run on the agent end.Args:- finish (AgentFinish): The agent finish.- color (str | None): The color to use for the text. Defaults to `None`.- **kwargs (Any): Additional keyword arguments.+ finish: The agent finish.+ color: The color to use for the text. Defaults to `None`.+ **kwargs: Additional keyword arguments."""print_text(finish.log, color=color or self.color, end="\n")diff --git a/libs/core/langchain_core/callbacks/streaming_stdout.py b/libs/core/langchain_core/callbacks/streaming_stdout.pyindex f8dbe518ea..0860123b2e 100644--- a/libs/core/langchain_core/callbacks/streaming_stdout.py+++ b/libs/core/langchain_core/callbacks/streaming_stdout.py@@ -24,9 +24,9 @@ class StreamingStdOutCallbackHandler(BaseCallbackHandler):"""Run when LLM starts running.Args:- serialized (dict[str, Any]): The serialized LLM.- prompts (list[str]): The prompts to run.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized LLM.+ prompts: The prompts to run.+ **kwargs: Additional keyword arguments."""def on_chat_model_start(@@ -38,9 +38,9 @@ class StreamingStdOutCallbackHandler(BaseCallbackHandler):"""Run when LLM starts running.Args:- serialized (dict[str, Any]): The serialized LLM.- messages (list[list[BaseMessage]]): The messages to run.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized LLM.+ messages: The messages to run.+ **kwargs: Additional keyword arguments."""@override@@ -48,8 +48,8 @@ class StreamingStdOutCallbackHandler(BaseCallbackHandler):"""Run on new LLM token. Only available when streaming is enabled.Args:- token (str): The new token.- **kwargs (Any): Additional keyword arguments.+ token: The new token.+ **kwargs: Additional keyword arguments."""sys.stdout.write(token)sys.stdout.flush()@@ -58,16 +58,16 @@ class StreamingStdOutCallbackHandler(BaseCallbackHandler):"""Run when LLM ends running.Args:- response (LLMResult): The response from the LLM.- **kwargs (Any): Additional keyword arguments.+ response: The response from the LLM.+ **kwargs: Additional keyword arguments."""def on_llm_error(self, error: BaseException, **kwargs: Any) -> None:"""Run when LLM errors.Args:- error (BaseException): The error that occurred.- **kwargs (Any): Additional keyword arguments.+ error: The error that occurred.+ **kwargs: Additional keyword arguments."""def on_chain_start(@@ -76,25 +76,25 @@ class StreamingStdOutCallbackHandler(BaseCallbackHandler):"""Run when a chain starts running.Args:- serialized (dict[str, Any]): The serialized chain.- inputs (dict[str, Any]): The inputs to the chain.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized chain.+ inputs: The inputs to the chain.+ **kwargs: Additional keyword arguments."""def on_chain_end(self, outputs: dict[str, Any], **kwargs: Any) -> None:"""Run when a chain ends running.Args:- outputs (dict[str, Any]): The outputs of the chain.- **kwargs (Any): Additional keyword arguments.+ outputs: The outputs of the chain.+ **kwargs: Additional keyword arguments."""def on_chain_error(self, error: BaseException, **kwargs: Any) -> None:"""Run when chain errors.Args:- error (BaseException): The error that occurred.- **kwargs (Any): Additional keyword arguments.+ error: The error that occurred.+ **kwargs: Additional keyword arguments."""def on_tool_start(@@ -103,47 +103,47 @@ class StreamingStdOutCallbackHandler(BaseCallbackHandler):"""Run when the tool starts running.Args:- serialized (dict[str, Any]): The serialized tool.- input_str (str): The input string.- **kwargs (Any): Additional keyword arguments.+ serialized: The serialized tool.+ input_str: The input string.+ **kwargs: Additional keyword arguments."""def on_agent_action(self, action: AgentAction, **kwargs: Any) -> Any:"""Run on agent action.Args:- action (AgentAction): The agent action.- **kwargs (Any): Additional keyword arguments.+ action: The agent action.+ **kwargs: Additional keyword arguments."""def on_tool_end(self, output: Any, **kwargs: Any) -> None:"""Run when tool ends running.Args:- output (Any): The output of the tool.- **kwargs (Any): Additional keyword arguments.+ output: The output of the tool.+ **kwargs: Additional keyword arguments."""def on_tool_error(self, error: BaseException, **kwargs: Any) -> None:"""Run when tool errors.Args:- error (BaseException): The error that occurred.- **kwargs (Any): Additional keyword arguments.+ error: The error that occurred.+ **kwargs: Additional keyword arguments."""def on_text(self, text: str, **kwargs: Any) -> None:"""Run on an arbitrary text.Args:- text (str): The text to print.- **kwargs (Any): Additional keyword arguments.+ text: The text to print.+ **kwargs: Additional keyword arguments."""def on_agent_finish(self, finish: AgentFinish, **kwargs: Any) -> None:"""Run on the agent end.Args:- finish (AgentFinish): The agent finish.- **kwargs (Any): Additional keyword arguments.+ finish: The agent finish.+ **kwargs: Additional keyword arguments."""diff --git a/libs/core/langchain_core/callbacks/usage.py b/libs/core/langchain_core/callbacks/usage.pyindex f498c6c53f..340e36eba2 100644--- a/libs/core/langchain_core/callbacks/usage.py+++ b/libs/core/langchain_core/callbacks/usage.py@@ -99,7 +99,7 @@ def get_usage_metadata_callback(``AIMessage.usage_metadata``.Args:- name (str): The name of the context variable. Defaults to+ name: The name of the context variable. Defaults to``'usage_metadata_callback'``.Yields:diff --git a/libs/core/langchain_core/indexing/base.py b/libs/core/langchain_core/indexing/base.pyindex ad9aecb7d9..a6f85dd749 100644--- a/libs/core/langchain_core/indexing/base.py+++ b/libs/core/langchain_core/indexing/base.py@@ -61,7 +61,7 @@ class RecordManager(ABC):"""Initialize the record manager.Args:- namespace (str): The namespace for the record manager.+ namespace: The namespace for the record manager."""self.namespace = namespace@@ -244,7 +244,7 @@ class InMemoryRecordManager(RecordManager):"""Initialize the in-memory record manager.Args:- namespace (str): The namespace for the record manager.+ namespace: The namespace for the record manager."""super().__init__(namespace)# Each key points to a dictionary@@ -529,7 +529,7 @@ class DocumentIndex(BaseRetriever):**kwargs: Additional keyword arguments.Returns:- UpsertResponse: A response object that contains the list of IDs that were+ A response object that contains the list of IDs that weresuccessfully added or updated in the vectorstore and the list of IDs thatfailed to be added or updated."""@@ -552,7 +552,7 @@ class DocumentIndex(BaseRetriever):**kwargs: Additional keyword arguments.Returns:- UpsertResponse: A response object that contains the list of IDs that were+ A response object that contains the list of IDs that weresuccessfully added or updated in the vectorstore and the list of IDs thatfailed to be added or updated."""@@ -571,12 +571,12 @@ class DocumentIndex(BaseRetriever):Args:ids: List of ids to delete.- kwargs: Additional keyword arguments. This is up to the implementation.+ **kwargs: Additional keyword arguments. This is up to the implementation.For example, can include an option to delete the entire index,or else issue a non-blocking delete etc.Returns:- DeleteResponse: A response object that contains the list of IDs that were+ A response object that contains the list of IDs that weresuccessfully deleted and the list of IDs that failed to be deleted."""@@ -589,11 +589,11 @@ class DocumentIndex(BaseRetriever):Args:ids: List of ids to delete.- kwargs: Additional keyword arguments. This is up to the implementation.+ **kwargs: Additional keyword arguments. This is up to the implementation.For example, can include an option to delete the entire index.Returns:- DeleteResponse: A response object that contains the list of IDs that were+ A response object that contains the list of IDs that weresuccessfully deleted and the list of IDs that failed to be deleted."""return await run_in_executor(@@ -624,10 +624,10 @@ class DocumentIndex(BaseRetriever):Args:ids: List of IDs to get.- kwargs: Additional keyword arguments. These are up to the implementation.+ **kwargs: Additional keyword arguments. These are up to the implementation.Returns:- list[Document]: List of documents that were found.+ List of documents that were found."""async def aget(@@ -650,10 +650,10 @@ class DocumentIndex(BaseRetriever):Args:ids: List of IDs to get.- kwargs: Additional keyword arguments. These are up to the implementation.+ **kwargs: Additional keyword arguments. These are up to the implementation.Returns:- list[Document]: List of documents that were found.+ List of documents that were found."""return await run_in_executor(None,diff --git a/libs/core/langchain_core/language_models/chat_models.py b/libs/core/langchain_core/language_models/chat_models.pyindex 091d785fad..48cd952122 100644--- a/libs/core/langchain_core/language_models/chat_models.py+++ b/libs/core/langchain_core/language_models/chat_models.py@@ -185,7 +185,7 @@ def generate_from_stream(stream: Iterator[ChatGenerationChunk]) -> ChatResult:ValueError: If no generations are found in the stream.Returns:- ChatResult: Chat result.+ Chat result."""generation = next(stream, None)@@ -213,7 +213,7 @@ async def agenerate_from_stream(stream: Iterator of `ChatGenerationChunk`.Returns:- ChatResult: Chat result.+ Chat result."""chunks = [chunk async for chunk in stream]diff --git a/libs/core/langchain_core/load/dump.py b/libs/core/langchain_core/load/dump.pyindex 9b7fff3266..01c886d33b 100644--- a/libs/core/langchain_core/load/dump.py+++ b/libs/core/langchain_core/load/dump.py@@ -45,7 +45,7 @@ def dumps(obj: Any, *, pretty: bool = False, **kwargs: Any) -> str:pretty: Whether to pretty print the json. If true, the json will beindented with 2 spaces (if no indent is provided as part of kwargs).Default is False.- kwargs: Additional arguments to pass to json.dumps+ **kwargs: Additional arguments to pass to json.dumpsReturns:A json string representation of the object.diff --git a/libs/core/langchain_core/messages/ai.py b/libs/core/langchain_core/messages/ai.pyindex 39187e34ec..4f5f8fb6b8 100644--- a/libs/core/langchain_core/messages/ai.py+++ b/libs/core/langchain_core/messages/ai.py@@ -198,7 +198,7 @@ class AIMessage(BaseMessage):Args:content: The content of the message.content_blocks: Typed standard content.- kwargs: Additional arguments to pass to the parent class.+ **kwargs: Additional arguments to pass to the parent class."""if content_blocks is not None:# If there are tool calls in content_blocks, but not in tool_calls, add themdiff --git a/libs/core/langchain_core/messages/base.py b/libs/core/langchain_core/messages/base.pyindex 8d45f89a88..69b3d02ce3 100644--- a/libs/core/langchain_core/messages/base.py+++ b/libs/core/langchain_core/messages/base.py@@ -166,7 +166,7 @@ class BaseMessage(Serializable):Args:content: The string contents of the message.content_blocks: Typed standard content.- kwargs: Additional arguments to pass to the parent class.+ **kwargs: Additional arguments to pass to the parent class."""if content_blocks is not None:super().__init__(content=content_blocks, **kwargs)diff --git a/libs/core/langchain_core/messages/modifier.py b/libs/core/langchain_core/messages/modifier.pyindex 94ce8356fb..364af242ea 100644--- a/libs/core/langchain_core/messages/modifier.py+++ b/libs/core/langchain_core/messages/modifier.py@@ -20,7 +20,7 @@ class RemoveMessage(BaseMessage):Args:id: The ID of the message to remove.- kwargs: Additional fields to pass to the message.+ **kwargs: Additional fields to pass to the message.Raises:ValueError: If the 'content' field is passed in kwargs.diff --git a/libs/core/langchain_core/output_parsers/transform.py b/libs/core/langchain_core/output_parsers/transform.pyindex 877f4d97f3..b3cf0ea1d7 100644--- a/libs/core/langchain_core/output_parsers/transform.py+++ b/libs/core/langchain_core/output_parsers/transform.py@@ -64,7 +64,7 @@ class BaseTransformOutputParser(BaseOutputParser[T]):Args:input: The input to transform.config: The configuration to use for the transformation.- kwargs: Additional keyword arguments.+ **kwargs: Additional keyword arguments.Yields:The transformed output.@@ -85,7 +85,7 @@ class BaseTransformOutputParser(BaseOutputParser[T]):Args:input: The input to transform.config: The configuration to use for the transformation.- kwargs: Additional keyword arguments.+ **kwargs: Additional keyword arguments.Yields:The transformed output.diff --git a/libs/core/langchain_core/output_parsers/xml.py b/libs/core/langchain_core/output_parsers/xml.pyindex 3e0f17791a..718145ebb5 100644--- a/libs/core/langchain_core/output_parsers/xml.py+++ b/libs/core/langchain_core/output_parsers/xml.py@@ -82,7 +82,7 @@ class _StreamingParser:chunk: A chunk of text to parse. This can be a string or a BaseMessage.Yields:- AddableDict: A dictionary representing the parsed XML element.+ A dictionary representing the parsed XML element.Raises:xml.etree.ElementTree.ParseError: If the XML is not well-formed.diff --git a/libs/core/langchain_core/prompts/base.py b/libs/core/langchain_core/prompts/base.pyindex b3e656f3b6..37663a83a8 100644--- a/libs/core/langchain_core/prompts/base.py+++ b/libs/core/langchain_core/prompts/base.py@@ -127,10 +127,10 @@ class BasePromptTemplate("""Get the input schema for the prompt.Args:- config: RunnableConfig, configuration for the prompt.+ config: configuration for the prompt.Returns:- Type[BaseModel]: The input schema for the prompt.+ The input schema for the prompt."""# This is correct, but pydantic typings/mypy don't think so.required_input_variables = {@@ -199,7 +199,7 @@ class BasePromptTemplate(config: RunnableConfig, configuration for the prompt.Returns:- PromptValue: The output of the prompt.+ The output of the prompt."""config = ensure_config(config)if self.metadata:@@ -225,7 +225,7 @@ class BasePromptTemplate(config: RunnableConfig, configuration for the prompt.Returns:- PromptValue: The output of the prompt.+ The output of the prompt."""config = ensure_config(config)if self.metadata:@@ -245,20 +245,20 @@ class BasePromptTemplate("""Create Prompt Value.Args:- kwargs: Any arguments to be passed to the prompt template.+ **kwargs: Any arguments to be passed to the prompt template.Returns:- PromptValue: The output of the prompt.+ The output of the prompt."""async def aformat_prompt(self, **kwargs: Any) -> PromptValue:"""Async create Prompt Value.Args:- kwargs: Any arguments to be passed to the prompt template.+ **kwargs: Any arguments to be passed to the prompt template.Returns:- PromptValue: The output of the prompt.+ The output of the prompt."""return self.format_prompt(**kwargs)@@ -266,10 +266,10 @@ class BasePromptTemplate("""Return a partial of the prompt template.Args:- kwargs: Union[str, Callable[[], str]], partial variables to set.+ **kwargs: partial variables to set.Returns:- BasePromptTemplate: A partial of the prompt template.+ A partial of the prompt template."""prompt_dict = self.__dict__.copy()prompt_dict["input_variables"] = list(@@ -290,7 +290,7 @@ class BasePromptTemplate("""Format the prompt with the inputs.Args:- kwargs: Any arguments to be passed to the prompt template.+ **kwargs: Any arguments to be passed to the prompt template.Returns:A formatted string.@@ -307,7 +307,7 @@ class BasePromptTemplate("""Async format the prompt with the inputs.Args:- kwargs: Any arguments to be passed to the prompt template.+ **kwargs: Any arguments to be passed to the prompt template.Returns:A formatted string.@@ -330,10 +330,10 @@ class BasePromptTemplate("""Return dictionary representation of prompt.Args:- kwargs: Any additional arguments to pass to the dictionary.+ **kwargs: Any additional arguments to pass to the dictionary.Returns:- Dict: Dictionary representation of the prompt.+ Dictionary representation of the prompt."""prompt_dict = super().model_dump(**kwargs)with contextlib.suppress(NotImplementedError):diff --git a/libs/core/langchain_core/prompts/few_shot_with_templates.py b/libs/core/langchain_core/prompts/few_shot_with_templates.pyindex 73d4fc8903..3ca6d9f426 100644--- a/libs/core/langchain_core/prompts/few_shot_with_templates.py+++ b/libs/core/langchain_core/prompts/few_shot_with_templates.py@@ -116,7 +116,7 @@ class FewShotPromptWithTemplates(StringPromptTemplate):"""Format the prompt with the inputs.Args:- kwargs: Any arguments to be passed to the prompt template.+ **kwargs: Any arguments to be passed to the prompt template.Returns:A formatted string.@@ -165,7 +165,7 @@ class FewShotPromptWithTemplates(StringPromptTemplate):"""Async format the prompt with the inputs.Args:- kwargs: Any arguments to be passed to the prompt template.+ **kwargs: Any arguments to be passed to the prompt template.Returns:A formatted string.diff --git a/libs/core/langchain_core/prompts/image.py b/libs/core/langchain_core/prompts/image.pyindex 95776dbba0..ab237e39c9 100644--- a/libs/core/langchain_core/prompts/image.py+++ b/libs/core/langchain_core/prompts/image.py@@ -60,7 +60,7 @@ class ImagePromptTemplate(BasePromptTemplate[ImageURL]):"""Format the prompt with the inputs.Args:- kwargs: Any arguments to be passed to the prompt template.+ **kwargs: Any arguments to be passed to the prompt template.Returns:A formatted string.@@ -71,7 +71,7 @@ class ImagePromptTemplate(BasePromptTemplate[ImageURL]):"""Async format the prompt with the inputs.Args:- kwargs: Any arguments to be passed to the prompt template.+ **kwargs: Any arguments to be passed to the prompt template.Returns:A formatted string.@@ -85,7 +85,7 @@ class ImagePromptTemplate(BasePromptTemplate[ImageURL]):"""Format the prompt with the inputs.Args:- kwargs: Any arguments to be passed to the prompt template.+ **kwargs: Any arguments to be passed to the prompt template.Returns:A formatted string.@@ -134,7 +134,7 @@ class ImagePromptTemplate(BasePromptTemplate[ImageURL]):"""Async format the prompt with the inputs.Args:- kwargs: Any arguments to be passed to the prompt template.+ **kwargs: Any arguments to be passed to the prompt template.Returns:A formatted string.diff --git a/libs/core/langchain_core/prompts/prompt.py b/libs/core/langchain_core/prompts/prompt.pyindex 5709fc73d1..47a05e7994 100644--- a/libs/core/langchain_core/prompts/prompt.py+++ b/libs/core/langchain_core/prompts/prompt.py@@ -191,7 +191,7 @@ class PromptTemplate(StringPromptTemplate):"""Format the prompt with the inputs.Args:- kwargs: Any arguments to be passed to the prompt template.+ **kwargs: Any arguments to be passed to the prompt template.Returns:A formatted string.@@ -284,7 +284,7 @@ class PromptTemplate(StringPromptTemplate):`"{variable1} {variable2}"`, and `partial_variables` is`{"variable1": "foo"}`, then the final prompt will be`"foo {variable2}"`. Defaults to `None`.- kwargs: Any other arguments to pass to the prompt template.+ **kwargs: Any other arguments to pass to the prompt template.Returns:The prompt template loaded from the template.diff --git a/libs/core/langchain_core/prompts/string.py b/libs/core/langchain_core/prompts/string.pyindex 6841f38c2b..7e7bc115fa 100644--- a/libs/core/langchain_core/prompts/string.py+++ b/libs/core/langchain_core/prompts/string.py@@ -284,7 +284,7 @@ class StringPromptTemplate(BasePromptTemplate, ABC):"""Format the prompt with the inputs.Args:- kwargs: Any arguments to be passed to the prompt template.+ **kwargs: Any arguments to be passed to the prompt template.Returns:A formatted string.@@ -295,7 +295,7 @@ class StringPromptTemplate(BasePromptTemplate, ABC):"""Async format the prompt with the inputs.Args:- kwargs: Any arguments to be passed to the prompt template.+ **kwargs: Any arguments to be passed to the prompt template.Returns:A formatted string.diff --git a/libs/core/langchain_core/prompts/structured.py b/libs/core/langchain_core/prompts/structured.pyindex 2267902042..23c4956f08 100644--- a/libs/core/langchain_core/prompts/structured.py+++ b/libs/core/langchain_core/prompts/structured.py@@ -112,7 +112,7 @@ class StructuredPrompt(ChatPromptTemplate):(4) 2-tuple of (message class, template), (5) a string which isshorthand for ("human", template); e.g., "{user_input}"schema: a dictionary representation of function call, or a Pydantic model.- kwargs: Any additional kwargs to pass through to+ **kwargs: Any additional kwargs to pass through to``ChatModel.with_structured_output(schema, **kwargs)``.Returns:diff --git a/libs/core/langchain_core/retrievers.py b/libs/core/langchain_core/retrievers.pyindex a0ad0ba876..2c1538a146 100644--- a/libs/core/langchain_core/retrievers.py+++ b/libs/core/langchain_core/retrievers.py@@ -225,7 +225,7 @@ class BaseRetriever(RunnableSerializable[RetrieverInput, RetrieverOutput], ABC):Args:input: The query string.config: Configuration for the retriever. Defaults to `None`.- kwargs: Additional arguments to pass to the retriever.+ **kwargs: Additional arguments to pass to the retriever.Returns:List of relevant documents.@@ -288,7 +288,7 @@ class BaseRetriever(RunnableSerializable[RetrieverInput, RetrieverOutput], ABC):Args:input: The query string.config: Configuration for the retriever. Defaults to `None`.- kwargs: Additional arguments to pass to the retriever.+ **kwargs: Additional arguments to pass to the retriever.Returns:List of relevant documents.@@ -398,7 +398,7 @@ class BaseRetriever(RunnableSerializable[RetrieverInput, RetrieverOutput], ABC):and passed as arguments to the handlers defined in `callbacks`.Defaults to `None`.run_name: Optional name for the run. Defaults to `None`.- kwargs: Additional arguments to pass to the retriever.+ **kwargs: Additional arguments to pass to the retriever.Returns:List of relevant documents.@@ -442,7 +442,7 @@ class BaseRetriever(RunnableSerializable[RetrieverInput, RetrieverOutput], ABC):and passed as arguments to the handlers defined in `callbacks`.Defaults to `None`.run_name: Optional name for the run. Defaults to `None`.- kwargs: Additional arguments to pass to the retriever.+ **kwargs: Additional arguments to pass to the retriever.Returns:List of relevant documents.diff --git a/libs/core/langchain_core/runnables/base.py b/libs/core/langchain_core/runnables/base.pyindex 3666251513..7843668bb7 100644--- a/libs/core/langchain_core/runnables/base.py+++ b/libs/core/langchain_core/runnables/base.py@@ -1070,7 +1070,7 @@ class Runnable(ABC, Generic[Input, Output]):for more details. Defaults to `None`.return_exceptions: Whether to return exceptions instead of raising them.Defaults to `False`.- kwargs: Additional keyword arguments to pass to the `Runnable`.+ **kwargs: Additional keyword arguments to pass to the `Runnable`.Yields:A tuple of the index of the input and the output from the `Runnable`.@@ -1121,7 +1121,7 @@ class Runnable(ABC, Generic[Input, Output]):Args:input: The input to the `Runnable`.config: The config to use for the `Runnable`. Defaults to `None`.- kwargs: Additional keyword arguments to pass to the `Runnable`.+ **kwargs: Additional keyword arguments to pass to the `Runnable`.Yields:The output of the `Runnable`.@@ -1142,7 +1142,7 @@ class Runnable(ABC, Generic[Input, Output]):Args:input: The input to the `Runnable`.config: The config to use for the `Runnable`. Defaults to `None`.- kwargs: Additional keyword arguments to pass to the `Runnable`.+ **kwargs: Additional keyword arguments to pass to the `Runnable`.Yields:The output of the `Runnable`.@@ -1220,7 +1220,7 @@ class Runnable(ABC, Generic[Input, Output]):exclude_names: Exclude logs with these names.exclude_types: Exclude logs with these types.exclude_tags: Exclude logs with these tags.- kwargs: Additional keyword arguments to pass to the `Runnable`.+ **kwargs: Additional keyword arguments to pass to the `Runnable`.Yields:A ``RunLogPatch`` or ``RunLog`` object.@@ -1464,7 +1464,7 @@ class Runnable(ABC, Generic[Input, Output]):exclude_names: Exclude events from `Runnable` objects with matching names.exclude_types: Exclude events from `Runnable` objects with matching types.exclude_tags: Exclude events from `Runnable` objects with matching tags.- kwargs: Additional keyword arguments to pass to the `Runnable`.+ **kwargs: Additional keyword arguments to pass to the `Runnable`.These will be passed to `astream_log` as this implementationof `astream_events` is built on top of `astream_log`.@@ -1527,7 +1527,7 @@ class Runnable(ABC, Generic[Input, Output]):Args:input: An iterator of inputs to the `Runnable`.config: The config to use for the `Runnable`. Defaults to `None`.- kwargs: Additional keyword arguments to pass to the `Runnable`.+ **kwargs: Additional keyword arguments to pass to the `Runnable`.Yields:The output of the `Runnable`.@@ -1572,7 +1572,7 @@ class Runnable(ABC, Generic[Input, Output]):Args:input: An async iterator of inputs to the `Runnable`.config: The config to use for the `Runnable`. Defaults to `None`.- kwargs: Additional keyword arguments to pass to the `Runnable`.+ **kwargs: Additional keyword arguments to pass to the `Runnable`.Yields:The output of the `Runnable`.@@ -1609,7 +1609,7 @@ class Runnable(ABC, Generic[Input, Output]):in the output of the previous `Runnable` or included in the user input.Args:- kwargs: The arguments to bind to the `Runnable`.+ **kwargs: The arguments to bind to the `Runnable`.Returns:A new `Runnable` with the arguments bound.@@ -1646,7 +1646,7 @@ class Runnable(ABC, Generic[Input, Output]):Args:config: The config to bind to the `Runnable`.- kwargs: Additional keyword arguments to pass to the `Runnable`.+ **kwargs: Additional keyword arguments to pass to the `Runnable`.Returns:A new `Runnable` with the config bound.@@ -4831,7 +4831,7 @@ class RunnableLambda(Runnable[Input, Output]):Args:input: The input to this `Runnable`.config: The config to use. Defaults to `None`.- kwargs: Additional keyword arguments.+ **kwargs: Additional keyword arguments.Returns:The output of this `Runnable`.@@ -4862,7 +4862,7 @@ class RunnableLambda(Runnable[Input, Output]):Args:input: The input to this `Runnable`.config: The config to use. Defaults to `None`.- kwargs: Additional keyword arguments.+ **kwargs: Additional keyword arguments.Returns:The output of this `Runnable`.diff --git a/libs/core/langchain_core/runnables/branch.py b/libs/core/langchain_core/runnables/branch.pyindex 4b433c56b4..289f2e8917 100644--- a/libs/core/langchain_core/runnables/branch.py+++ b/libs/core/langchain_core/runnables/branch.py@@ -192,7 +192,7 @@ class RunnableBranch(RunnableSerializable[Input, Output]):Args:input: The input to the Runnable.config: The configuration for the Runnable. Defaults to `None`.- kwargs: Additional keyword arguments to pass to the Runnable.+ **kwargs: Additional keyword arguments to pass to the Runnable.Returns:The output of the branch that was run.@@ -302,7 +302,7 @@ class RunnableBranch(RunnableSerializable[Input, Output]):Args:input: The input to the Runnable.config: The configuration for the Runnable. Defaults to `None`.- kwargs: Additional keyword arguments to pass to the Runnable.+ **kwargs: Additional keyword arguments to pass to the Runnable.Yields:The output of the branch that was run.@@ -386,7 +386,7 @@ class RunnableBranch(RunnableSerializable[Input, Output]):Args:input: The input to the Runnable.config: The configuration for the Runnable. Defaults to `None`.- kwargs: Additional keyword arguments to pass to the Runnable.+ **kwargs: Additional keyword arguments to pass to the Runnable.Yields:The output of the branch that was run.diff --git a/libs/core/langchain_core/runnables/config.py b/libs/core/langchain_core/runnables/config.pyindex 646c68da70..33f062607e 100644--- a/libs/core/langchain_core/runnables/config.py+++ b/libs/core/langchain_core/runnables/config.py@@ -131,7 +131,7 @@ def _set_config_context("""Set the child Runnable config + tracing context.Args:- config (RunnableConfig): The config to set.+ config: The config to set.Returns:The token to reset the config and the previous tracing context.@@ -165,7 +165,7 @@ def set_config_context(config: RunnableConfig) -> Generator[Context, None, None]"""Set the child Runnable config + tracing context.Args:- config (RunnableConfig): The config to set.+ config: The config to set.Yields:The config context.@@ -196,7 +196,7 @@ def ensure_config(config: RunnableConfig | None = None) -> RunnableConfig:config: The config to ensure. Defaults to `None`.Returns:- RunnableConfig: The ensured config.+ The ensured config."""empty = RunnableConfig(tags=[],@@ -254,7 +254,7 @@ def get_config_list(length: The length of the list.Returns:- list[RunnableConfig]: The list of configs.+ The list of configs.Raises:ValueError: If the length of the list is not equal to the length of the inputs.@@ -308,7 +308,7 @@ def patch_config(configurable: The configurable to set.Returns:- RunnableConfig: The patched config.+ The patched config."""config = ensure_config(config)if callbacks is not None:@@ -337,7 +337,7 @@ def merge_configs(*configs: RunnableConfig | None) -> RunnableConfig:*configs: The configs to merge.Returns:- RunnableConfig: The merged config.+ The merged config."""base: RunnableConfig = {}# Even though the keys aren't literals, this is correct@@ -466,10 +466,10 @@ def get_callback_manager_for_config(config: RunnableConfig) -> CallbackManager:"""Get a callback manager for a config.Args:- config (RunnableConfig): The config.+ config: The config.Returns:- CallbackManager: The callback manager.+ The callback manager."""return CallbackManager.configure(inheritable_callbacks=config.get("callbacks"),@@ -484,10 +484,10 @@ def get_async_callback_manager_for_config("""Get an async callback manager for a config.Args:- config (RunnableConfig): The config.+ config: The config.Returns:- AsyncCallbackManager: The async callback manager.+ The async callback manager."""return AsyncCallbackManager.configure(inheritable_callbacks=config.get("callbacks"),@@ -512,12 +512,12 @@ class ContextThreadPoolExecutor(ThreadPoolExecutor):"""Submit a function to the executor.Args:- func (Callable[..., T]): The function to submit.- *args (Any): The positional arguments to the function.- **kwargs (Any): The keyword arguments to the function.+ func: The function to submit.+ *args: The positional arguments to the function.+ **kwargs: The keyword arguments to the function.Returns:- Future[T]: The future for the function.+ The future for the function."""return super().submit(cast("Callable[..., T]", partial(copy_context().run, func, *args, **kwargs))@@ -533,14 +533,13 @@ class ContextThreadPoolExecutor(ThreadPoolExecutor):"""Map a function to multiple iterables.Args:- fn (Callable[..., T]): The function to map.- *iterables (Iterable[Any]): The iterables to map over.- timeout (float | None, optional): The timeout for the map.- Defaults to `None`.- chunksize (int, optional): The chunksize for the map. Defaults to 1.+ fn: The function to map.+ *iterables: The iterables to map over.+ timeout: The timeout for the map. Defaults to `None`.+ chunksize: The chunksize for the map. Defaults to 1.Returns:- Iterator[T]: The iterator for the mapped function.+ The iterator for the mapped function."""contexts = [copy_context() for _ in range(len(iterables[0]))] # type: ignore[arg-type]@@ -562,10 +561,10 @@ def get_executor_for_config("""Get an executor for a config.Args:- config (RunnableConfig): The config.+ config: The config.Yields:- Generator[Executor, None, None]: The executor.+ The executor."""config = config or {}with ContextThreadPoolExecutor(@@ -584,12 +583,12 @@ async def run_in_executor(Args:executor_or_config: The executor or config to run in.- func (Callable[P, Output]): The function.- *args (Any): The positional arguments to the function.- **kwargs (Any): The keyword arguments to the function.+ func: The function.+ *args: The positional arguments to the function.+ **kwargs: The keyword arguments to the function.Returns:- Output: The output of the function.+ The output of the function."""def wrapper() -> T:diff --git a/libs/core/langchain_core/runnables/configurable.py b/libs/core/langchain_core/runnables/configurable.pyindex 8983c71d0e..73d4cbdc16 100644--- a/libs/core/langchain_core/runnables/configurable.py+++ b/libs/core/langchain_core/runnables/configurable.py@@ -126,8 +126,7 @@ class DynamicRunnable(RunnableSerializable[Input, Output]):config: The configuration to use. Defaults to `None`.Returns:- tuple[Runnable[Input, Output], RunnableConfig]: The prepared Runnable and- configuration.+ The prepared Runnable and configuration."""runnable: Runnable[Input, Output] = selfwhile isinstance(runnable, DynamicRunnable):@@ -384,7 +383,7 @@ class RunnableConfigurableFields(DynamicRunnable[Input, Output]):"""Get the configuration specs for the RunnableConfigurableFields.Returns:- list[ConfigurableFieldSpec]: The configuration specs.+ The configuration specs."""config_specs = []@@ -656,7 +655,7 @@ def prefix_config_spec(prefix: The prefix to add.Returns:- ConfigurableFieldSpec: The prefixed ConfigurableFieldSpec.+ The prefixed ConfigurableFieldSpec."""return (ConfigurableFieldSpec(diff --git a/libs/core/langchain_core/runnables/graph.py b/libs/core/langchain_core/runnables/graph.pyindex 9088fd0243..589b797fd2 100644--- a/libs/core/langchain_core/runnables/graph.py+++ b/libs/core/langchain_core/runnables/graph.py@@ -590,7 +590,7 @@ class Graph:node_colors: The colors of the nodes. Defaults to NodeStyles().wrap_label_n_words: The number of words to wrap the node labels at.Defaults to 9.- frontmatter_config (dict[str, Any], optional): Mermaid frontmatter config.+ frontmatter_config: Mermaid frontmatter config.Can be used to customize theme and styles. Will be converted to YAML andadded to the beginning of the mermaid graph. Defaults to `None`.@@ -661,7 +661,7 @@ class Graph:Defaults to 1.retry_delay: The delay between retries (MermaidDrawMethod.API).Defaults to 1.0.- frontmatter_config (dict[str, Any], optional): Mermaid frontmatter config.+ frontmatter_config: Mermaid frontmatter config.Can be used to customize theme and styles. Will be converted to YAML andadded to the beginning of the mermaid graph. Defaults to `None`.diff --git a/libs/core/langchain_core/runnables/graph_ascii.py b/libs/core/langchain_core/runnables/graph_ascii.pyindex 683ec3060e..d2abbbeb37 100644--- a/libs/core/langchain_core/runnables/graph_ascii.py+++ b/libs/core/langchain_core/runnables/graph_ascii.py@@ -117,11 +117,11 @@ class AsciiCanvas:"""Create a line on ASCII canvas.Args:- x0 (int): x coordinate where the line should start.- y0 (int): y coordinate where the line should start.- x1 (int): x coordinate where the line should end.- y1 (int): y coordinate where the line should end.- char (str): character to draw the line with.+ x0: x coordinate where the line should start.+ y0: y coordinate where the line should start.+ x1: x coordinate where the line should end.+ y1: y coordinate where the line should end.+ char: character to draw the line with."""if x0 > x1:x1, x0 = x0, x1@@ -149,9 +149,9 @@ class AsciiCanvas:"""Print a text on ASCII canvas.Args:- x (int): x coordinate where the text should start.- y (int): y coordinate where the text should start.- text (str): string that should be printed.+ x: x coordinate where the text should start.+ y: y coordinate where the text should start.+ text: string that should be printed."""for i, char in enumerate(text):self.point(x + i, y, char)@@ -160,10 +160,10 @@ class AsciiCanvas:"""Create a box on ASCII canvas.Args:- x0 (int): x coordinate of the box corner.- y0 (int): y coordinate of the box corner.- width (int): box width.- height (int): box height.+ x0: x coordinate of the box corner.+ y0: y coordinate of the box corner.+ width: box width.+ height: box height."""if width <= 1 or height <= 1:msg = "Box dimensions should be > 1"diff --git a/libs/core/langchain_core/runnables/graph_mermaid.py b/libs/core/langchain_core/runnables/graph_mermaid.pyindex 07d508e542..d6c6d2c7d4 100644--- a/libs/core/langchain_core/runnables/graph_mermaid.py+++ b/libs/core/langchain_core/runnables/graph_mermaid.py@@ -56,20 +56,15 @@ def draw_mermaid("""Draws a Mermaid graph using the provided graph data.Args:- nodes (dict[str, str]): List of node ids.- edges (list[Edge]): List of edges, object with a source,- target and data.- first_node (str, optional): Id of the first node. Defaults to `None`.- last_node (str, optional): Id of the last node. Defaults to `None`.- with_styles (bool, optional): Whether to include styles in the graph.- Defaults to `True`.- curve_style (CurveStyle, optional): Curve style for the edges.- Defaults to CurveStyle.LINEAR.- node_styles (NodeStyles, optional): Node colors for different types.- Defaults to NodeStyles().- wrap_label_n_words (int, optional): Words to wrap the edge labels.- Defaults to 9.- frontmatter_config (dict[str, Any], optional): Mermaid frontmatter config.+ nodes: List of node ids.+ edges: List of edges, object with a source, target and data.+ first_node: Id of the first node. Defaults to `None`.+ last_node: Id of the last node. Defaults to `None`.+ with_styles: Whether to include styles in the graph. Defaults to `True`.+ curve_style: Curve style for the edges. Defaults to CurveStyle.LINEAR.+ node_styles: Node colors for different types. Defaults to NodeStyles().+ wrap_label_n_words: Words to wrap the edge labels. Defaults to 9.+ frontmatter_config: Mermaid frontmatter config.Can be used to customize theme and styles. Will be converted to YAML andadded to the beginning of the mermaid graph. Defaults to `None`.@@ -87,7 +82,7 @@ def draw_mermaid(}```Returns:- str: Mermaid graph syntax.+ Mermaid graph syntax."""# Initialize Mermaid graph configuration@@ -290,23 +285,17 @@ def draw_mermaid_png("""Draws a Mermaid graph as PNG using provided syntax.Args:- mermaid_syntax (str): Mermaid graph syntax.- output_file_path (str, optional): Path to save the PNG image.- Defaults to `None`.- draw_method (MermaidDrawMethod, optional): Method to draw the graph.- Defaults to MermaidDrawMethod.API.- background_color (str, optional): Background color of the image.- Defaults to "white".- padding (int, optional): Padding around the image. Defaults to 10.- max_retries (int, optional): Maximum number of retries (MermaidDrawMethod.API).- Defaults to 1.- retry_delay (float, optional): Delay between retries (MermaidDrawMethod.API).- Defaults to 1.0.- base_url (str, optional): Base URL for the Mermaid.ink API.- Defaults to `None`.+ mermaid_syntax: Mermaid graph syntax.+ output_file_path: Path to save the PNG image. Defaults to `None`.+ draw_method: Method to draw the graph. Defaults to MermaidDrawMethod.API.+ background_color: Background color of the image. Defaults to "white".+ padding: Padding around the image. Defaults to 10.+ max_retries: Maximum number of retries (MermaidDrawMethod.API). Defaults to 1.+ retry_delay: Delay between retries (MermaidDrawMethod.API). Defaults to 1.0.+ base_url: Base URL for the Mermaid.ink API. Defaults to `None`.Returns:- bytes: PNG image bytes.+ PNG image bytes.Raises:ValueError: If an invalid draw method is provided.diff --git a/libs/core/langchain_core/runnables/passthrough.py b/libs/core/langchain_core/runnables/passthrough.pyindex d5320a2f7c..e54ac53a32 100644--- a/libs/core/langchain_core/runnables/passthrough.py+++ b/libs/core/langchain_core/runnables/passthrough.py@@ -51,10 +51,10 @@ def identity(x: Other) -> Other:"""Identity function.Args:- x (Other): input.+ x: input.Returns:- Other: output.+ output."""return x@@ -63,10 +63,10 @@ async def aidentity(x: Other) -> Other:"""Async identity function.Args:- x (Other): input.+ x: input.Returns:- Other: output.+ output."""return xdiff --git a/libs/core/langchain_core/runnables/utils.py b/libs/core/langchain_core/runnables/utils.pyindex 9386db7190..f961ffb7e6 100644--- a/libs/core/langchain_core/runnables/utils.py+++ b/libs/core/langchain_core/runnables/utils.py@@ -80,7 +80,7 @@ def accepts_run_manager(callable: Callable[..., Any]) -> bool: # noqa: A002callable: The callable to check.Returns:- bool: True if the callable accepts a run_manager argument, False otherwise.+ True if the callable accepts a run_manager argument, False otherwise."""try:return signature(callable).parameters.get("run_manager") is not None@@ -95,7 +95,7 @@ def accepts_config(callable: Callable[..., Any]) -> bool: # noqa: A002callable: The callable to check.Returns:- bool: True if the callable accepts a config argument, False otherwise.+ True if the callable accepts a config argument, False otherwise."""try:return signature(callable).parameters.get("config") is not None@@ -110,7 +110,7 @@ def accepts_context(callable: Callable[..., Any]) -> bool: # noqa: A002callable: The callable to check.Returns:- bool: True if the callable accepts a context argument, False otherwise.+ True if the callable accepts a context argument, False otherwise."""try:return signature(callable).parameters.get("context") is not None@@ -123,8 +123,7 @@ def asyncio_accepts_context() -> bool:"""Cache the result of checking if asyncio.create_task accepts a ``context`` arg.Returns:- bool: True if ``asyncio.create_task`` accepts a context argument, False- otherwise.+ True if ``asyncio.create_task`` accepts a context argument, False otherwise."""return accepts_context(asyncio.create_task)@@ -363,8 +362,7 @@ def get_function_first_arg_dict_keys(func: Callable) -> list[str] | None:func: The function to check.Returns:- list[str] | None: The keys of the first argument if it is a dict,- None otherwise.+ The keys of the first argument if it is a dict, None otherwise."""try:code = inspect.getsource(func)@@ -383,7 +381,7 @@ def get_lambda_source(func: Callable) -> str | None:func: a Callable that can be a lambda function.Returns:- str: the source code of the lambda function.+ the source code of the lambda function."""try:name = func.__name__ if func.__name__ != "<lambda>" else None@@ -407,7 +405,7 @@ def get_function_nonlocals(func: Callable) -> list[Any]:func: The function to check.Returns:- list[Any]: The nonlocal variables accessed by the function.+ The nonlocal variables accessed by the function."""try:code = inspect.getsource(func)@@ -450,7 +448,7 @@ def indent_lines_after_first(text: str, prefix: str) -> str:prefix: Used to determine the number of spaces to indent.Returns:- str: The indented text.+ The indented text."""n_spaces = len(prefix)spaces = " " * n_spaces@@ -642,7 +640,7 @@ def get_unique_config_specs(specs: The config specs.Returns:- list[ConfigurableFieldSpec]: The unique config specs.+ The unique config specs.Raises:ValueError: If the runnable sequence contains conflicting config specs.@@ -729,8 +727,7 @@ def is_async_generator(func: The function to check.Returns:- TypeGuard[Callable[..., AsyncIterator]: True if the function is- an async generator, False otherwise.+ True if the function is an async generator, False otherwise."""return inspect.isasyncgenfunction(func) or (hasattr(func, "__call__") # noqa: B004@@ -747,8 +744,7 @@ def is_async_callable(func: The function to check.Returns:- TypeGuard[Callable[..., Awaitable]: True if the function is async,- False otherwise.+ True if the function is async, False otherwise."""return asyncio.iscoroutinefunction(func) or (hasattr(func, "__call__") # noqa: B004diff --git a/libs/core/langchain_core/stores.py b/libs/core/langchain_core/stores.pyindex a1ee2b8afd..745c34bc33 100644--- a/libs/core/langchain_core/stores.py+++ b/libs/core/langchain_core/stores.py@@ -84,7 +84,7 @@ class BaseStore(ABC, Generic[K, V]):"""Get the values associated with the given keys.Args:- keys (Sequence[K]): A sequence of keys.+ keys: A sequence of keys.Returns:A sequence of optional values associated with the keys.@@ -95,7 +95,7 @@ class BaseStore(ABC, Generic[K, V]):"""Async get the values associated with the given keys.Args:- keys (Sequence[K]): A sequence of keys.+ keys: A sequence of keys.Returns:A sequence of optional values associated with the keys.@@ -108,14 +108,14 @@ class BaseStore(ABC, Generic[K, V]):"""Set the values for the given keys.Args:- key_value_pairs (Sequence[tuple[K, V]]): A sequence of key-value pairs.+ key_value_pairs: A sequence of key-value pairs."""async def amset(self, key_value_pairs: Sequence[tuple[K, V]]) -> None:"""Async set the values for the given keys.Args:- key_value_pairs (Sequence[tuple[K, V]]): A sequence of key-value pairs.+ key_value_pairs: A sequence of key-value pairs."""return await run_in_executor(None, self.mset, key_value_pairs)@@ -124,14 +124,14 @@ class BaseStore(ABC, Generic[K, V]):"""Delete the given keys and their associated values.Args:- keys (Sequence[K]): A sequence of keys to delete.+ keys: A sequence of keys to delete."""async def amdelete(self, keys: Sequence[K]) -> None:"""Async delete the given keys and their associated values.Args:- keys (Sequence[K]): A sequence of keys to delete.+ keys: A sequence of keys to delete."""return await run_in_executor(None, self.mdelete, keys)@@ -140,10 +140,10 @@ class BaseStore(ABC, Generic[K, V]):"""Get an iterator over keys that match the given prefix.Args:- prefix (str): The prefix to match.+ prefix: The prefix to match.Yields:- Iterator[K | str]: An iterator over keys that match the given prefix.+ An iterator over keys that match the given prefix.This method is allowed to return an iterator over either K or strdepending on what makes more sense for the given store."""@@ -154,10 +154,10 @@ class BaseStore(ABC, Generic[K, V]):"""Async get an iterator over keys that match the given prefix.Args:- prefix (str): The prefix to match.+ prefix: The prefix to match.Yields:- Iterator[K | str]: An iterator over keys that match the given prefix.+ The keys that match the given prefix.This method is allowed to return an iterator over either K or strdepending on what makes more sense for the given store."""@@ -180,28 +180,12 @@ class InMemoryBaseStore(BaseStore[str, V], Generic[V]):"""Initialize an empty store."""self.store: dict[str, V] = {}+ @overridedef mget(self, keys: Sequence[str]) -> list[V | None]:- """Get the values associated with the given keys.-- Args:- keys (Sequence[str]): A sequence of keys.-- Returns:- A sequence of optional values associated with the keys.- If a key is not found, the corresponding value will be None.- """return [self.store.get(key) for key in keys]+ @overrideasync def amget(self, keys: Sequence[str]) -> list[V | None]:- """Async get the values associated with the given keys.-- Args:- keys (Sequence[str]): A sequence of keys.-- Returns:- A sequence of optional values associated with the keys.- If a key is not found, the corresponding value will be None.- """return self.mget(keys)@override@@ -213,32 +197,24 @@ class InMemoryBaseStore(BaseStore[str, V], Generic[V]):async def amset(self, key_value_pairs: Sequence[tuple[str, V]]) -> None:return self.mset(key_value_pairs)+ @overridedef mdelete(self, keys: Sequence[str]) -> None:- """Delete the given keys and their associated values.-- Args:- keys (Sequence[str]): A sequence of keys to delete.- """for key in keys:if key in self.store:del self.store[key]+ @overrideasync def amdelete(self, keys: Sequence[str]) -> None:- """Async delete the given keys and their associated values.-- Args:- keys (Sequence[str]): A sequence of keys to delete.- """self.mdelete(keys)def yield_keys(self, prefix: str | None = None) -> Iterator[str]:"""Get an iterator over keys that match the given prefix.Args:- prefix (str, optional): The prefix to match. Defaults to `None`.+ prefix: The prefix to match. Defaults to `None`.Yields:- Iterator[str]: An iterator over keys that match the given prefix.+ The keys that match the given prefix."""if prefix is None:yield from self.store.keys()@@ -251,10 +227,10 @@ class InMemoryBaseStore(BaseStore[str, V], Generic[V]):"""Async get an async iterator over keys that match the given prefix.Args:- prefix (str, optional): The prefix to match. Defaults to `None`.+ prefix: The prefix to match. Defaults to `None`.Yields:- AsyncIterator[str]: An async iterator over keys that match the given prefix.+ The keys that match the given prefix."""if prefix is None:for key in self.store:diff --git a/libs/core/langchain_core/tools/base.py b/libs/core/langchain_core/tools/base.pyindex 6825f816e1..c040b644e1 100644--- a/libs/core/langchain_core/tools/base.py+++ b/libs/core/langchain_core/tools/base.py@@ -777,7 +777,7 @@ class ChildTool(BaseTool):run_id: The id of the run. Defaults to `None`.config: The configuration for the tool. Defaults to `None`.tool_call_id: The id of the tool call. Defaults to `None`.- kwargs: Keyword arguments to be passed to tool callbacks (event handler)+ **kwargs: Keyword arguments to be passed to tool callbacks (event handler)Returns:The output of the tool.@@ -889,7 +889,7 @@ class ChildTool(BaseTool):run_id: The id of the run. Defaults to `None`.config: The configuration for the tool. Defaults to `None`.tool_call_id: The id of the tool call. Defaults to `None`.- kwargs: Keyword arguments to be passed to tool callbacks+ **kwargs: Keyword arguments to be passed to tool callbacksReturns:The output of the tool.diff --git a/libs/core/langchain_core/tools/simple.py b/libs/core/langchain_core/tools/simple.pyindex 658ab5f425..249fc41fef 100644--- a/libs/core/langchain_core/tools/simple.py+++ b/libs/core/langchain_core/tools/simple.py@@ -180,7 +180,7 @@ class Tool(BaseTool):return_direct: Whether to return the output directly. Defaults to `False`.args_schema: The schema of the tool's input arguments. Defaults to `None`.coroutine: The asynchronous version of the function. Defaults to `None`.- kwargs: Additional arguments to pass to the tool.+ **kwargs: Additional arguments to pass to the tool.Returns:The tool.diff --git a/libs/core/langchain_core/tools/structured.py b/libs/core/langchain_core/tools/structured.pyindex ac9a46b30e..37d01b7041 100644--- a/libs/core/langchain_core/tools/structured.py+++ b/libs/core/langchain_core/tools/structured.py@@ -164,7 +164,7 @@ class StructuredTool(BaseTool):error_on_invalid_docstring: if ``parse_docstring`` is provided, configurewhether to raise ValueError on invalid Google Style docstrings.Defaults to `False`.- kwargs: Additional arguments to pass to the tool+ **kwargs: Additional arguments to pass to the toolReturns:The tool.diff --git a/libs/core/langchain_core/tracers/base.py b/libs/core/langchain_core/tracers/base.pyindex 80e112b7d9..1ff9c9ed0c 100644--- a/libs/core/langchain_core/tracers/base.py+++ b/libs/core/langchain_core/tracers/base.py@@ -71,7 +71,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):parent_run_id: The parent run ID. Defaults to `None`.metadata: The metadata for the run. Defaults to `None`.name: The name of the run.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -112,7 +112,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):parent_run_id: The parent run ID. Defaults to `None`.metadata: The metadata for the run. Defaults to `None`.name: The name of the run.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -148,7 +148,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):chunk: The chunk. Defaults to `None`.run_id: The run ID.parent_run_id: The parent run ID. Defaults to `None`.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -177,7 +177,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):Args:retry_state: The retry state.run_id: The run ID.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -194,7 +194,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):Args:response: The response.run_id: The run ID.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -221,7 +221,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):Args:error: The error.run_id: The run ID.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -260,7 +260,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):metadata: The metadata for the run. Defaults to `None`.run_type: The type of the run. Defaults to `None`.name: The name of the run.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -295,7 +295,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):outputs: The outputs for the chain.run_id: The run ID.inputs: The inputs for the chain. Defaults to `None`.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -324,7 +324,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):error: The error.inputs: The inputs for the chain. Defaults to `None`.run_id: The run ID.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -362,7 +362,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):metadata: The metadata for the run. Defaults to `None`.name: The name of the run.inputs: The inputs for the tool.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -389,7 +389,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):Args:output: The output for the tool.run_id: The run ID.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -415,7 +415,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):Args:error: The error.run_id: The run ID.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -450,7 +450,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):tags: The tags for the run. Defaults to `None`.metadata: The metadata for the run. Defaults to `None`.name: The name of the run.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -482,7 +482,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):Args:error: The error.run_id: The run ID.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.@@ -504,7 +504,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):Args:documents: The documents.run_id: The run ID.- kwargs: Additional arguments.+ **kwargs: Additional arguments.Returns:The run.diff --git a/libs/core/langchain_core/tracers/context.py b/libs/core/langchain_core/tracers/context.pyindex 8a6953593f..2dc2043a92 100644--- a/libs/core/langchain_core/tracers/context.py+++ b/libs/core/langchain_core/tracers/context.py@@ -47,17 +47,13 @@ def tracing_v2_enabled("""Instruct LangChain to log all runs in context to LangSmith.Args:- project_name (str, optional): The name of the project.- Defaults to `'default'`.- example_id (str or UUID, optional): The ID of the example.- Defaults to `None`.- tags (list[str], optional): The tags to add to the run.- Defaults to `None`.- client (LangSmithClient, optional): The client of the langsmith.- Defaults to `None`.+ project_name: The name of the project. Defaults to `'default'`.+ example_id: The ID of the example. Defaults to `None`.+ tags: The tags to add to the run. Defaults to `None`.+ client: The client of the langsmith. Defaults to `None`.Yields:- LangChainTracer: The LangChain tracer.+ The LangChain tracer.Example:>>> with tracing_v2_enabled():@@ -89,7 +85,7 @@ def collect_runs() -> Generator[RunCollectorCallbackHandler, None, None]:"""Collect all run traces in context.Yields:- run_collector.RunCollectorCallbackHandler: The run collector callback handler.+ The run collector callback handler.Example:>>> with collect_runs() as runs_cb:diff --git a/libs/core/langchain_core/tracers/event_stream.py b/libs/core/langchain_core/tracers/event_stream.pyindex 064dd8f666..05a5e1175b 100644--- a/libs/core/langchain_core/tracers/event_stream.py+++ b/libs/core/langchain_core/tracers/event_stream.py@@ -179,7 +179,7 @@ class _AstreamEventsCallbackHandler(AsyncCallbackHandler, _StreamingCallbackHandoutput: The output of the Runnable.Yields:- T: The output of the Runnable.+ The output of the Runnable."""sentinel = object()# atomic check and set@@ -229,7 +229,7 @@ class _AstreamEventsCallbackHandler(AsyncCallbackHandler, _StreamingCallbackHandoutput: The output of the Runnable.Yields:- T: The output of the Runnable.+ The output of the Runnable."""sentinel = object()# atomic check and setdiff --git a/libs/core/langchain_core/tracers/langchain.py b/libs/core/langchain_core/tracers/langchain.pyindex d37eccabf9..d1928622cb 100644--- a/libs/core/langchain_core/tracers/langchain.py+++ b/libs/core/langchain_core/tracers/langchain.py@@ -89,7 +89,7 @@ class LangChainTracer(BaseTracer):project_name: The project name. Defaults to the tracer project.client: The client. Defaults to the global client.tags: The tags. Defaults to an empty list.- kwargs: Additional keyword arguments.+ **kwargs: Additional keyword arguments."""super().__init__(**kwargs)self.example_id = (@@ -138,10 +138,10 @@ class LangChainTracer(BaseTracer):parent_run_id: The parent run ID. Defaults to `None`.metadata: The metadata. Defaults to `None`.name: The name. Defaults to `None`.- kwargs: Additional keyword arguments.+ **kwargs: Additional keyword arguments.Returns:- Run: The run.+ The run."""start_time = datetime.now(timezone.utc)if metadata:@@ -175,7 +175,7 @@ class LangChainTracer(BaseTracer):"""Get the LangSmith root run URL.Returns:- str: The LangSmith root run URL.+ The LangSmith root run URL.Raises:ValueError: If no traced run is found.diff --git a/libs/core/langchain_core/tracers/log_stream.py b/libs/core/langchain_core/tracers/log_stream.pyindex 26cedf6096..01a50553f7 100644--- a/libs/core/langchain_core/tracers/log_stream.py+++ b/libs/core/langchain_core/tracers/log_stream.py@@ -288,8 +288,7 @@ class LogStreamCallbackHandler(BaseTracer, _StreamingCallbackHandler):*ops: The operations to send to the stream.Returns:- bool: True if the patch was sent successfully, False if the stream- is closed.+ True if the patch was sent successfully, False if the stream is closed."""# We will likely want to wrap this in try / except at some point# to handle exceptions that might arise at run time.@@ -308,7 +307,7 @@ class LogStreamCallbackHandler(BaseTracer, _StreamingCallbackHandler):output: The output async iterator.Yields:- T: The output value.+ The output value."""async for chunk in output:# root run is handled in .astream_log()@@ -339,7 +338,7 @@ class LogStreamCallbackHandler(BaseTracer, _StreamingCallbackHandler):output: The output iterator.Yields:- T: The output value.+ The output value."""for chunk in output:# root run is handled in .astream_log()@@ -369,7 +368,7 @@ class LogStreamCallbackHandler(BaseTracer, _StreamingCallbackHandler):run: The Run to check.Returns:- bool: True if the run should be included, False otherwise.+ True if the run should be included, False otherwise."""if run.id == self.root_id:return Falsediff --git a/libs/core/langchain_core/tracers/memory_stream.py b/libs/core/langchain_core/tracers/memory_stream.pyindex 4a3d09a42b..a59e47821d 100644--- a/libs/core/langchain_core/tracers/memory_stream.py+++ b/libs/core/langchain_core/tracers/memory_stream.py@@ -130,7 +130,7 @@ class _MemoryStream(Generic[T]):"""Get a writer for the channel.Returns:- _SendStream: The writer for the channel.+ The writer for the channel."""return _SendStream[T](reader_loop=self._loop, queue=self._queue, done=self._done@@ -140,6 +140,6 @@ class _MemoryStream(Generic[T]):"""Get a reader for the channel.Returns:- _ReceiveStream: The reader for the channel.+ The reader for the channel."""return _ReceiveStream[T](queue=self._queue, done=self._done)diff --git a/libs/core/langchain_core/utils/aiter.py b/libs/core/langchain_core/utils/aiter.pyindex 085420efde..39bac19540 100644--- a/libs/core/langchain_core/utils/aiter.py+++ b/libs/core/langchain_core/utils/aiter.py@@ -50,7 +50,7 @@ def py_anext(Returns:The next value from the iterator, or the default value- if the iterator is exhausted.+ if the iterator is exhausted.Raises:TypeError: If the iterator is not an async iterator.diff --git a/libs/core/langchain_core/utils/env.py b/libs/core/langchain_core/utils/env.pyindex dd593dc2da..5d9abe916e 100644--- a/libs/core/langchain_core/utils/env.py+++ b/libs/core/langchain_core/utils/env.py@@ -10,10 +10,10 @@ def env_var_is_set(env_var: str) -> bool:"""Check if an environment variable is set.Args:- env_var (str): The name of the environment variable.+ env_var: The name of the environment variable.Returns:- bool: True if the environment variable is set, False otherwise.+ True if the environment variable is set, False otherwise."""return env_var in os.environ and os.environ[env_var] not in {"",@@ -67,7 +67,7 @@ def get_from_env(key: str, env_key: str, default: str | None = None) -> str:or the environment. Defaults to `None`.Returns:- str: The value of the key.+ The value of the key.Raises:ValueError: If the key is not in the dictionary and no default value isdiff --git a/libs/core/langchain_core/utils/function_calling.py b/libs/core/langchain_core/utils/function_calling.pyindex 7c1f3a93cc..979fe0c09e 100644--- a/libs/core/langchain_core/utils/function_calling.py+++ b/libs/core/langchain_core/utils/function_calling.py@@ -72,11 +72,11 @@ def _rm_titles(kv: dict, prev_key: str = "") -> dict:except when a "title" appears within a property definition under "properties".Args:- kv (dict): The input JSON schema as a dictionary.- prev_key (str): The key from the parent dictionary, used to identify context.+ kv: The input JSON schema as a dictionary.+ prev_key: The key from the parent dictionary, used to identify context.Returns:- dict: A new dictionary with appropriate "title" fields removed.+ A new dictionary with appropriate "title" fields removed."""new_kv = {}diff --git a/libs/core/langchain_core/utils/html.py b/libs/core/langchain_core/utils/html.pyindex df0687845d..880a2edc00 100644--- a/libs/core/langchain_core/utils/html.py+++ b/libs/core/langchain_core/utils/html.py@@ -43,7 +43,7 @@ def find_all_links(pattern: Regex to use for extracting links from raw HTML.Returns:- list[str]: all links+ all links"""pattern = pattern or DEFAULT_LINK_REGEXreturn list(set(re.findall(pattern, raw_html)))@@ -73,7 +73,7 @@ def extract_sub_links(exception. Otherwise, raise the exception.Returns:- list[str]: sub links.+ sub links."""base_url_to_use = base_url if base_url is not None else urlparsed_base_url = urlparse(base_url_to_use)diff --git a/libs/core/langchain_core/utils/mustache.py b/libs/core/langchain_core/utils/mustache.pyindex cfe0a3e82e..affb221d93 100644--- a/libs/core/langchain_core/utils/mustache.py+++ b/libs/core/langchain_core/utils/mustache.py@@ -46,7 +46,7 @@ def grab_literal(template: str, l_del: str) -> tuple[str, str]:l_del: The left delimiter.Returns:- tuple[str, str]: The literal and the template.+ The literal and the template."""global _CURRENT_LINE@@ -76,7 +76,7 @@ def l_sa_check(is_standalone: Whether the tag is standalone.Returns:- bool: Whether the tag could be a standalone.+ Whether the tag could be a standalone."""# If there is a newline, or the previous tag was a standaloneif literal.find("\n") != -1 or is_standalone:@@ -102,7 +102,7 @@ def r_sa_check(is_standalone: Whether the tag is standalone.Returns:- bool: Whether the tag could be a standalone.+ Whether the tag could be a standalone."""# Check right side if we might be a standaloneif is_standalone and tag_type not in {"variable", "no escape"}:@@ -124,7 +124,7 @@ def parse_tag(template: str, l_del: str, r_del: str) -> tuple[tuple[str, str], sr_del: The right delimiter.Returns:- tuple[tuple[str, str], str]: The tag and the template.+ The tag and the template.Raises:ChevronError: If the tag is unclosed.diff --git a/libs/core/langchain_core/utils/pydantic.py b/libs/core/langchain_core/utils/pydantic.pyindex da633095c1..db7bf460ff 100644--- a/libs/core/langchain_core/utils/pydantic.py+++ b/libs/core/langchain_core/utils/pydantic.py@@ -129,10 +129,10 @@ def pre_init(func: Callable) -> Any:"""Decorator to run a function before model initialization.Args:- func (Callable): The function to run before model initialization.+ func: The function to run before model initialization.Returns:- Any: The decorated function.+ The decorated function."""with warnings.catch_warnings():warnings.filterwarnings(action="ignore", category=PydanticDeprecationWarning)@@ -146,11 +146,11 @@ def pre_init(func: Callable) -> Any:"""Decorator to run a function before model initialization.Args:- cls (Type[BaseModel]): The model class.- values (dict[str, Any]): The values to initialize the model with.+ cls: The model class.+ values: The values to initialize the model with.Returns:- dict[str, Any]: The values to initialize the model with.+ The values to initialize the model with."""# Insert default valuesfields = cls.model_fields@@ -449,7 +449,7 @@ def create_model(**field_definitions: The field definitions for the model.Returns:- Type[BaseModel]: The created model.+ The created model."""kwargs = {}if "__root__" in field_definitions:@@ -525,7 +525,7 @@ def create_model_v2(root: Type for a root model (RootModel)Returns:- Type[BaseModel]: The created model.+ The created model."""field_definitions = field_definitions or {}diff --git a/libs/core/langchain_core/utils/strings.py b/libs/core/langchain_core/utils/strings.pyindex a72780024e..86f7499dcc 100644--- a/libs/core/langchain_core/utils/strings.py+++ b/libs/core/langchain_core/utils/strings.py@@ -10,7 +10,7 @@ def stringify_value(val: Any) -> str:val: The value to stringify.Returns:- str: The stringified value.+ The stringified value."""if isinstance(val, str):return val@@ -28,7 +28,7 @@ def stringify_dict(data: dict) -> str:data: The dictionary to stringify.Returns:- str: The stringified dictionary.+ The stringified dictionary."""text = ""for key, value in data.items():@@ -43,7 +43,7 @@ def comma_list(items: list[Any]) -> str:items: The list to convert.Returns:- str: The comma-separated string.+ The comma-separated string."""return ", ".join(str(item) for item in items)@@ -60,7 +60,7 @@ def sanitize_for_postgres(text: str, replacement: str = "") -> str:replacement: String to replace NUL bytes with. Defaults to empty string.Returns:- str: The sanitized text with NUL bytes removed or replaced.+ The sanitized text with NUL bytes removed or replaced.Example:>>> sanitize_for_postgres("Hello\\x00world")diff --git a/libs/core/langchain_core/utils/utils.py b/libs/core/langchain_core/utils/utils.pyindex 6d36f630ac..e7a86fcb65 100644--- a/libs/core/langchain_core/utils/utils.py+++ b/libs/core/langchain_core/utils/utils.py@@ -25,11 +25,11 @@ def xor_args(*arg_groups: tuple[str, ...]) -> Callable:"""Validate specified keyword args are mutually exclusive.Args:- *arg_groups (tuple[str, ...]): Groups of mutually exclusive keyword args.+ *arg_groups: Groups of mutually exclusive keyword args.Returns:- Callable: Decorator that validates the specified keyword args- are mutually exclusive.+ Decorator that validates the specified keyword args+ are mutually exclusive."""def decorator(func: Callable) -> Callable:@@ -60,7 +60,7 @@ def raise_for_status_with_text(response: Response) -> None:"""Raise an error with the response text.Args:- response (Response): The response to check for errors.+ response: The response to check for errors.Raises:ValueError: If the response has an error status code.@@ -79,11 +79,14 @@ def mock_now(dt_value: datetime.datetime) -> Iterator[type]:dt_value: The datetime value to use for datetime.now().Yields:- datetime.datetime: The mocked datetime class.+ The mocked datetime class.Example:- with mock_now(datetime.datetime(2011, 2, 3, 10, 11)):- assert datetime.datetime.now() == datetime.datetime(2011, 2, 3, 10, 11)++ .. code-block:: python++ with mock_now(datetime.datetime(2011, 2, 3, 10, 11)):+ assert datetime.datetime.now() == datetime.datetime(2011, 2, 3, 10, 11)"""class MockDateTime(datetime.datetime):@@ -120,14 +123,12 @@ def guard_import(Raise an exception if the module is not installed.Args:- module_name (str): The name of the module to import.- pip_name (str, optional): The name of the module to install with pip.- Defaults to `None`.- package (str, optional): The package to import the module from.- Defaults to `None`.+ module_name: The name of the module to import.+ pip_name: The name of the module to install with pip. Defaults to `None`.+ package: The package to import the module from. Defaults to `None`.Returns:- Any: The imported module.+ The imported module.Raises:ImportError: If the module is not installed.@@ -154,14 +155,11 @@ def check_package_version("""Check the version of a package.Args:- package (str): The name of the package.- lt_version (str, optional): The version must be less than this.- Defaults to `None`.- lte_version (str, optional): The version must be less than or equal to this.- Defaults to `None`.- gt_version (str, optional): The version must be greater than this.- Defaults to `None`.- gte_version (str, optional): The version must be greater than or equal to this.+ package: The name of the package.+ lt_version: The version must be less than this. Defaults to `None`.+ lte_version: The version must be less than or equal to this. Defaults to `None`.+ gt_version: The version must be greater than this. Defaults to `None`.+ gte_version: The version must be greater than or equal to this.Defaults to `None`.Raises:@@ -201,7 +199,7 @@ def get_pydantic_field_names(pydantic_cls: Any) -> set[str]:pydantic_cls: Pydantic class.Returns:- set[str]: Field names.+ Field names."""all_required_field_names = set()if is_pydantic_v1_subclass(pydantic_cls):@@ -228,7 +226,7 @@ def _build_model_kwargs(all_required_field_names: All required field names for the pydantic class.Returns:- dict[str, Any]: Extra kwargs.+ Extra kwargs.Raises:ValueError: If a field is specified in both values and extra_kwargs.@@ -276,7 +274,7 @@ def build_extra_kwargs(all_required_field_names: All required field names for the pydantic class.Returns:- dict[str, Any]: Extra kwargs.+ Extra kwargs.Raises:ValueError: If a field is specified in both values and extra_kwargs.@@ -310,10 +308,10 @@ def convert_to_secret_str(value: SecretStr | str) -> SecretStr:"""Convert a string to a SecretStr if needed.Args:- value (Union[SecretStr, str]): The value to convert.+ value: The value to convert.Returns:- SecretStr: The SecretStr value.+ The SecretStr value."""if isinstance(value, SecretStr):return valuediff --git a/libs/core/langchain_core/vectorstores/base.py b/libs/core/langchain_core/vectorstores/base.pyindex 540a0b2ea1..e275697e22 100644--- a/libs/core/langchain_core/vectorstores/base.py+++ b/libs/core/langchain_core/vectorstores/base.py@@ -127,8 +127,7 @@ class VectorStore(ABC):**kwargs: Other keyword arguments that subclasses might use.Returns:- bool | None: True if deletion is successful,- False otherwise, None if not implemented.+ True if deletion is successful, False otherwise, None if not implemented."""msg = "delete method must be implemented by subclass."raise NotImplementedError(msg)@@ -195,8 +194,7 @@ class VectorStore(ABC):**kwargs: Other keyword arguments that subclasses might use.Returns:- bool | None: True if deletion is successful,- False otherwise, None if not implemented.+ True if deletion is successful, False otherwise, None if not implemented."""return await run_in_executor(None, self.delete, ids, **kwargs)@@ -255,7 +253,7 @@ class VectorStore(ABC):Args:documents: Documents to add to the vectorstore.- kwargs: Additional keyword arguments.+ **kwargs: Additional keyword arguments.if kwargs contains ids and documents contain ids,the ids in the kwargs will receive precedence.@@ -287,7 +285,7 @@ class VectorStore(ABC):Args:documents: Documents to add to the vectorstore.- kwargs: Additional keyword arguments.+ **kwargs: Additional keyword arguments.Returns:List of IDs of the added texts.@@ -815,10 +813,10 @@ class VectorStore(ABC):Args:documents: List of Documents to add to the vectorstore.embedding: Embedding function to use.- kwargs: Additional keyword arguments.+ **kwargs: Additional keyword arguments.Returns:- VectorStore: VectorStore initialized from documents and embeddings.+ VectorStore initialized from documents and embeddings."""texts = [d.page_content for d in documents]metadatas = [d.metadata for d in documents]@@ -845,10 +843,10 @@ class VectorStore(ABC):Args:documents: List of Documents to add to the vectorstore.embedding: Embedding function to use.- kwargs: Additional keyword arguments.+ **kwargs: Additional keyword arguments.Returns:- VectorStore: VectorStore initialized from documents and embeddings.+ VectorStore initialized from documents and embeddings."""texts = [d.page_content for d in documents]metadatas = [d.metadata for d in documents]@@ -882,10 +880,10 @@ class VectorStore(ABC):metadatas: Optional list of metadatas associated with the texts.Default is None.ids: Optional list of IDs associated with the texts.- kwargs: Additional keyword arguments.+ **kwargs: Additional keyword arguments.Returns:- VectorStore: VectorStore initialized from texts and embeddings.+ VectorStore initialized from texts and embeddings."""@classmethod@@ -906,10 +904,10 @@ class VectorStore(ABC):metadatas: Optional list of metadatas associated with the texts.Default is None.ids: Optional list of IDs associated with the texts.- kwargs: Additional keyword arguments.+ **kwargs: Additional keyword arguments.Returns:- VectorStore: VectorStore initialized from texts and embeddings.+ VectorStore initialized from texts and embeddings."""if ids is not None:kwargs["ids"] = ids@@ -945,7 +943,7 @@ class VectorStore(ABC):filter: Filter by document metadataReturns:- VectorStoreRetriever: Retriever class for VectorStore.+ Retriever class for VectorStore.Examples:@@ -1011,7 +1009,7 @@ class VectorStoreRetriever(BaseRetriever):values: Values to validate.Returns:- Values: Validated values.+ Validated values.Raises:ValueError: If search_type is not one of the allowed search types.diff --git a/libs/core/langchain_core/vectorstores/in_memory.py b/libs/core/langchain_core/vectorstores/in_memory.pyindex 0ad9f928c6..751ce1610e 100644--- a/libs/core/langchain_core/vectorstores/in_memory.py+++ b/libs/core/langchain_core/vectorstores/in_memory.py@@ -524,7 +524,7 @@ class InMemoryVectorStore(VectorStore):Args:path: The path to load the vector store from.embedding: The embedding to use.- kwargs: Additional arguments to pass to the constructor.+ **kwargs: Additional arguments to pass to the constructor.Returns:A VectorStore object.diff --git a/libs/core/tests/unit_tests/test_tools.py b/libs/core/tests/unit_tests/test_tools.pyindex bf98a980ee..adc737e8fc 100644--- a/libs/core/tests/unit_tests/test_tools.py+++ b/libs/core/tests/unit_tests/test_tools.py@@ -1298,7 +1298,7 @@ def test_docstring_parsing() -> None:baz: The baz.Returns:- str: description of returned value.+ description of returned value."""return bardiff --git a/libs/core/tests/unit_tests/utils/test_function_calling.py b/libs/core/tests/unit_tests/utils/test_function_calling.pyindex 6ee128a46a..3fdfd63e08 100644--- a/libs/core/tests/unit_tests/utils/test_function_calling.py+++ b/libs/core/tests/unit_tests/utils/test_function_calling.py@@ -76,7 +76,7 @@ def function_docstring_annotations() -> Callable:"""Dummy function.Args:- arg1 (int): foo+ arg1: fooarg2: one of 'bar', 'baz'"""