Skip to content

The agent engineering platform.

style: remove `Defaults to None` (#33404)

Mason Daugherty5f9e3e33cd51
diff --git a/libs/core/langchain_core/callbacks/file.py b/libs/core/langchain_core/callbacks/file.py
index e1bfc05dcb..8dc9e663ed 100644
--- a/libs/core/langchain_core/callbacks/file.py
+++ b/libs/core/langchain_core/callbacks/file.py
@@ -47,7 +47,7 @@ class FileCallbackHandler(BaseCallbackHandler):
Args:
filename: The file path to write to.
mode: The file open mode. Defaults to `'a'` (append).
- color: Default color for text output. Defaults to `None`.
+ color: Default color for text output.
!!! note
When not used as a context manager, a deprecation warning will be issued
@@ -64,7 +64,7 @@ class FileCallbackHandler(BaseCallbackHandler):
Args:
filename: Path to the output file.
mode: File open mode (e.g., `'w'`, `'a'`, `'x'`). Defaults to `'a'`.
- color: Default text color for output. Defaults to `None`.
+ color: Default text color for output.
"""
self.filename = filename
diff --git a/libs/core/langchain_core/callbacks/manager.py b/libs/core/langchain_core/callbacks/manager.py
index 428bd7cdb2..79ca9a2a0a 100644
--- a/libs/core/langchain_core/callbacks/manager.py
+++ b/libs/core/langchain_core/callbacks/manager.py
@@ -79,13 +79,13 @@ def trace_as_chain_group(
Args:
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`.
+ callback_manager: The callback manager to use.
+ inputs: The inputs to the chain group.
+ project_name: The name of the project.
+ example_id: The ID of the example.
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`.
+ tags: The inheritable tags to apply to all runs.
+ metadata: The metadata to apply to all runs.
!!! note
Must have `LANGCHAIN_TRACING_V2` env var set to true to see the trace in
@@ -155,13 +155,13 @@ async def atrace_as_chain_group(
Args:
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`.
+ which manages tracing and other callback behavior.
+ inputs: The inputs to the chain group.
+ project_name: The name of the project.
+ example_id: The ID of the example.
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`.
+ tags: The inheritable tags to apply to all runs.
+ metadata: The metadata to apply to all runs.
Yields:
The async callback manager for the chain group.
@@ -462,11 +462,11 @@ class BaseRunManager(RunManagerMixin):
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`.
+ parent_run_id: The ID of the parent run.
+ tags: The list of tags.
+ inheritable_tags: The list of inheritable tags.
+ metadata: The metadata.
+ inheritable_metadata: The inheritable metadata.
"""
self.run_id = run_id
@@ -557,7 +557,7 @@ class ParentRunManager(RunManager):
"""Get a child callback manager.
Args:
- tag: The tag for the child callback manager. Defaults to `None`.
+ tag: The tag for the child callback manager.
Returns:
The child callback manager.
@@ -641,7 +641,7 @@ class AsyncParentRunManager(AsyncRunManager):
"""Get a child callback manager.
Args:
- tag: The tag for the child callback manager. Defaults to `None`.
+ tag: The tag for the child callback manager.
Returns:
The child callback manager.
@@ -1303,7 +1303,7 @@ class CallbackManager(BaseCallbackManager):
Args:
serialized: The serialized LLM.
prompts: The list of prompts.
- run_id: The ID of the run. Defaults to `None`.
+ run_id: The ID of the run.
**kwargs: Additional keyword arguments.
Returns:
@@ -1354,7 +1354,7 @@ class CallbackManager(BaseCallbackManager):
Args:
serialized: The serialized LLM.
messages: The list of messages.
- run_id: The ID of the run. Defaults to `None`.
+ run_id: The ID of the run.
**kwargs: Additional keyword arguments.
Returns:
@@ -1408,7 +1408,7 @@ class CallbackManager(BaseCallbackManager):
Args:
serialized: The serialized chain.
inputs: The inputs to the chain.
- run_id: The ID of the run. Defaults to `None`.
+ run_id: The ID of the run.
**kwargs: Additional keyword arguments.
Returns:
@@ -1457,8 +1457,8 @@ class CallbackManager(BaseCallbackManager):
serialized: Serialized representation of the tool.
input_str: The input to the tool as a string.
Non-string inputs are cast to strings.
- run_id: ID for the run. Defaults to `None`.
- parent_run_id: The ID of the parent run. Defaults to `None`.
+ run_id: ID for the run.
+ parent_run_id: The ID of the parent run.
inputs: The original input to the tool if provided.
Recommended for usage instead of input_str when the original
input is needed.
@@ -1512,8 +1512,8 @@ class CallbackManager(BaseCallbackManager):
Args:
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`.
+ run_id: The ID of the run.
+ parent_run_id: The ID of the parent run.
**kwargs: Additional keyword arguments.
Returns:
@@ -1562,7 +1562,7 @@ class CallbackManager(BaseCallbackManager):
Args:
name: The name of the adhoc event.
data: The data for the adhoc event.
- run_id: The ID of the run. Defaults to `None`.
+ run_id: The ID of the run.
Raises:
ValueError: If additional keyword arguments are passed.
@@ -1782,7 +1782,7 @@ class AsyncCallbackManager(BaseCallbackManager):
Args:
serialized: The serialized LLM.
prompts: The list of prompts.
- run_id: The ID of the run. Defaults to `None`.
+ run_id: The ID of the run.
**kwargs: Additional keyword arguments.
Returns:
@@ -1870,7 +1870,7 @@ class AsyncCallbackManager(BaseCallbackManager):
Args:
serialized: The serialized LLM.
messages: The list of messages.
- run_id: The ID of the run. Defaults to `None`.
+ run_id: The ID of the run.
**kwargs: Additional keyword arguments.
Returns:
@@ -1941,7 +1941,7 @@ class AsyncCallbackManager(BaseCallbackManager):
Args:
serialized: The serialized chain.
inputs: The inputs to the chain.
- run_id: The ID of the run. Defaults to `None`.
+ run_id: The ID of the run.
**kwargs: Additional keyword arguments.
Returns:
@@ -1988,8 +1988,8 @@ class AsyncCallbackManager(BaseCallbackManager):
Args:
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`.
+ run_id: The ID of the run.
+ parent_run_id: The ID of the parent run.
**kwargs: Additional keyword arguments.
Returns:
@@ -2038,7 +2038,7 @@ class AsyncCallbackManager(BaseCallbackManager):
Args:
name: The name of the adhoc event.
data: The data for the adhoc event.
- run_id: The ID of the run. Defaults to `None`.
+ run_id: The ID of the run.
Raises:
ValueError: If additional keyword arguments are passed.
@@ -2082,8 +2082,8 @@ class AsyncCallbackManager(BaseCallbackManager):
Args:
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`.
+ run_id: The ID of the run.
+ parent_run_id: The ID of the parent run.
**kwargs: Additional keyword arguments.
Returns:
diff --git a/libs/core/langchain_core/callbacks/stdout.py b/libs/core/langchain_core/callbacks/stdout.py
index c2a1cfe805..003b65a9f9 100644
--- a/libs/core/langchain_core/callbacks/stdout.py
+++ b/libs/core/langchain_core/callbacks/stdout.py
@@ -20,7 +20,7 @@ class StdOutCallbackHandler(BaseCallbackHandler):
"""Initialize callback handler.
Args:
- color: The color to use for the text. Defaults to `None`.
+ color: The color to use for the text.
"""
self.color = color
@@ -61,7 +61,7 @@ class StdOutCallbackHandler(BaseCallbackHandler):
Args:
action: The agent action.
- color: The color to use for the text. Defaults to `None`.
+ color: The color to use for the text.
**kwargs: Additional keyword arguments.
"""
print_text(action.log, color=color or self.color)
@@ -79,9 +79,9 @@ class StdOutCallbackHandler(BaseCallbackHandler):
Args:
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`.
+ color: The color to use for the text.
+ observation_prefix: The observation prefix.
+ llm_prefix: The LLM prefix.
**kwargs: Additional keyword arguments.
"""
output = str(output)
@@ -103,7 +103,7 @@ class StdOutCallbackHandler(BaseCallbackHandler):
Args:
text: The text to print.
- color: The color to use for the text. Defaults to `None`.
+ color: The color to use for the text.
end: The end character to use. Defaults to "".
**kwargs: Additional keyword arguments.
"""
@@ -117,7 +117,7 @@ class StdOutCallbackHandler(BaseCallbackHandler):
Args:
finish: The agent finish.
- color: The color to use for the text. Defaults to `None`.
+ color: The color to use for the text.
**kwargs: Additional keyword arguments.
"""
print_text(finish.log, color=color or self.color, end="\n")
diff --git a/libs/core/langchain_core/document_loaders/langsmith.py b/libs/core/langchain_core/document_loaders/langsmith.py
index ac69bef81e..ef604b95cf 100644
--- a/libs/core/langchain_core/document_loaders/langsmith.py
+++ b/libs/core/langchain_core/document_loaders/langsmith.py
@@ -60,15 +60,15 @@ class LangSmithLoader(BaseLoader):
"""Create a LangSmith loader.
Args:
- dataset_id: The ID of the dataset to filter by. Defaults to `None`.
- dataset_name: The name of the dataset to filter by. Defaults to `None`.
+ dataset_id: The ID of the dataset to filter by.
+ dataset_name: The name of the dataset to filter by.
content_key: The inputs key to set as Document page content. `'.'` characters
are interpreted as nested keys. E.g. `content_key="first.second"` will
result in
`Document(page_content=format_content(example.inputs["first"]["second"]))`
format_content: Function for converting the content extracted from the example
inputs into a string. Defaults to JSON-encoding the contents.
- example_ids: The IDs of the examples to filter by. Defaults to `None`.
+ example_ids: The IDs of the examples to filter by.
as_of: The dataset version tag OR
timestamp to retrieve the examples as of.
Response examples will only be those that were present at the time
@@ -79,7 +79,7 @@ class LangSmithLoader(BaseLoader):
inline_s3_urls: Whether to inline S3 URLs. Defaults to `True`.
offset: The offset to start from. Defaults to 0.
limit: The maximum number of examples to return.
- metadata: Metadata to filter by. Defaults to `None`.
+ metadata: Metadata to filter by.
filter: A structured filter string to apply to the examples.
client: LangSmith Client. If not provided will be initialized from below args.
client_kwargs: Keyword args to pass to LangSmith client init. Should only be
diff --git a/libs/core/langchain_core/exceptions.py b/libs/core/langchain_core/exceptions.py
index 375d2141f8..9d62c18f62 100644
--- a/libs/core/langchain_core/exceptions.py
+++ b/libs/core/langchain_core/exceptions.py
@@ -33,9 +33,9 @@ class OutputParserException(ValueError, LangChainException): # noqa: N818
Args:
error: The error that's being re-raised or an error message.
observation: String explanation of error which can be passed to a
- model to try and remediate the issue. Defaults to `None`.
+ model to try and remediate the issue.
llm_output: String model output which is error-ing.
- Defaults to `None`.
+
send_to_llm: Whether to send the observation and llm_output back to an Agent
after an OutputParserException has been raised.
This gives the underlying model driving the agent the context that the
diff --git a/libs/core/langchain_core/indexing/base.py b/libs/core/langchain_core/indexing/base.py
index a6f85dd749..aa4f991686 100644
--- a/libs/core/langchain_core/indexing/base.py
+++ b/libs/core/langchain_core/indexing/base.py
@@ -278,10 +278,10 @@ class InMemoryRecordManager(RecordManager):
Args:
keys: A list of record keys to upsert.
group_ids: A list of group IDs corresponding to the keys.
- Defaults to `None`.
+
time_at_least: Optional timestamp. Implementation can use this
to optionally verify that the timestamp IS at least this time
- in the system that stores. Defaults to `None`.
+ in the system that stores.
E.g., use to validate that the time in the postgres database
is equal to or larger than the given timestamp, if not
raise an error.
@@ -315,10 +315,10 @@ class InMemoryRecordManager(RecordManager):
Args:
keys: A list of record keys to upsert.
group_ids: A list of group IDs corresponding to the keys.
- Defaults to `None`.
+
time_at_least: Optional timestamp. Implementation can use this
to optionally verify that the timestamp IS at least this time
- in the system that stores. Defaults to `None`.
+ in the system that stores.
E.g., use to validate that the time in the postgres database
is equal to or larger than the given timestamp, if not
raise an error.
@@ -361,13 +361,13 @@ class InMemoryRecordManager(RecordManager):
Args:
before: Filter to list records updated before this time.
- Defaults to `None`.
+
after: Filter to list records updated after this time.
- Defaults to `None`.
+
group_ids: Filter to list records with specific group IDs.
- Defaults to `None`.
+
limit: optional limit on the number of records to return.
- Defaults to `None`.
+
Returns:
A list of keys for the matching records.
@@ -397,13 +397,13 @@ class InMemoryRecordManager(RecordManager):
Args:
before: Filter to list records updated before this time.
- Defaults to `None`.
+
after: Filter to list records updated after this time.
- Defaults to `None`.
+
group_ids: Filter to list records with specific group IDs.
- Defaults to `None`.
+
limit: optional limit on the number of records to return.
- Defaults to `None`.
+
Returns:
A list of keys for the matching records.
diff --git a/libs/core/langchain_core/load/load.py b/libs/core/langchain_core/load/load.py
index 7b71760cf2..6f88786b06 100644
--- a/libs/core/langchain_core/load/load.py
+++ b/libs/core/langchain_core/load/load.py
@@ -63,14 +63,14 @@ class Reviver:
Args:
secrets_map: A map of secrets to load. If a secret is not found in
the map, it will be loaded from the environment if `secrets_from_env`
- is True. Defaults to `None`.
+ is True.
valid_namespaces: A list of additional namespaces (modules)
- to allow to be deserialized. Defaults to `None`.
+ to allow to be deserialized.
secrets_from_env: Whether to load secrets from the environment.
Defaults to `True`.
additional_import_mappings: A dictionary of additional namespace mappings
You can use this to override default mappings or add new mappings.
- Defaults to `None`.
+
ignore_unserializable_fields: Whether to ignore unserializable fields.
Defaults to `False`.
"""
@@ -200,14 +200,14 @@ def loads(
text: The string to load.
secrets_map: A map of secrets to load. If a secret is not found in
the map, it will be loaded from the environment if `secrets_from_env`
- is True. Defaults to `None`.
+ is True.
valid_namespaces: A list of additional namespaces (modules)
- to allow to be deserialized. Defaults to `None`.
+ to allow to be deserialized.
secrets_from_env: Whether to load secrets from the environment.
Defaults to `True`.
additional_import_mappings: A dictionary of additional namespace mappings
You can use this to override default mappings or add new mappings.
- Defaults to `None`.
+
ignore_unserializable_fields: Whether to ignore unserializable fields.
Defaults to `False`.
@@ -245,14 +245,14 @@ def load(
obj: The object to load.
secrets_map: A map of secrets to load. If a secret is not found in
the map, it will be loaded from the environment if `secrets_from_env`
- is True. Defaults to `None`.
+ is True.
valid_namespaces: A list of additional namespaces (modules)
- to allow to be deserialized. Defaults to `None`.
+ to allow to be deserialized.
secrets_from_env: Whether to load secrets from the environment.
Defaults to `True`.
additional_import_mappings: A dictionary of additional namespace mappings
You can use this to override default mappings or add new mappings.
- Defaults to `None`.
+
ignore_unserializable_fields: Whether to ignore unserializable fields.
Defaults to `False`.
diff --git a/libs/core/langchain_core/prompts/chat.py b/libs/core/langchain_core/prompts/chat.py
index 4c5d1f7810..1bcdb4bae6 100644
--- a/libs/core/langchain_core/prompts/chat.py
+++ b/libs/core/langchain_core/prompts/chat.py
@@ -135,7 +135,7 @@ class MessagesPlaceholder(BaseMessagePromptTemplate):
n_messages: PositiveInt | None = None
"""Maximum number of messages to include. If `None`, then will include all.
- Defaults to `None`."""
+ """
def __init__(
self, variable_name: str, *, optional: bool = False, **kwargs: Any
@@ -241,7 +241,7 @@ class BaseStringMessagePromptTemplate(BaseMessagePromptTemplate, ABC):
`"{variable1} {variable2}"`, and `partial_variables` is
`{"variable1": "foo"}`, then the final prompt will be
`"foo {variable2}"`.
- Defaults to `None`.
+
**kwargs: keyword arguments to pass to the constructor.
Returns:
@@ -414,7 +414,7 @@ class _StringImageMessagePromptTemplate(BaseMessagePromptTemplate):
template_format: format of the template.
Options are: 'f-string', 'mustache', 'jinja2'. Defaults to "f-string".
partial_variables: A dictionary of variables that can be used too partially.
- Defaults to `None`.
+
**kwargs: keyword arguments to pass to the constructor.
Returns:
diff --git a/libs/core/langchain_core/prompts/loading.py b/libs/core/langchain_core/prompts/loading.py
index 0b9ec9eefa..c1a95f63d3 100644
--- a/libs/core/langchain_core/prompts/loading.py
+++ b/libs/core/langchain_core/prompts/loading.py
@@ -139,7 +139,7 @@ def load_prompt(path: str | Path, encoding: str | None = None) -> BasePromptTemp
Args:
path: Path to the prompt file.
- encoding: Encoding of the file. Defaults to `None`.
+ encoding: Encoding of the file.
Returns:
A PromptTemplate object.
diff --git a/libs/core/langchain_core/prompts/prompt.py b/libs/core/langchain_core/prompts/prompt.py
index 59fdf0882d..9f6a605b46 100644
--- a/libs/core/langchain_core/prompts/prompt.py
+++ b/libs/core/langchain_core/prompts/prompt.py
@@ -281,7 +281,7 @@ class PromptTemplate(StringPromptTemplate):
fill in the template. For example, if the template is
`"{variable1} {variable2}"`, and `partial_variables` is
`{"variable1": "foo"}`, then the final prompt will be
- `"foo {variable2}"`. Defaults to `None`.
+ `"foo {variable2}"`.
**kwargs: Any other arguments to pass to the prompt template.
Returns:
diff --git a/libs/core/langchain_core/prompts/structured.py b/libs/core/langchain_core/prompts/structured.py
index 158c90be17..e9bb54d6c7 100644
--- a/libs/core/langchain_core/prompts/structured.py
+++ b/libs/core/langchain_core/prompts/structured.py
@@ -144,7 +144,7 @@ class StructuredPrompt(ChatPromptTemplate):
Args:
others: The language model to pipe the structured prompt to.
- name: The name of the pipeline. Defaults to `None`.
+ name: The name of the pipeline.
Returns:
A RunnableSequence object.
diff --git a/libs/core/langchain_core/retrievers.py b/libs/core/langchain_core/retrievers.py
index 74b9eb5cdb..8064480a66 100644
--- a/libs/core/langchain_core/retrievers.py
+++ b/libs/core/langchain_core/retrievers.py
@@ -121,14 +121,14 @@ class BaseRetriever(RunnableSerializable[RetrieverInput, RetrieverOutput], ABC):
_new_arg_supported: bool = False
_expects_other_args: bool = False
tags: list[str] | None = None
- """Optional list of tags associated with the retriever. Defaults to `None`.
+ """Optional list of tags associated with the retriever.
These tags will be associated with each call to this retriever,
and passed as arguments to the handlers defined in `callbacks`.
You can use these to eg identify a specific instance of a retriever with its
use case.
"""
metadata: dict[str, Any] | None = None
- """Optional metadata associated with the retriever. Defaults to `None`.
+ """Optional metadata associated with the retriever.
This metadata will be associated with each call to this retriever,
and passed as arguments to the handlers defined in `callbacks`.
You can use these to eg identify a specific instance of a retriever with its
@@ -207,7 +207,7 @@ class BaseRetriever(RunnableSerializable[RetrieverInput, RetrieverOutput], ABC):
Args:
input: The query string.
- config: Configuration for the retriever. Defaults to `None`.
+ config: Configuration for the retriever.
**kwargs: Additional arguments to pass to the retriever.
Returns:
@@ -268,7 +268,7 @@ class BaseRetriever(RunnableSerializable[RetrieverInput, RetrieverOutput], ABC):
Args:
input: The query string.
- config: Configuration for the retriever. Defaults to `None`.
+ config: Configuration for the retriever.
**kwargs: Additional arguments to pass to the retriever.
Returns:
@@ -367,16 +367,16 @@ class BaseRetriever(RunnableSerializable[RetrieverInput, RetrieverOutput], ABC):
Args:
query: string to find relevant documents for.
- callbacks: Callback manager or list of callbacks. Defaults to `None`.
+ callbacks: Callback manager or list of callbacks.
tags: Optional list of tags associated with the retriever.
These tags will be associated with each call to this retriever,
and passed as arguments to the handlers defined in `callbacks`.
- Defaults to `None`.
+
metadata: Optional metadata associated with the retriever.
This metadata will be associated with each call to this retriever,
and passed as arguments to the handlers defined in `callbacks`.
- Defaults to `None`.
- run_name: Optional name for the run. Defaults to `None`.
+
+ run_name: Optional name for the run.
**kwargs: Additional arguments to pass to the retriever.
Returns:
@@ -415,12 +415,12 @@ class BaseRetriever(RunnableSerializable[RetrieverInput, RetrieverOutput], ABC):
tags: Optional list of tags associated with the retriever.
These tags will be associated with each call to this retriever,
and passed as arguments to the handlers defined in `callbacks`.
- Defaults to `None`.
+
metadata: Optional metadata associated with the retriever.
This metadata will be associated with each call to this retriever,
and passed as arguments to the handlers defined in `callbacks`.
- Defaults to `None`.
- run_name: Optional name for the run. Defaults to `None`.
+
+ run_name: Optional name for the run.
**kwargs: Additional arguments to pass to the retriever.
Returns:
diff --git a/libs/core/langchain_core/runnables/base.py b/libs/core/langchain_core/runnables/base.py
index d5ca1d48c7..1b5ca8c8f1 100644
--- a/libs/core/langchain_core/runnables/base.py
+++ b/libs/core/langchain_core/runnables/base.py
@@ -821,7 +821,7 @@ class Runnable(ABC, Generic[Input, Output]):
The config supports standard keys like `'tags'`, `'metadata'` for
tracing purposes, `'max_concurrency'` for controlling how much work to
do in parallel, and other keys. Please refer to the `RunnableConfig`
- for more details. Defaults to `None`.
+ for more details.
Returns:
The output of the `Runnable`.
@@ -841,7 +841,7 @@ class Runnable(ABC, Generic[Input, Output]):
The config supports standard keys like `'tags'`, `'metadata'` for
tracing purposes, `'max_concurrency'` for controlling how much work to
do in parallel, and other keys. Please refer to the `RunnableConfig`
- for more details. Defaults to `None`.
+ for more details.
Returns:
The output of the `Runnable`.
@@ -869,7 +869,7 @@ class Runnable(ABC, Generic[Input, Output]):
standard keys like `'tags'`, `'metadata'` for
tracing purposes, `'max_concurrency'` for controlling how much work
to do in parallel, and other keys. Please refer to the
- `RunnableConfig` for more details. Defaults to `None`.
+ `RunnableConfig` for more details.
return_exceptions: Whether to return exceptions instead of raising them.
Defaults to `False`.
**kwargs: Additional keyword arguments to pass to the `Runnable`.
@@ -936,7 +936,7 @@ class Runnable(ABC, Generic[Input, Output]):
The config supports standard keys like `'tags'`, `'metadata'` for
tracing purposes, `'max_concurrency'` for controlling how much work to
do in parallel, and other keys. Please refer to the `RunnableConfig`
- for more details. Defaults to `None`.
+ for more details.
return_exceptions: Whether to return exceptions instead of raising them.
Defaults to `False`.
**kwargs: Additional keyword arguments to pass to the `Runnable`.
@@ -1003,7 +1003,7 @@ class Runnable(ABC, Generic[Input, Output]):
The config supports standard keys like `'tags'`, `'metadata'` for
tracing purposes, `'max_concurrency'` for controlling how much work to
do in parallel, and other keys. Please refer to the `RunnableConfig`
- for more details. Defaults to `None`.
+ for more details.
return_exceptions: Whether to return exceptions instead of raising them.
Defaults to `False`.
**kwargs: Additional keyword arguments to pass to the `Runnable`.
@@ -1067,7 +1067,7 @@ class Runnable(ABC, Generic[Input, Output]):
The config supports standard keys like `'tags'`, `'metadata'` for
tracing purposes, `'max_concurrency'` for controlling how much work to
do in parallel, and other keys. Please refer to the `RunnableConfig`
- for more details. Defaults to `None`.
+ for more details.
return_exceptions: Whether to return exceptions instead of raising them.
Defaults to `False`.
**kwargs: Additional keyword arguments to pass to the `Runnable`.
@@ -1120,7 +1120,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`.
+ config: The config to use for the `Runnable`.
**kwargs: Additional keyword arguments to pass to the `Runnable`.
Yields:
@@ -1141,7 +1141,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`.
+ config: The config to use for the `Runnable`.
**kwargs: Additional keyword arguments to pass to the `Runnable`.
Yields:
@@ -1526,7 +1526,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`.
+ config: The config to use for the `Runnable`.
**kwargs: Additional keyword arguments to pass to the `Runnable`.
Yields:
@@ -1571,7 +1571,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`.
+ config: The config to use for the `Runnable`.
**kwargs: Additional keyword arguments to pass to the `Runnable`.
Yields:
@@ -1682,11 +1682,11 @@ class Runnable(ABC, Generic[Input, Output]):
Args:
on_start: Called before the `Runnable` starts running, with the `Run`
- object. Defaults to `None`.
+ object.
on_end: Called after the `Runnable` finishes running, with the `Run`
- object. Defaults to `None`.
+ object.
on_error: Called if the `Runnable` throws an error, with the `Run`
- object. Defaults to `None`.
+ object.
Returns:
A new `Runnable` with the listeners bound.
@@ -1750,11 +1750,11 @@ class Runnable(ABC, Generic[Input, Output]):
Args:
on_start: Called asynchronously before the `Runnable` starts running,
- with the `Run` object. Defaults to `None`.
+ with the `Run` object.
on_end: Called asynchronously after the `Runnable` finishes running,
- with the `Run` object. Defaults to `None`.
+ with the `Run` object.
on_error: Called asynchronously if the `Runnable` throws an error,
- with the `Run` object. Defaults to `None`.
+ with the `Run` object.
Returns:
A new `Runnable` with the listeners bound.
@@ -1833,8 +1833,8 @@ class Runnable(ABC, Generic[Input, Output]):
"""Bind input and output types to a `Runnable`, returning a new `Runnable`.
Args:
- input_type: The input type to bind to the `Runnable`. Defaults to `None`.
- output_type: The output type to bind to the `Runnable`. Defaults to `None`.
+ input_type: The input type to bind to the `Runnable`.
+ output_type: The output type to bind to the `Runnable`.
Returns:
A new Runnable with the types bound.
@@ -1955,7 +1955,7 @@ class Runnable(ABC, Generic[Input, Output]):
to fallbacks as part of the input under the specified key.
If `None`, exceptions will not be passed to fallbacks.
If used, the base `Runnable` and its fallbacks must accept a
- dictionary as input. Defaults to `None`.
+ dictionary as input.
Returns:
A new `Runnable` that will try the original `Runnable`, and then each
@@ -2462,10 +2462,10 @@ class Runnable(ABC, Generic[Input, Output]):
pass `arg_types` to just specify the required arguments and their types.
Args:
- args_schema: The schema for the tool. Defaults to `None`.
- name: The name of the tool. Defaults to `None`.
- description: The description of the tool. Defaults to `None`.
- arg_types: A dictionary of argument names to types. Defaults to `None`.
+ args_schema: The schema for the tool.
+ name: The name of the tool.
+ description: The description of the tool.
+ arg_types: A dictionary of argument names to types.
Returns:
A `BaseTool` instance.
@@ -2888,10 +2888,10 @@ class RunnableSequence(RunnableSerializable[Input, Output]):
Args:
steps: The steps to include in the sequence.
- name: The name of the `Runnable`. Defaults to `None`.
- first: The first `Runnable` in the sequence. Defaults to `None`.
- middle: The middle `Runnable` objects in the sequence. Defaults to `None`.
- last: The last Runnable in the sequence. Defaults to `None`.
+ name: The name of the `Runnable`.
+ first: The first `Runnable` in the sequence.
+ middle: The middle `Runnable` objects in the sequence.
+ last: The last Runnable in the sequence.
Raises:
ValueError: If the sequence has less than 2 steps.
@@ -2960,7 +2960,7 @@ class RunnableSequence(RunnableSerializable[Input, Output]):
"""Get the input schema of the `Runnable`.
Args:
- config: The config to use. Defaults to `None`.
+ config: The config to use.
Returns:
The input schema of the `Runnable`.
@@ -2975,7 +2975,7 @@ class RunnableSequence(RunnableSerializable[Input, Output]):
"""Get the output schema of the `Runnable`.
Args:
- config: The config to use. Defaults to `None`.
+ config: The config to use.
Returns:
The output schema of the `Runnable`.
@@ -3002,7 +3002,7 @@ class RunnableSequence(RunnableSerializable[Input, Output]):
"""Get the graph representation of the `Runnable`.
Args:
- config: The config to use. Defaults to `None`.
+ config: The config to use.
Returns:
The graph representation of the `Runnable`.
@@ -3629,7 +3629,7 @@ class RunnableParallel(RunnableSerializable[Input, dict[str, Any]]):
"""Create a `RunnableParallel`.
Args:
- steps__: The steps to include. Defaults to `None`.
+ steps__: The steps to include.
**kwargs: Additional steps to include.
"""
@@ -3664,8 +3664,8 @@ class RunnableParallel(RunnableSerializable[Input, dict[str, Any]]):
"""Get the name of the `Runnable`.
Args:
- suffix: The suffix to use. Defaults to `None`.
- name: The name to use. Defaults to `None`.
+ suffix: The suffix to use.
+ name: The name to use.
Returns:
The name of the `Runnable`.
@@ -3689,7 +3689,7 @@ class RunnableParallel(RunnableSerializable[Input, dict[str, Any]]):
"""Get the input schema of the `Runnable`.
Args:
- config: The config to use. Defaults to `None`.
+ config: The config to use.
Returns:
The input schema of the `Runnable`.
@@ -3720,7 +3720,7 @@ class RunnableParallel(RunnableSerializable[Input, dict[str, Any]]):
"""Get the output schema of the `Runnable`.
Args:
- config: The config to use. Defaults to `None`.
+ config: The config to use.
Returns:
The output schema of the `Runnable`.
@@ -3747,7 +3747,7 @@ class RunnableParallel(RunnableSerializable[Input, dict[str, Any]]):
"""Get the graph representation of the `Runnable`.
Args:
- config: The config to use. Defaults to `None`.
+ config: The config to use.
Returns:
The graph representation of the `Runnable`.
@@ -4157,8 +4157,8 @@ class RunnableGenerator(Runnable[Input, Output]):
Args:
transform: The transform function.
- atransform: The async transform function. Defaults to `None`.
- name: The name of the `Runnable`. Defaults to `None`.
+ atransform: The async transform function.
+ name: The name of the `Runnable`.
Raises:
TypeError: If the transform is not a generator function.
@@ -4435,8 +4435,8 @@ class RunnableLambda(Runnable[Input, Output]):
Args:
func: Either sync or async callable
afunc: An async callable that takes an input and returns an output.
- Defaults to `None`.
- name: The name of the `Runnable`. Defaults to `None`.
+
+ name: The name of the `Runnable`.
Raises:
TypeError: If the `func` is not a callable type.
@@ -4496,7 +4496,7 @@ class RunnableLambda(Runnable[Input, Output]):
"""The pydantic schema for the input to this `Runnable`.
Args:
- config: The config to use. Defaults to `None`.
+ config: The config to use.
Returns:
The input schema for this `Runnable`.
@@ -4830,7 +4830,7 @@ class RunnableLambda(Runnable[Input, Output]):
Args:
input: The input to this `Runnable`.
- config: The config to use. Defaults to `None`.
+ config: The config to use.
**kwargs: Additional keyword arguments.
Returns:
@@ -4861,7 +4861,7 @@ class RunnableLambda(Runnable[Input, Output]):
Args:
input: The input to this `Runnable`.
- config: The config to use. Defaults to `None`.
+ config: The config to use.
**kwargs: Additional keyword arguments.
Returns:
@@ -5303,11 +5303,11 @@ class RunnableEach(RunnableEachBase[Input, Output]):
Args:
on_start: Called before the `Runnable` starts running, with the `Run`
- object. Defaults to `None`.
+ object.
on_end: Called after the `Runnable` finishes running, with the `Run`
- object. Defaults to `None`.
+ object.
on_error: Called if the `Runnable` throws an error, with the `Run`
- object. Defaults to `None`.
+ object.
Returns:
A new `Runnable` with the listeners bound.
@@ -5336,11 +5336,11 @@ class RunnableEach(RunnableEachBase[Input, Output]):
Args:
on_start: Called asynchronously before the `Runnable` starts running,
- with the `Run` object. Defaults to `None`.
+ with the `Run` object.
on_end: Called asynchronously after the `Runnable` finishes running,
- with the `Run` object. Defaults to `None`.
+ with the `Run` object.
on_error: Called asynchronously if the `Runnable` throws an error,
- with the `Run` object. Defaults to `None`.
+ with the `Run` object.
Returns:
A new `Runnable` with the listeners bound.
@@ -5420,16 +5420,16 @@ class RunnableBindingBase(RunnableSerializable[Input, Output]): # type: ignore[
kwargs: optional kwargs to pass to the underlying `Runnable`, when running
the underlying `Runnable` (e.g., via `invoke`, `batch`,
`transform`, or `stream` or async variants)
- Defaults to `None`.
+
config: optional config to bind to the underlying `Runnable`.
- Defaults to `None`.
+
config_factories: optional list of config factories to apply to the
config before binding to the underlying `Runnable`.
- Defaults to `None`.
+
custom_input_type: Specify to override the input type of the underlying
- `Runnable` with a custom type. Defaults to `None`.
+ `Runnable` with a custom type.
custom_output_type: Specify to override the output type of the underlying
- `Runnable` with a custom type. Defaults to `None`.
+ `Runnable` with a custom type.
**other_kwargs: Unpacked into the base class.
"""
super().__init__(
@@ -5866,11 +5866,11 @@ class RunnableBinding(RunnableBindingBase[Input, Output]): # type: ignore[no-re
Args:
on_start: Called before the `Runnable` starts running, with the `Run`
- object. Defaults to `None`.
+ object.
on_end: Called after the `Runnable` finishes running, with the `Run`
- object. Defaults to `None`.
+ object.
on_error: Called if the `Runnable` throws an error, with the `Run`
- object. Defaults to `None`.
+ object.
Returns:
A new `Runnable` with the listeners bound.
diff --git a/libs/core/langchain_core/runnables/branch.py b/libs/core/langchain_core/runnables/branch.py
index deba85521c..542790286c 100644
--- a/libs/core/langchain_core/runnables/branch.py
+++ b/libs/core/langchain_core/runnables/branch.py
@@ -191,7 +191,7 @@ class RunnableBranch(RunnableSerializable[Input, Output]):
Args:
input: The input to the Runnable.
- config: The configuration for the Runnable. Defaults to `None`.
+ config: The configuration for the Runnable.
**kwargs: Additional keyword arguments to pass to the Runnable.
Returns:
@@ -301,7 +301,7 @@ class RunnableBranch(RunnableSerializable[Input, Output]):
Args:
input: The input to the Runnable.
- config: The configuration for the Runnable. Defaults to `None`.
+ config: The configuration for the Runnable.
**kwargs: Additional keyword arguments to pass to the Runnable.
Yields:
@@ -385,7 +385,7 @@ class RunnableBranch(RunnableSerializable[Input, Output]):
Args:
input: The input to the Runnable.
- config: The configuration for the Runnable. Defaults to `None`.
+ config: The configuration for the Runnable.
**kwargs: Additional keyword arguments to pass to the Runnable.
Yields:
diff --git a/libs/core/langchain_core/runnables/config.py b/libs/core/langchain_core/runnables/config.py
index 33f062607e..c90915837e 100644
--- a/libs/core/langchain_core/runnables/config.py
+++ b/libs/core/langchain_core/runnables/config.py
@@ -193,7 +193,7 @@ def ensure_config(config: RunnableConfig | None = None) -> RunnableConfig:
"""Ensure that a config is a dict with all keys present.
Args:
- config: The config to ensure. Defaults to `None`.
+ config: The config to ensure.
Returns:
The ensured config.
@@ -412,7 +412,7 @@ def call_func_with_variable_args(
func: The function to call.
input: The input to the function.
config: The config to pass to the function.
- run_manager: The run manager to pass to the function. Defaults to `None`.
+ run_manager: The run manager to pass to the function.
**kwargs: The keyword arguments to pass to the function.
Returns:
@@ -446,7 +446,7 @@ def acall_func_with_variable_args(
func: The function to call.
input: The input to the function.
config: The config to pass to the function.
- run_manager: The run manager to pass to the function. Defaults to `None`.
+ run_manager: The run manager to pass to the function.
**kwargs: The keyword arguments to pass to the function.
Returns:
@@ -535,7 +535,7 @@ class ContextThreadPoolExecutor(ThreadPoolExecutor):
Args:
fn: The function to map.
*iterables: The iterables to map over.
- timeout: The timeout for the map. Defaults to `None`.
+ timeout: The timeout for the map.
chunksize: The chunksize for the map. Defaults to 1.
Returns:
diff --git a/libs/core/langchain_core/runnables/configurable.py b/libs/core/langchain_core/runnables/configurable.py
index da4e75f72f..120fdcc3f1 100644
--- a/libs/core/langchain_core/runnables/configurable.py
+++ b/libs/core/langchain_core/runnables/configurable.py
@@ -123,7 +123,7 @@ class DynamicRunnable(RunnableSerializable[Input, Output]):
"""Prepare the Runnable for invocation.
Args:
- config: The configuration to use. Defaults to `None`.
+ config: The configuration to use.
Returns:
The prepared Runnable and configuration.
diff --git a/libs/core/langchain_core/runnables/graph.py b/libs/core/langchain_core/runnables/graph.py
index 589b797fd2..6386e223b6 100644
--- a/libs/core/langchain_core/runnables/graph.py
+++ b/libs/core/langchain_core/runnables/graph.py
@@ -69,7 +69,7 @@ class Edge(NamedTuple):
target: str
"""The target node id."""
data: Stringifiable | None = None
- """Optional data associated with the edge. Defaults to `None`."""
+ """Optional data associated with the edge. """
conditional: bool = False
"""Whether the edge is conditional. Defaults to `False`."""
@@ -77,8 +77,8 @@ class Edge(NamedTuple):
"""Return a copy of the edge with optional new source and target nodes.
Args:
- source: The new source node id. Defaults to `None`.
- target: The new target node id. Defaults to `None`.
+ source: The new source node id.
+ target: The new target node id.
Returns:
A copy of the edge with the new source and target nodes.
@@ -101,7 +101,7 @@ class Node(NamedTuple):
data: type[BaseModel] | RunnableType | None
"""The data of the node."""
metadata: dict[str, Any] | None
- """Optional metadata for the node. Defaults to `None`."""
+ """Optional metadata for the node. """
def copy(
self,
@@ -112,8 +112,8 @@ class Node(NamedTuple):
"""Return a copy of the node with optional new id and name.
Args:
- id: The new node id. Defaults to `None`.
- name: The new node name. Defaults to `None`.
+ id: The new node id.
+ name: The new node name.
Returns:
A copy of the node with the new id and name.
@@ -132,7 +132,7 @@ class Branch(NamedTuple):
condition: Callable[..., str]
"""A callable that returns a string representation of the condition."""
ends: dict[str, str] | None
- """Optional dictionary of end node ids for the branches. Defaults to `None`."""
+ """Optional dictionary of end node ids for the branches. """
class CurveStyle(Enum):
@@ -321,8 +321,8 @@ class Graph:
Args:
data: The data of the node.
- id: The id of the node. Defaults to `None`.
- metadata: Optional metadata for the node. Defaults to `None`.
+ id: The id of the node.
+ metadata: Optional metadata for the node.
Returns:
The node that was added to the graph.
@@ -361,7 +361,7 @@ class Graph:
Args:
source: The source node of the edge.
target: The target node of the edge.
- data: Optional data associated with the edge. Defaults to `None`.
+ data: Optional data associated with the edge.
conditional: Whether the edge is conditional. Defaults to `False`.
Returns:
@@ -549,8 +549,8 @@ class Graph:
Args:
output_file_path: The path to save the image to. If `None`, the image
- is not saved. Defaults to `None`.
- fontname: The name of the font to use. Defaults to `None`.
+ is not saved.
+ fontname: The name of the font to use.
labels: Optional labels for nodes and edges in the graph. Defaults to
`None`.
@@ -592,7 +592,7 @@ class Graph:
Defaults to 9.
frontmatter_config: Mermaid frontmatter config.
Can be used to customize theme and styles. Will be converted to YAML and
- added to the beginning of the mermaid graph. Defaults to `None`.
+ added to the beginning of the mermaid graph.
See more here: https://mermaid.js.org/config/configuration.html.
@@ -652,7 +652,7 @@ class Graph:
wrap_label_n_words: The number of words to wrap the node labels at.
Defaults to 9.
output_file_path: The path to save the image to. If `None`, the image
- is not saved. Defaults to `None`.
+ is not saved.
draw_method: The method to use to draw the graph.
Defaults to MermaidDrawMethod.API.
background_color: The color of the background. Defaults to "white".
@@ -663,7 +663,7 @@ class Graph:
Defaults to 1.0.
frontmatter_config: Mermaid frontmatter config.
Can be used to customize theme and styles. Will be converted to YAML and
- added to the beginning of the mermaid graph. Defaults to `None`.
+ added to the beginning of the mermaid graph.
See more here: https://mermaid.js.org/config/configuration.html.
@@ -679,7 +679,7 @@ class Graph:
}
```
base_url: The base URL of the Mermaid server for rendering via API.
- Defaults to `None`.
+
Returns:
The PNG image as bytes.
diff --git a/libs/core/langchain_core/runnables/graph_mermaid.py b/libs/core/langchain_core/runnables/graph_mermaid.py
index d6c6d2c7d4..bc6caed60d 100644
--- a/libs/core/langchain_core/runnables/graph_mermaid.py
+++ b/libs/core/langchain_core/runnables/graph_mermaid.py
@@ -58,15 +58,15 @@ def draw_mermaid(
Args:
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`.
+ first_node: Id of the first node.
+ last_node: Id of the last node.
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 and
- added to the beginning of the mermaid graph. Defaults to `None`.
+ added to the beginning of the mermaid graph.
See more here: https://mermaid.js.org/config/configuration.html.
@@ -286,13 +286,13 @@ def draw_mermaid_png(
Args:
mermaid_syntax: Mermaid graph syntax.
- output_file_path: Path to save the PNG image. Defaults to `None`.
+ output_file_path: Path to save the PNG image.
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`.
+ base_url: Base URL for the Mermaid.ink API.
Returns:
PNG image bytes.
diff --git a/libs/core/langchain_core/runnables/graph_png.py b/libs/core/langchain_core/runnables/graph_png.py
index a01a1c475f..3e599fc38c 100644
--- a/libs/core/langchain_core/runnables/graph_png.py
+++ b/libs/core/langchain_core/runnables/graph_png.py
@@ -45,7 +45,7 @@ class PngDrawer:
}
}
The keys are the original labels, and the values are the new labels.
- Defaults to `None`.
+
"""
self.fontname = fontname or "arial"
self.labels = labels or LabelsDict(nodes={}, edges={})
@@ -104,7 +104,7 @@ class PngDrawer:
viz: The graphviz object.
source: The source node.
target: The target node.
- label: The label for the edge. Defaults to `None`.
+ label: The label for the edge.
conditional: Whether the edge is conditional. Defaults to `False`.
"""
viz.add_edge(
diff --git a/libs/core/langchain_core/runnables/utils.py b/libs/core/langchain_core/runnables/utils.py
index 51318bee13..448a917ea6 100644
--- a/libs/core/langchain_core/runnables/utils.py
+++ b/libs/core/langchain_core/runnables/utils.py
@@ -552,11 +552,11 @@ class ConfigurableField(NamedTuple):
id: str
"""The unique identifier of the field."""
name: str | None = None
- """The name of the field. Defaults to `None`."""
+ """The name of the field. """
description: str | None = None
- """The description of the field. Defaults to `None`."""
+ """The description of the field. """
annotation: Any | None = None
- """The annotation of the field. Defaults to `None`."""
+ """The annotation of the field. """
is_shared: bool = False
"""Whether the field is shared. Defaults to `False`."""
@@ -575,9 +575,9 @@ class ConfigurableFieldSingleOption(NamedTuple):
default: str
"""The default value for the field."""
name: str | None = None
- """The name of the field. Defaults to `None`."""
+ """The name of the field. """
description: str | None = None
- """The description of the field. Defaults to `None`."""
+ """The description of the field. """
is_shared: bool = False
"""Whether the field is shared. Defaults to `False`."""
@@ -596,9 +596,9 @@ class ConfigurableFieldMultiOption(NamedTuple):
default: Sequence[str]
"""The default values for the field."""
name: str | None = None
- """The name of the field. Defaults to `None`."""
+ """The name of the field. """
description: str | None = None
- """The description of the field. Defaults to `None`."""
+ """The description of the field. """
is_shared: bool = False
"""Whether the field is shared. Defaults to `False`."""
@@ -620,15 +620,15 @@ class ConfigurableFieldSpec(NamedTuple):
annotation: Any
"""The annotation of the field."""
name: str | None = None
- """The name of the field. Defaults to `None`."""
+ """The name of the field. """
description: str | None = None
- """The description of the field. Defaults to `None`."""
+ """The description of the field. """
default: Any = None
- """The default value for the field. Defaults to `None`."""
+ """The default value for the field. """
is_shared: bool = False
"""Whether the field is shared. Defaults to `False`."""
dependencies: list[str] | None = None
- """The dependencies of the field. Defaults to `None`."""
+ """The dependencies of the field. """
def get_unique_config_specs(
diff --git a/libs/core/langchain_core/stores.py b/libs/core/langchain_core/stores.py
index 2c570b6658..8bd52c7622 100644
--- a/libs/core/langchain_core/stores.py
+++ b/libs/core/langchain_core/stores.py
@@ -209,7 +209,7 @@ class InMemoryBaseStore(BaseStore[str, V], Generic[V]):
"""Get an iterator over keys that match the given prefix.
Args:
- prefix: The prefix to match. Defaults to `None`.
+ prefix: The prefix to match.
Yields:
The keys that match the given prefix.
@@ -225,7 +225,7 @@ class InMemoryBaseStore(BaseStore[str, V], Generic[V]):
"""Async get an async iterator over keys that match the given prefix.
Args:
- prefix: The prefix to match. Defaults to `None`.
+ prefix: The prefix to match.
Yields:
The keys that match the given prefix.
diff --git a/libs/core/langchain_core/tools/base.py b/libs/core/langchain_core/tools/base.py
index adeb49e615..298819e22b 100644
--- a/libs/core/langchain_core/tools/base.py
+++ b/libs/core/langchain_core/tools/base.py
@@ -460,13 +460,13 @@ class ChildTool(BaseTool):
"""Callbacks to be called during tool execution."""
tags: list[str] | None = None
- """Optional list of tags associated with the tool. Defaults to `None`.
+ """Optional list of tags associated with the tool.
These tags will be associated with each call to this tool,
and passed as arguments to the handlers defined in `callbacks`.
You can use these to eg identify a specific instance of a tool with its use case.
"""
metadata: dict[str, Any] | None = None
- """Optional metadata associated with the tool. Defaults to `None`.
+ """Optional metadata associated with the tool.
This metadata will be associated with each call to this tool,
and passed as arguments to the handlers defined in `callbacks`.
You can use these to eg identify a specific instance of a tool with its use case.
@@ -767,16 +767,16 @@ class ChildTool(BaseTool):
Args:
tool_input: The input to the tool.
- verbose: Whether to log the tool's progress. Defaults to `None`.
+ verbose: Whether to log the tool's progress.
start_color: The color to use when starting the tool. Defaults to 'green'.
color: The color to use when ending the tool. Defaults to 'green'.
- callbacks: Callbacks to be called during tool execution. Defaults to `None`.
- tags: Optional list of tags associated with the tool. Defaults to `None`.
- metadata: Optional metadata associated with the tool. Defaults to `None`.
- run_name: The name of the run. Defaults to `None`.
- 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`.
+ callbacks: Callbacks to be called during tool execution.
+ tags: Optional list of tags associated with the tool.
+ metadata: Optional metadata associated with the tool.
+ run_name: The name of the run.
+ run_id: The id of the run.
+ config: The configuration for the tool.
+ tool_call_id: The id of the tool call.
**kwargs: Keyword arguments to be passed to tool callbacks (event handler)
Returns:
@@ -879,16 +879,16 @@ class ChildTool(BaseTool):
Args:
tool_input: The input to the tool.
- verbose: Whether to log the tool's progress. Defaults to `None`.
+ verbose: Whether to log the tool's progress.
start_color: The color to use when starting the tool. Defaults to 'green'.
color: The color to use when ending the tool. Defaults to 'green'.
- callbacks: Callbacks to be called during tool execution. Defaults to `None`.
- tags: Optional list of tags associated with the tool. Defaults to `None`.
- metadata: Optional metadata associated with the tool. Defaults to `None`.
- run_name: The name of the run. Defaults to `None`.
- 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`.
+ callbacks: Callbacks to be called during tool execution.
+ tags: Optional list of tags associated with the tool.
+ metadata: Optional metadata associated with the tool.
+ run_name: The name of the run.
+ run_id: The id of the run.
+ config: The configuration for the tool.
+ tool_call_id: The id of the tool call.
**kwargs: Keyword arguments to be passed to tool callbacks
Returns:
diff --git a/libs/core/langchain_core/tools/convert.py b/libs/core/langchain_core/tools/convert.py
index 0bc4e2e98b..d3c427e7c6 100644
--- a/libs/core/langchain_core/tools/convert.py
+++ b/libs/core/langchain_core/tools/convert.py
@@ -101,7 +101,7 @@ def tool(
return_direct: Whether to return directly from the tool rather
than continuing the agent loop. Defaults to `False`.
args_schema: optional argument schema for user to specify.
- Defaults to `None`.
+
infer_schema: Whether to infer the schema of the arguments from
the function's signature. This also makes the resultant tool
accept a dictionary input to its `run()` function.
@@ -397,10 +397,10 @@ def convert_runnable_to_tool(
Args:
runnable: The runnable to convert.
- args_schema: The schema for the tool's input arguments. Defaults to `None`.
- name: The name of the tool. Defaults to `None`.
- description: The description of the tool. Defaults to `None`.
- arg_types: The types of the arguments. Defaults to `None`.
+ args_schema: The schema for the tool's input arguments.
+ name: The name of the tool.
+ description: The description of the tool.
+ arg_types: The types of the arguments.
Returns:
The tool.
diff --git a/libs/core/langchain_core/tools/retriever.py b/libs/core/langchain_core/tools/retriever.py
index fff2fe3fe8..7ae35abc7f 100644
--- a/libs/core/langchain_core/tools/retriever.py
+++ b/libs/core/langchain_core/tools/retriever.py
@@ -81,7 +81,7 @@ def create_retriever_tool(
so should be unique and somewhat descriptive.
description: The description for the tool. This will be passed to the language
model, so should be descriptive.
- document_prompt: The prompt to use for the document. Defaults to `None`.
+ document_prompt: The prompt to use for the document.
document_separator: The separator to use between documents. Defaults to "\n\n".
response_format: The tool response format. If "content" then the output of
the tool is interpreted as the contents of a ToolMessage. If
diff --git a/libs/core/langchain_core/tools/simple.py b/libs/core/langchain_core/tools/simple.py
index 249fc41fef..0a662b44ed 100644
--- a/libs/core/langchain_core/tools/simple.py
+++ b/libs/core/langchain_core/tools/simple.py
@@ -178,8 +178,8 @@ class Tool(BaseTool):
name: The name of the tool.
description: The description of the tool.
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`.
+ args_schema: The schema of the tool's input arguments.
+ coroutine: The asynchronous version of the function.
**kwargs: Additional arguments to pass to the tool.
Returns:
diff --git a/libs/core/langchain_core/tools/structured.py b/libs/core/langchain_core/tools/structured.py
index cc978446f3..0dc223b63f 100644
--- a/libs/core/langchain_core/tools/structured.py
+++ b/libs/core/langchain_core/tools/structured.py
@@ -150,7 +150,7 @@ class StructuredTool(BaseTool):
Defaults to the function docstring.
return_direct: Whether to return the result directly or as a callback.
Defaults to `False`.
- args_schema: The schema of the tool's input arguments. Defaults to `None`.
+ args_schema: The schema of the tool's input arguments.
infer_schema: Whether to infer the schema from the function's signature.
Defaults to `True`.
response_format: The tool response format. If "content" then the output of
diff --git a/libs/core/langchain_core/tracers/base.py b/libs/core/langchain_core/tracers/base.py
index 1ff9c9ed0c..01bc9da0aa 100644
--- a/libs/core/langchain_core/tracers/base.py
+++ b/libs/core/langchain_core/tracers/base.py
@@ -67,9 +67,9 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):
serialized: The serialized model.
messages: The messages to start the chat with.
run_id: The run ID.
- tags: The tags for the run. Defaults to `None`.
- parent_run_id: The parent run ID. Defaults to `None`.
- metadata: The metadata for the run. Defaults to `None`.
+ tags: The tags for the run.
+ parent_run_id: The parent run ID.
+ metadata: The metadata for the run.
name: The name of the run.
**kwargs: Additional arguments.
@@ -108,9 +108,9 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):
serialized: The serialized model.
prompts: The prompts to start the LLM with.
run_id: The run ID.
- tags: The tags for the run. Defaults to `None`.
- parent_run_id: The parent run ID. Defaults to `None`.
- metadata: The metadata for the run. Defaults to `None`.
+ tags: The tags for the run.
+ parent_run_id: The parent run ID.
+ metadata: The metadata for the run.
name: The name of the run.
**kwargs: Additional arguments.
@@ -145,9 +145,9 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):
Args:
token: The token.
- chunk: The chunk. Defaults to `None`.
+ chunk: The chunk.
run_id: The run ID.
- parent_run_id: The parent run ID. Defaults to `None`.
+ parent_run_id: The parent run ID.
**kwargs: Additional arguments.
Returns:
@@ -255,10 +255,10 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):
serialized: The serialized chain.
inputs: The inputs for the chain.
run_id: The run ID.
- tags: The tags for the run. Defaults to `None`.
- parent_run_id: The parent run ID. Defaults to `None`.
- metadata: The metadata for the run. Defaults to `None`.
- run_type: The type of the run. Defaults to `None`.
+ tags: The tags for the run.
+ parent_run_id: The parent run ID.
+ metadata: The metadata for the run.
+ run_type: The type of the run.
name: The name of the run.
**kwargs: Additional arguments.
@@ -294,7 +294,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):
Args:
outputs: The outputs for the chain.
run_id: The run ID.
- inputs: The inputs for the chain. Defaults to `None`.
+ inputs: The inputs for the chain.
**kwargs: Additional arguments.
Returns:
@@ -322,7 +322,7 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):
Args:
error: The error.
- inputs: The inputs for the chain. Defaults to `None`.
+ inputs: The inputs for the chain.
run_id: The run ID.
**kwargs: Additional arguments.
@@ -357,9 +357,9 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):
serialized: The serialized tool.
input_str: The input string.
run_id: The run ID.
- tags: The tags for the run. Defaults to `None`.
- parent_run_id: The parent run ID. Defaults to `None`.
- metadata: The metadata for the run. Defaults to `None`.
+ tags: The tags for the run.
+ parent_run_id: The parent run ID.
+ metadata: The metadata for the run.
name: The name of the run.
inputs: The inputs for the tool.
**kwargs: Additional arguments.
@@ -446,9 +446,9 @@ class BaseTracer(_TracerCore, BaseCallbackHandler, ABC):
serialized: The serialized retriever.
query: The query.
run_id: The run ID.
- parent_run_id: The parent run ID. Defaults to `None`.
- tags: The tags for the run. Defaults to `None`.
- metadata: The metadata for the run. Defaults to `None`.
+ parent_run_id: The parent run ID.
+ tags: The tags for the run.
+ metadata: The metadata for the run.
name: The name of the run.
**kwargs: Additional arguments.
diff --git a/libs/core/langchain_core/tracers/context.py b/libs/core/langchain_core/tracers/context.py
index 2dc2043a92..982054b132 100644
--- a/libs/core/langchain_core/tracers/context.py
+++ b/libs/core/langchain_core/tracers/context.py
@@ -48,9 +48,9 @@ def tracing_v2_enabled(
Args:
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`.
+ example_id: The ID of the example.
+ tags: The tags to add to the run.
+ client: The client of the langsmith.
Yields:
The LangChain tracer.
diff --git a/libs/core/langchain_core/tracers/langchain.py b/libs/core/langchain_core/tracers/langchain.py
index d1928622cb..15186007d6 100644
--- a/libs/core/langchain_core/tracers/langchain.py
+++ b/libs/core/langchain_core/tracers/langchain.py
@@ -134,10 +134,10 @@ class LangChainTracer(BaseTracer):
serialized: The serialized model.
messages: The messages.
run_id: The run ID.
- tags: The tags. Defaults to `None`.
- parent_run_id: The parent run ID. Defaults to `None`.
- metadata: The metadata. Defaults to `None`.
- name: The name. Defaults to `None`.
+ tags: The tags.
+ parent_run_id: The parent run ID.
+ metadata: The metadata.
+ name: The name.
**kwargs: Additional keyword arguments.
Returns:
diff --git a/libs/core/langchain_core/utils/aiter.py b/libs/core/langchain_core/utils/aiter.py
index e910cee43c..44319e1a65 100644
--- a/libs/core/langchain_core/utils/aiter.py
+++ b/libs/core/langchain_core/utils/aiter.py
@@ -203,7 +203,7 @@ class Tee(Generic[T]):
iterable: The iterable to split.
n: The number of iterators to create. Defaults to 2.
lock: The lock to synchronise access to the shared buffers.
- Defaults to `None`.
+
"""
self._iterator = iterable.__aiter__() # before 3.10 aiter() doesn't exist
self._buffers: list[deque[T]] = [deque() for _ in range(n)]
diff --git a/libs/core/langchain_core/utils/env.py b/libs/core/langchain_core/utils/env.py
index 5d9abe916e..9af2179dfe 100644
--- a/libs/core/langchain_core/utils/env.py
+++ b/libs/core/langchain_core/utils/env.py
@@ -38,7 +38,7 @@ def get_from_dict_or_env(
env_key: The environment variable to look up if the key is not
in the dictionary.
default: The default value to return if the key is not in the dictionary
- or the environment. Defaults to `None`.
+ or the environment.
Returns:
The dict value or the environment variable value.
@@ -64,7 +64,7 @@ def get_from_env(key: str, env_key: str, default: str | None = None) -> str:
env_key: The environment variable to look up if the key is not
in the dictionary.
default: The default value to return if the key is not in the dictionary
- or the environment. Defaults to `None`.
+ or the environment.
Returns:
The value of the key.
diff --git a/libs/core/langchain_core/utils/function_calling.py b/libs/core/langchain_core/utils/function_calling.py
index 5ba5efa59e..1ca8b0954a 100644
--- a/libs/core/langchain_core/utils/function_calling.py
+++ b/libs/core/langchain_core/utils/function_calling.py
@@ -665,7 +665,7 @@ def tool_example_to_messages(
tool_calls: Tool calls represented as Pydantic BaseModels
tool_outputs: Tool call outputs.
Does not need to be provided. If not provided, a placeholder value
- will be inserted. Defaults to `None`.
+ will be inserted.
ai_response: If provided, content for a final `AIMessage`.
Returns:
diff --git a/libs/core/langchain_core/utils/input.py b/libs/core/langchain_core/utils/input.py
index bedb58cb62..e71c261824 100644
--- a/libs/core/langchain_core/utils/input.py
+++ b/libs/core/langchain_core/utils/input.py
@@ -65,9 +65,9 @@ def print_text(
Args:
text: The text to print.
- color: The color to use. Defaults to `None`.
+ color: The color to use.
end: The end character to use. Defaults to "".
- file: The file to write to. Defaults to `None`.
+ file: The file to write to.
"""
text_to_print = get_colored_text(text, color) if color else text
print(text_to_print, end=end, file=file)
diff --git a/libs/core/langchain_core/utils/iter.py b/libs/core/langchain_core/utils/iter.py
index 2334d9063f..3dbe28d204 100644
--- a/libs/core/langchain_core/utils/iter.py
+++ b/libs/core/langchain_core/utils/iter.py
@@ -139,7 +139,7 @@ class Tee(Generic[T]):
iterable: The iterable to split.
n: The number of iterators to create. Defaults to 2.
lock: The lock to synchronise access to the shared buffers.
- Defaults to `None`.
+
"""
self._iterator = iter(iterable)
self._buffers: list[deque[T]] = [deque() for _ in range(n)]
diff --git a/libs/core/langchain_core/utils/utils.py b/libs/core/langchain_core/utils/utils.py
index 3d9c2a838b..51c65fccc8 100644
--- a/libs/core/langchain_core/utils/utils.py
+++ b/libs/core/langchain_core/utils/utils.py
@@ -123,8 +123,8 @@ def guard_import(
Args:
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`.
+ pip_name: The name of the module to install with pip.
+ package: The package to import the module from.
Returns:
The imported module.
@@ -155,11 +155,11 @@ def check_package_version(
Args:
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`.
+ lt_version: The version must be less than this.
+ lte_version: The version must be less than or equal to this.
+ gt_version: The version must be greater than this.
gte_version: The version must be greater than or equal to this.
- Defaults to `None`.
+
Raises:
ValueError: If the package version does not meet the requirements.
diff --git a/libs/langchain/langchain_classic/agents/agent_toolkits/vectorstore/base.py b/libs/langchain/langchain_classic/agents/agent_toolkits/vectorstore/base.py
index 95587613af..a8d02d4f03 100644
--- a/libs/langchain/langchain_classic/agents/agent_toolkits/vectorstore/base.py
+++ b/libs/langchain/langchain_classic/agents/agent_toolkits/vectorstore/base.py
@@ -86,7 +86,7 @@ def create_vectorstore_agent(
Args:
llm: LLM that will be used by the agent
toolkit: Set of tools for the agent
- callback_manager: Object to handle the callback [ Defaults to `None`. ]
+ callback_manager: Object to handle the callback
prefix: The prefix prompt for the agent. If not provided uses default PREFIX.
verbose: If you want to see the content of the scratchpad.
[ Defaults to `False` ]
@@ -200,7 +200,7 @@ def create_vectorstore_router_agent(
llm: LLM that will be used by the agent
toolkit: Set of tools for the agent which have routing capability with multiple
vector stores
- callback_manager: Object to handle the callback [ Defaults to `None`. ]
+ callback_manager: Object to handle the callback
prefix: The prefix prompt for the router agent.
If not provided uses default ROUTER_PREFIX.
verbose: If you want to see the content of the scratchpad.
diff --git a/libs/langchain/langchain_classic/agents/conversational_chat/base.py b/libs/langchain/langchain_classic/agents/conversational_chat/base.py
index b8943bdb35..23b5af5565 100644
--- a/libs/langchain/langchain_classic/agents/conversational_chat/base.py
+++ b/libs/langchain/langchain_classic/agents/conversational_chat/base.py
@@ -91,8 +91,8 @@ class ConversationalChatAgent(Agent):
Defaults to the PREFIX.
human_message: The human message to use.
Defaults to the SUFFIX.
- input_variables: The input variables to use. Defaults to `None`.
- output_parser: The output parser to use. Defaults to `None`.
+ input_variables: The input variables to use.
+ output_parser: The output parser to use.
Returns:
A PromptTemplate.
diff --git a/libs/langchain/langchain_classic/agents/initialize.py b/libs/langchain/langchain_classic/agents/initialize.py
index c1df318ab6..c01e0e441e 100644
--- a/libs/langchain/langchain_classic/agents/initialize.py
+++ b/libs/langchain/langchain_classic/agents/initialize.py
@@ -38,14 +38,14 @@ def initialize_agent(
tools: List of tools this agent has access to.
llm: Language model to use as the agent.
agent: Agent type to use. If `None` and agent_path is also None, will default
- to AgentType.ZERO_SHOT_REACT_DESCRIPTION. Defaults to `None`.
+ to AgentType.ZERO_SHOT_REACT_DESCRIPTION.
callback_manager: CallbackManager to use. Global callback manager is used if
- not provided. Defaults to `None`.
+ not provided.
agent_path: Path to serialized agent to use. If `None` and agent is also None,
- will default to AgentType.ZERO_SHOT_REACT_DESCRIPTION. Defaults to `None`.
+ will default to AgentType.ZERO_SHOT_REACT_DESCRIPTION.
agent_kwargs: Additional keyword arguments to pass to the underlying agent.
- Defaults to `None`.
- tags: Tags to apply to the traced runs. Defaults to `None`.
+
+ tags: Tags to apply to the traced runs.
kwargs: Additional keyword arguments passed to the agent executor.
Returns:
diff --git a/libs/langchain/langchain_classic/agents/mrkl/base.py b/libs/langchain/langchain_classic/agents/mrkl/base.py
index 799b733702..de2dd7873b 100644
--- a/libs/langchain/langchain_classic/agents/mrkl/base.py
+++ b/libs/langchain/langchain_classic/agents/mrkl/base.py
@@ -98,7 +98,7 @@ class ZeroShotAgent(Agent):
format_instructions: Instructions on how to use the tools.
Defaults to FORMAT_INSTRUCTIONS
input_variables: List of input variables the final prompt will expect.
- Defaults to `None`.
+
Returns:
A PromptTemplate with the template assembled from the pieces here.
@@ -129,13 +129,13 @@ class ZeroShotAgent(Agent):
Args:
llm: The LLM to use as the agent LLM.
tools: The tools to use.
- callback_manager: The callback manager to use. Defaults to `None`.
- output_parser: The output parser to use. Defaults to `None`.
+ callback_manager: The callback manager to use.
+ output_parser: The output parser to use.
prefix: The prefix to use. Defaults to PREFIX.
suffix: The suffix to use. Defaults to SUFFIX.
format_instructions: The format instructions to use.
Defaults to FORMAT_INSTRUCTIONS.
- input_variables: The input variables to use. Defaults to `None`.
+ input_variables: The input variables to use.
kwargs: Additional parameters to pass to the agent.
"""
cls._validate_tools(tools)
diff --git a/libs/langchain/langchain_classic/agents/openai_assistant/base.py b/libs/langchain/langchain_classic/agents/openai_assistant/base.py
index ed428e4ed1..dc4f33b58e 100644
--- a/libs/langchain/langchain_classic/agents/openai_assistant/base.py
+++ b/libs/langchain/langchain_classic/agents/openai_assistant/base.py
@@ -314,7 +314,7 @@ class OpenAIAssistantRunnable(RunnableSerializable[dict, OutputType]):
run_metadata: Metadata to associate with new run.
attachments: A list of files attached to the message, and the
tools they should be added to.
- config: Runnable config. Defaults to `None`.
+ config: Runnable config.
**kwargs: Additional arguments.
Returns:
@@ -446,7 +446,7 @@ class OpenAIAssistantRunnable(RunnableSerializable[dict, OutputType]):
max_completion_tokens: Allow setting max_completion_tokens for this run.
max_prompt_tokens: Allow setting max_prompt_tokens for this run.
run_metadata: Metadata to associate with new run.
- config: Runnable config. Defaults to `None`.
+ config: Runnable config.
kwargs: Additional arguments.
Returns:
diff --git a/libs/langchain/langchain_classic/agents/openai_functions_agent/base.py b/libs/langchain/langchain_classic/agents/openai_functions_agent/base.py
index c6907b7eeb..0934d78c2f 100644
--- a/libs/langchain/langchain_classic/agents/openai_functions_agent/base.py
+++ b/libs/langchain/langchain_classic/agents/openai_functions_agent/base.py
@@ -106,7 +106,7 @@ class OpenAIFunctionsAgent(BaseSingleActionAgent):
Args:
intermediate_steps: Steps the LLM has taken to date,
along with observations.
- callbacks: Callbacks to use. Defaults to `None`.
+ callbacks: Callbacks to use.
with_functions: Whether to use functions. Defaults to `True`.
**kwargs: User inputs.
@@ -146,7 +146,7 @@ class OpenAIFunctionsAgent(BaseSingleActionAgent):
Args:
intermediate_steps: Steps the LLM has taken to date,
along with observations.
- callbacks: Callbacks to use. Defaults to `None`.
+ callbacks: Callbacks to use.
**kwargs: User inputs.
Returns:
@@ -261,8 +261,8 @@ class OpenAIFunctionsAgent(BaseSingleActionAgent):
Args:
llm: The LLM to use as the agent.
tools: The tools to use.
- callback_manager: The callback manager to use. Defaults to `None`.
- extra_prompt_messages: Extra prompt messages to use. Defaults to `None`.
+ callback_manager: The callback manager to use.
+ extra_prompt_messages: Extra prompt messages to use.
system_message: The system message to use.
Defaults to a default system message.
kwargs: Additional parameters to pass to the agent.
diff --git a/libs/langchain/langchain_classic/callbacks/streamlit/__init__.py b/libs/langchain/langchain_classic/callbacks/streamlit/__init__.py
index a17acc3c31..7d16e932b7 100644
--- a/libs/langchain/langchain_classic/callbacks/streamlit/__init__.py
+++ b/libs/langchain/langchain_classic/callbacks/streamlit/__init__.py
@@ -40,7 +40,7 @@ def StreamlitCallbackHandler( # noqa: N802
Defaults to `True`.
thought_labeler
An optional custom LLMThoughtLabeler instance. If unspecified, the handler
- will use the default thought labeling logic. Defaults to `None`.
+ will use the default thought labeling logic.
Returns:
-------
diff --git a/libs/langchain/langchain_classic/chains/base.py b/libs/langchain/langchain_classic/chains/base.py
index 2d1c0b1e02..6b9934a791 100644
--- a/libs/langchain/langchain_classic/chains/base.py
+++ b/libs/langchain/langchain_classic/chains/base.py
@@ -73,14 +73,14 @@ class Chain(RunnableSerializable[dict[str, Any], dict[str, Any]], ABC):
"""
memory: BaseMemory | None = None
- """Optional memory object. Defaults to `None`.
+ """Optional memory object.
Memory is a class that gets called at the start
and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it saves any returned variables.
There are many different types of memory - please see memory docs
for the full catalog."""
callbacks: Callbacks = Field(default=None, exclude=True)
- """Optional list of callback handlers (or callback manager). Defaults to `None`.
+ """Optional list of callback handlers (or callback manager).
Callback handlers are called throughout the lifecycle of a call to a chain,
starting with on_chain_start, ending with on_chain_end or on_chain_error.
Each custom chain can optionally call additional callback methods, see Callback docs
@@ -90,13 +90,13 @@ class Chain(RunnableSerializable[dict[str, Any], dict[str, Any]], ABC):
will be printed to the console. Defaults to the global `verbose` value,
accessible via `langchain.globals.get_verbose()`."""
tags: list[str] | None = None
- """Optional list of tags associated with the chain. Defaults to `None`.
+ """Optional list of tags associated with the chain.
These tags will be associated with each call to this chain,
and passed as arguments to the handlers defined in `callbacks`.
You can use these to eg identify a specific instance of a chain with its use case.
"""
metadata: dict[str, Any] | None = None
- """Optional metadata associated with the chain. Defaults to `None`.
+ """Optional metadata associated with the chain.
This metadata will be associated with each call to this chain,
and passed as arguments to the handlers defined in `callbacks`.
You can use these to eg identify a specific instance of a chain with its use case.
@@ -394,7 +394,7 @@ class Chain(RunnableSerializable[dict[str, Any], dict[str, Any]], ABC):
tags: List of string tags to pass to all callbacks. These will be passed in
addition to tags passed to the chain during construction, but only
these runtime tags will propagate to calls to other objects.
- metadata: Optional metadata associated with the chain. Defaults to `None`.
+ metadata: Optional metadata associated with the chain.
run_name: Optional name for this run of the chain.
include_run_info: Whether to include run info in the response. Defaults
to False.
@@ -446,7 +446,7 @@ class Chain(RunnableSerializable[dict[str, Any], dict[str, Any]], ABC):
tags: List of string tags to pass to all callbacks. These will be passed in
addition to tags passed to the chain during construction, but only
these runtime tags will propagate to calls to other objects.
- metadata: Optional metadata associated with the chain. Defaults to `None`.
+ metadata: Optional metadata associated with the chain.
run_name: Optional name for this run of the chain.
include_run_info: Whether to include run info in the response. Defaults
to False.
diff --git a/libs/langchain/langchain_classic/chains/sql_database/query.py b/libs/langchain/langchain_classic/chains/sql_database/query.py
index 9b10b704b6..f14b967220 100644
--- a/libs/langchain/langchain_classic/chains/sql_database/query.py
+++ b/libs/langchain/langchain_classic/chains/sql_database/query.py
@@ -59,7 +59,7 @@ def create_sql_query_chain(
llm: The language model to use.
db: The SQLDatabase to generate the query for.
prompt: The prompt to use. If none is provided, will choose one
- based on dialect. Defaults to `None`. See Prompt section below for more.
+ based on dialect. See Prompt section below for more.
k: The number of results per select statement to return. Defaults to 5.
get_col_comments: Whether to retrieve column comments along with table info.
Defaults to `False`.
diff --git a/libs/langchain/langchain_classic/chains/summarize/chain.py b/libs/langchain/langchain_classic/chains/summarize/chain.py
index 8b712d06cb..dad2d373b1 100644
--- a/libs/langchain/langchain_classic/chains/summarize/chain.py
+++ b/libs/langchain/langchain_classic/chains/summarize/chain.py
@@ -50,7 +50,7 @@ def _load_stuff_chain(
passed into the LLM. Defaults to `stuff_prompt.PROMPT`.
document_variable_name: Variable name in the prompt template where the
document text will be inserted. Defaults to "text".
- verbose: Whether to log progress and intermediate steps. Defaults to `None`.
+ verbose: Whether to log progress and intermediate steps.
**kwargs: Additional keyword arguments passed to the StuffDocumentsChain.
Returns:
@@ -112,17 +112,17 @@ def _load_map_reduce_chain(
map_reduce_document_variable_name: Variable name in the `map_prompt`
where document text is inserted. Defaults to "text".
collapse_prompt: Optional prompt used to collapse intermediate summaries
- if they exceed the token limit (`token_max`). Defaults to `None`.
+ if they exceed the token limit (`token_max`).
reduce_llm: Optional separate LLM for the reduce step. Defaults to `None`,
which uses the same model as the map step.
collapse_llm: Optional separate LLM for the collapse step. Defaults to `None`,
which uses the same model as the map step.
- verbose: Whether to log progess and intermediate steps. Defaults to `None`.
+ verbose: Whether to log progess and intermediate steps.
token_max: Token threshold that triggers the collapse step during reduction.
Defaults to 3000.
- callbacks: Optional callbacks for logging and tracing. Defaults to `None`.
+ callbacks: Optional callbacks for logging and tracing.
collapse_max_retries: Maximum retries for the collapse step if it fails.
- Defaults to `None`.
+
**kwargs: Additional keyword arguments passed to the MapReduceDocumentsChain.
Returns:
diff --git a/libs/partners/chroma/langchain_chroma/vectorstores.py b/libs/partners/chroma/langchain_chroma/vectorstores.py
index 94787621ae..0ec6f21631 100644
--- a/libs/partners/chroma/langchain_chroma/vectorstores.py
+++ b/libs/partners/chroma/langchain_chroma/vectorstores.py
@@ -332,7 +332,7 @@ class Chroma(VectorStore):
client_settings: Chroma client settings
collection_metadata: Collection configurations.
collection_configuration: Index configuration for the collection.
- Defaults to `None`.
+
client: Chroma client. Documentation:
https://docs.trychroma.com/reference/python/client
relevance_score_fn: Function to calculate relevance score from distance.
@@ -687,7 +687,7 @@ class Chroma(VectorStore):
Args:
query: Query text to search for.
k: Number of results to return. Defaults to 4.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
kwargs: Additional keyword arguments to pass to Chroma collection query.
Returns:
@@ -714,7 +714,7 @@ class Chroma(VectorStore):
Args:
embedding: Embedding to look up documents similar to.
k: Number of Documents to return. Defaults to 4.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
where_document: dict used to filter by the document contents.
E.g. {"$contains": "hello"}.
kwargs: Additional keyword arguments to pass to Chroma collection query.
@@ -744,7 +744,7 @@ class Chroma(VectorStore):
Args:
embedding (List[float]): Embedding to look up documents similar to.
k: Number of Documents to return. Defaults to 4.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
where_document: dict used to filter by the documents.
E.g. {"$contains": "hello"}.
kwargs: Additional keyword arguments to pass to Chroma collection query.
@@ -775,7 +775,7 @@ class Chroma(VectorStore):
Args:
query: Query text to search for.
k: Number of results to return. Defaults to 4.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
where_document: dict used to filter by document contents.
E.g. {"$contains": "hello"}.
kwargs: Additional keyword arguments to pass to Chroma collection query.
@@ -817,7 +817,7 @@ class Chroma(VectorStore):
Args:
query: Query text to search for.
k: Number of results to return. Defaults to 4.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
where_document: dict used to filter by the document contents.
E.g. {"$contains": "hello"}.
kwargs: Additional keyword arguments to pass to Chroma collection query.
@@ -995,7 +995,7 @@ class Chroma(VectorStore):
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
where_document: dict used to filter by the document contents.
E.g. {"$contains": "hello"}.
kwargs: Additional keyword arguments to pass to Chroma collection query.
@@ -1045,7 +1045,7 @@ class Chroma(VectorStore):
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
where_document: dict used to filter by the document contents.
E.g. {"$contains": "hello"}.
kwargs: Additional keyword arguments to pass to Chroma collection query.
@@ -1262,15 +1262,15 @@ class Chroma(VectorStore):
Default is 'default_tenant' for local Chroma servers.
database: Database name. Required for Chroma Cloud connections.
Default is 'default_database'.
- embedding: Embedding function. Defaults to `None`.
- metadatas: List of metadatas. Defaults to `None`.
- ids: List of document IDs. Defaults to `None`.
+ embedding: Embedding function.
+ metadatas: List of metadatas.
+ ids: List of document IDs.
client_settings: Chroma client settings.
client: Chroma client. Documentation:
https://docs.trychroma.com/reference/python/client
- collection_metadata: Collection configurations. Defaults to `None`.
+ collection_metadata: Collection configurations.
collection_configuration: Index configuration for the collection.
- Defaults to `None`.
+
kwargs: Additional keyword arguments to initialize a Chroma client.
Returns:
@@ -1361,15 +1361,15 @@ class Chroma(VectorStore):
Default is 'default_tenant' for local Chroma servers.
database: Database name. Required for Chroma Cloud connections.
Default is 'default_database'.
- ids : List of document IDs. Defaults to `None`.
+ ids : List of document IDs.
documents: List of documents to add to the vectorstore.
- embedding: Embedding function. Defaults to `None`.
+ embedding: Embedding function.
client_settings: Chroma client settings.
client: Chroma client. Documentation:
https://docs.trychroma.com/reference/python/client
- collection_metadata: Collection configurations. Defaults to `None`.
+ collection_metadata: Collection configurations.
collection_configuration: Index configuration for the collection.
- Defaults to `None`.
+
kwargs: Additional keyword arguments to initialize a Chroma client.
Returns:
diff --git a/libs/partners/qdrant/langchain_qdrant/fastembed_sparse.py b/libs/partners/qdrant/langchain_qdrant/fastembed_sparse.py
index fc6e72a845..4130f9074d 100644
--- a/libs/partners/qdrant/langchain_qdrant/fastembed_sparse.py
+++ b/libs/partners/qdrant/langchain_qdrant/fastembed_sparse.py
@@ -40,7 +40,7 @@ class FastEmbedSparse(SparseEmbeddings):
If `0`, use all available cores.\
If `None`, don't use data-parallel processing,\
use default onnxruntime threading instead.\
- Defaults to `None`.
+
kwargs: Additional options to pass to fastembed.SparseTextEmbedding
Raises:
ValueError: If the model_name is not supported in SparseTextEmbedding.
diff --git a/libs/partners/qdrant/langchain_qdrant/vectorstores.py b/libs/partners/qdrant/langchain_qdrant/vectorstores.py
index 47f6c61e06..1099dc546c 100644
--- a/libs/partners/qdrant/langchain_qdrant/vectorstores.py
+++ b/libs/partners/qdrant/langchain_qdrant/vectorstores.py
@@ -238,7 +238,7 @@ class Qdrant(VectorStore):
Args:
query: Text to look up documents similar to.
k: Number of Documents to return. Defaults to 4.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
search_params: Additional search params
offset:
Offset of the first result to return.
@@ -293,7 +293,7 @@ class Qdrant(VectorStore):
Args:
query: Text to look up documents similar to.
k: Number of Documents to return. Defaults to 4.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
**kwargs: Additional keyword arguments.
Returns:
@@ -319,7 +319,7 @@ class Qdrant(VectorStore):
Args:
query: Text to look up documents similar to.
k: Number of Documents to return. Defaults to 4.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
search_params: Additional search params
offset:
Offset of the first result to return.
@@ -377,7 +377,7 @@ class Qdrant(VectorStore):
Args:
query: Text to look up documents similar to.
k: Number of Documents to return. Defaults to 4.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
search_params: Additional search params
offset:
Offset of the first result to return.
@@ -436,7 +436,7 @@ class Qdrant(VectorStore):
Args:
embedding: Embedding vector to look up documents similar to.
k: Number of Documents to return. Defaults to 4.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
search_params: Additional search params
offset:
Offset of the first result to return.
@@ -495,7 +495,7 @@ class Qdrant(VectorStore):
Args:
embedding: Embedding vector to look up documents similar to.
k: Number of Documents to return. Defaults to 4.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
search_params: Additional search params
offset:
Offset of the first result to return.
@@ -554,7 +554,7 @@ class Qdrant(VectorStore):
Args:
embedding: Embedding vector to look up documents similar to.
k: Number of Documents to return. Defaults to 4.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
search_params: Additional search params
offset:
Offset of the first result to return.
@@ -643,7 +643,7 @@ class Qdrant(VectorStore):
Args:
embedding: Embedding vector to look up documents similar to.
k: Number of Documents to return. Defaults to 4.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
search_params: Additional search params
offset:
Offset of the first result to return.
@@ -745,7 +745,7 @@ class Qdrant(VectorStore):
lambda_mult: Number between 0 and 1 that determines the degree
of diversity among the results with 0 corresponding to maximum diversity
and 1 to minimum diversity.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
search_params: Additional search params
score_threshold:
Define a minimal score threshold for the result.
@@ -810,7 +810,7 @@ class Qdrant(VectorStore):
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
search_params: Additional search params
score_threshold:
Define a minimal score threshold for the result.
@@ -875,7 +875,7 @@ class Qdrant(VectorStore):
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
search_params: Additional search params
score_threshold:
Define a minimal score threshold for the result.
@@ -940,7 +940,7 @@ class Qdrant(VectorStore):
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
search_params: Additional search params
score_threshold:
Define a minimal score threshold for the result.
@@ -1007,7 +1007,7 @@ class Qdrant(VectorStore):
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
search_params: Additional search params
score_threshold:
Define a minimal score threshold for the result.
@@ -1099,7 +1099,7 @@ class Qdrant(VectorStore):
of diversity among the results with 0 corresponding
to maximum diversity and 1 to minimum diversity.
Defaults to 0.5.
- filter: Filter by metadata. Defaults to `None`.
+ filter: Filter by metadata.
search_params: Additional search params.
score_threshold: Define a minimal score threshold for the result.
consistency: Read consistency of the search.