docs: remove type in parens from docstrings + use tables for args (#4497)

Adhering to google style format so that mkdocs can pick up + format
args. Also, these types easily get out of date, so nice to remove from
that perspective as well.

Before:

<img width="710" alt="Screenshot 2025-05-01 at 2 01 55 PM"
src="https://github.com/user-attachments/assets/9ad0b33e-5d2c-43c2-9e7c-bf3fc6a6dffe"
/>

After:

<img width="729" alt="Screenshot 2025-05-01 at 2 01 24 PM"
src="https://github.com/user-attachments/assets/97e94d54-41f0-4946-9677-0c5d6400d62b"
/>
This commit is contained in:
Sydney Runkle
2025-05-01 14:08:52 -04:00
committed by GitHub
23 changed files with 270 additions and 271 deletions
+1 -1
View File
@@ -58,4 +58,4 @@ To delete cassettes for a notebook, you can run:
```bash
rm cassettes/<notebook_name>*
```
```
+1 -1
View File
@@ -78,7 +78,7 @@ plugins:
inherited_members: true
selection:
docstring_style: google
docstring_section_style: list
docstring_section_style: table
show_root_toc_entry: false
show_signature: true
show_signature_annotations: true
@@ -56,8 +56,8 @@ class PostgresSaver(BasePostgresSaver):
"""Create a new PostgresSaver instance from a connection string.
Args:
conn_string (str): The Postgres connection info string.
pipeline (bool): whether to use Pipeline
conn_string: The Postgres connection info string.
pipeline: whether to use Pipeline
Returns:
PostgresSaver: A new PostgresSaver instance.
@@ -111,10 +111,10 @@ class PostgresSaver(BasePostgresSaver):
on the provided config. The checkpoints are ordered by checkpoint ID in descending order (newest first).
Args:
config (RunnableConfig): The config to use for listing the checkpoints.
filter (Optional[Dict[str, Any]]): Additional filtering criteria for metadata. Defaults to None.
before (Optional[RunnableConfig]): If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit (Optional[int]): The maximum number of checkpoints to return. Defaults to None.
config: The config to use for listing the checkpoints.
filter: Additional filtering criteria for metadata. Defaults to None.
before: If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit: The maximum number of checkpoints to return. Defaults to None.
Yields:
Iterator[CheckpointTuple]: An iterator of checkpoint tuples.
@@ -182,7 +182,7 @@ class PostgresSaver(BasePostgresSaver):
for the given thread ID is retrieved.
Args:
config (RunnableConfig): The config to use for retrieving the checkpoint.
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
@@ -267,10 +267,10 @@ class PostgresSaver(BasePostgresSaver):
with the provided config and its parent config (if any).
Args:
config (RunnableConfig): The config to associate with the checkpoint.
checkpoint (Checkpoint): The checkpoint to save.
metadata (CheckpointMetadata): Additional metadata to save with the checkpoint.
new_versions (ChannelVersions): New channel versions as of this write.
config: The config to associate with the checkpoint.
checkpoint: The checkpoint to save.
metadata: Additional metadata to save with the checkpoint.
new_versions: New channel versions as of this write.
Returns:
RunnableConfig: Updated configuration after storing the checkpoint.
@@ -337,9 +337,9 @@ class PostgresSaver(BasePostgresSaver):
This method saves intermediate writes associated with a checkpoint to the Postgres database.
Args:
config (RunnableConfig): Configuration of the related checkpoint.
writes (List[Tuple[str, Any]]): List of writes to store.
task_id (str): Identifier for the task creating the writes.
config: Configuration of the related checkpoint.
writes: List of writes to store.
task_id: Identifier for the task creating the writes.
"""
query = (
self.UPSERT_CHECKPOINT_WRITES_SQL
@@ -363,7 +363,7 @@ class PostgresSaver(BasePostgresSaver):
"""Delete all checkpoints and writes associated with a thread ID.
Args:
thread_id (str): The thread ID to delete.
thread_id: The thread ID to delete.
Returns:
None
@@ -387,7 +387,7 @@ class PostgresSaver(BasePostgresSaver):
"""Create a database cursor as a context manager.
Args:
pipeline (bool): whether to use pipeline for the DB operations inside the context manager.
pipeline: whether to use pipeline for the DB operations inside the context manager.
Will be applied regardless of whether the PostgresSaver instance was initialized with a pipeline.
If pipeline mode is not supported, will fall back to using transaction context manager.
"""
@@ -61,8 +61,8 @@ class AsyncPostgresSaver(BasePostgresSaver):
"""Create a new AsyncPostgresSaver instance from a connection string.
Args:
conn_string (str): The Postgres connection info string.
pipeline (bool): whether to use AsyncPipeline
conn_string: The Postgres connection info string.
pipeline: whether to use AsyncPipeline
Returns:
AsyncPostgresSaver: A new AsyncPostgresSaver instance.
@@ -116,10 +116,10 @@ class AsyncPostgresSaver(BasePostgresSaver):
on the provided config. The checkpoints are ordered by checkpoint ID in descending order (newest first).
Args:
config (Optional[RunnableConfig]): Base configuration for filtering checkpoints.
filter (Optional[Dict[str, Any]]): Additional filtering criteria for metadata.
before (Optional[RunnableConfig]): If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit (Optional[int]): Maximum number of checkpoints to return.
config: Base configuration for filtering checkpoints.
filter: Additional filtering criteria for metadata.
before: If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit: Maximum number of checkpoints to return.
Yields:
AsyncIterator[CheckpointTuple]: An asynchronous iterator of matching checkpoint tuples.
@@ -170,7 +170,7 @@ class AsyncPostgresSaver(BasePostgresSaver):
for the given thread ID is retrieved.
Args:
config (RunnableConfig): The config to use for retrieving the checkpoint.
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
@@ -235,10 +235,10 @@ class AsyncPostgresSaver(BasePostgresSaver):
with the provided config and its parent config (if any).
Args:
config (RunnableConfig): The config to associate with the checkpoint.
checkpoint (Checkpoint): The checkpoint to save.
metadata (CheckpointMetadata): Additional metadata to save with the checkpoint.
new_versions (ChannelVersions): New channel versions as of this write.
config: The config to associate with the checkpoint.
checkpoint: The checkpoint to save.
metadata: Additional metadata to save with the checkpoint.
new_versions: New channel versions as of this write.
Returns:
RunnableConfig: Updated configuration after storing the checkpoint.
@@ -295,9 +295,9 @@ class AsyncPostgresSaver(BasePostgresSaver):
This method saves intermediate writes associated with a checkpoint to the database.
Args:
config (RunnableConfig): Configuration of the related checkpoint.
writes (Sequence[Tuple[str, Any]]): List of writes to store, each as (channel, value) pair.
task_id (str): Identifier for the task creating the writes.
config: Configuration of the related checkpoint.
writes: List of writes to store, each as (channel, value) pair.
task_id: Identifier for the task creating the writes.
"""
query = (
self.UPSERT_CHECKPOINT_WRITES_SQL
@@ -320,7 +320,7 @@ class AsyncPostgresSaver(BasePostgresSaver):
"""Delete all checkpoints and writes associated with a thread ID.
Args:
thread_id (str): The thread ID to delete.
thread_id: The thread ID to delete.
Returns:
None
@@ -346,7 +346,7 @@ class AsyncPostgresSaver(BasePostgresSaver):
"""Create a database cursor as a context manager.
Args:
pipeline (bool): whether to use pipeline for the DB operations inside the context manager.
pipeline: whether to use pipeline for the DB operations inside the context manager.
Will be applied regardless of whether the AsyncPostgresSaver instance was initialized with a pipeline.
If pipeline mode is not supported, will fall back to using transaction context manager.
"""
@@ -400,10 +400,10 @@ class AsyncPostgresSaver(BasePostgresSaver):
on the provided config. The checkpoints are ordered by checkpoint ID in descending order (newest first).
Args:
config (Optional[RunnableConfig]): Base configuration for filtering checkpoints.
filter (Optional[Dict[str, Any]]): Additional filtering criteria for metadata.
before (Optional[RunnableConfig]): If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit (Optional[int]): Maximum number of checkpoints to return.
config: Base configuration for filtering checkpoints.
filter: Additional filtering criteria for metadata.
before: If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit: Maximum number of checkpoints to return.
Yields:
Iterator[CheckpointTuple]: An iterator of matching checkpoint tuples.
@@ -439,7 +439,7 @@ class AsyncPostgresSaver(BasePostgresSaver):
for the given thread ID is retrieved.
Args:
config (RunnableConfig): The config to use for retrieving the checkpoint.
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
@@ -473,10 +473,10 @@ class AsyncPostgresSaver(BasePostgresSaver):
with the provided config and its parent config (if any).
Args:
config (RunnableConfig): The config to associate with the checkpoint.
checkpoint (Checkpoint): The checkpoint to save.
metadata (CheckpointMetadata): Additional metadata to save with the checkpoint.
new_versions (ChannelVersions): New channel versions as of this write.
config: The config to associate with the checkpoint.
checkpoint: The checkpoint to save.
metadata: Additional metadata to save with the checkpoint.
new_versions: New channel versions as of this write.
Returns:
RunnableConfig: Updated configuration after storing the checkpoint.
@@ -497,10 +497,10 @@ class AsyncPostgresSaver(BasePostgresSaver):
This method saves intermediate writes associated with a checkpoint to the database.
Args:
config (RunnableConfig): Configuration of the related checkpoint.
writes (Sequence[Tuple[str, Any]]): List of writes to store, each as (channel, value) pair.
task_id (str): Identifier for the task creating the writes.
task_path (str): Path of the task creating the writes.
config: Configuration of the related checkpoint.
writes: List of writes to store, each as (channel, value) pair.
task_id: Identifier for the task creating the writes.
task_path: Path of the task creating the writes.
"""
return asyncio.run_coroutine_threadsafe(
self.aput_writes(config, writes, task_id, task_path), self.loop
@@ -510,7 +510,7 @@ class AsyncPostgresSaver(BasePostgresSaver):
"""Delete all checkpoints and writes associated with a thread ID.
Args:
thread_id (str): The thread ID to delete.
thread_id: The thread ID to delete.
Returns:
None
@@ -214,8 +214,8 @@ class ShallowPostgresSaver(BasePostgresSaver):
"""Create a new ShallowPostgresSaver instance from a connection string.
Args:
conn_string (str): The Postgres connection info string.
pipeline (bool): whether to use Pipeline
conn_string: The Postgres connection info string.
pipeline: whether to use Pipeline
Returns:
ShallowPostgresSaver: A new ShallowPostgresSaver instance.
@@ -301,7 +301,7 @@ class ShallowPostgresSaver(BasePostgresSaver):
provided config (matching the thread ID in the config).
Args:
config (RunnableConfig): The config to use for retrieving the checkpoint.
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
@@ -372,10 +372,10 @@ class ShallowPostgresSaver(BasePostgresSaver):
checkpoint and overwrites a previous checkpoint, if it exists.
Args:
config (RunnableConfig): The config to associate with the checkpoint.
checkpoint (Checkpoint): The checkpoint to save.
metadata (CheckpointMetadata): Additional metadata to save with the checkpoint.
new_versions (ChannelVersions): New channel versions as of this write.
config: The config to associate with the checkpoint.
checkpoint: The checkpoint to save.
metadata: Additional metadata to save with the checkpoint.
new_versions: New channel versions as of this write.
Returns:
RunnableConfig: Updated configuration after storing the checkpoint.
@@ -448,9 +448,9 @@ class ShallowPostgresSaver(BasePostgresSaver):
This method saves intermediate writes associated with a checkpoint to the Postgres database.
Args:
config (RunnableConfig): Configuration of the related checkpoint.
writes (List[Tuple[str, Any]]): List of writes to store.
task_id (str): Identifier for the task creating the writes.
config: Configuration of the related checkpoint.
writes: List of writes to store.
task_id: Identifier for the task creating the writes.
"""
query = (
self.UPSERT_CHECKPOINT_WRITES_SQL
@@ -475,7 +475,7 @@ class ShallowPostgresSaver(BasePostgresSaver):
"""Create a database cursor as a context manager.
Args:
pipeline (bool): whether to use pipeline for the DB operations inside the context manager.
pipeline: whether to use pipeline for the DB operations inside the context manager.
Will be applied regardless of whether the ShallowPostgresSaver instance was initialized with a pipeline.
If pipeline mode is not supported, will fall back to using transaction context manager.
"""
@@ -565,8 +565,8 @@ class AsyncShallowPostgresSaver(BasePostgresSaver):
"""Create a new AsyncShallowPostgresSaver instance from a connection string.
Args:
conn_string (str): The Postgres connection info string.
pipeline (bool): whether to use AsyncPipeline
conn_string: The Postgres connection info string.
pipeline: whether to use AsyncPipeline
Returns:
AsyncShallowPostgresSaver: A new AsyncShallowPostgresSaver instance.
@@ -655,7 +655,7 @@ class AsyncShallowPostgresSaver(BasePostgresSaver):
provided config (matching the thread ID in the config).
Args:
config (RunnableConfig): The config to use for retrieving the checkpoint.
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
@@ -708,10 +708,10 @@ class AsyncShallowPostgresSaver(BasePostgresSaver):
checkpoint and overwrites a previous checkpoint, if it exists.
Args:
config (RunnableConfig): The config to associate with the checkpoint.
checkpoint (Checkpoint): The checkpoint to save.
metadata (CheckpointMetadata): Additional metadata to save with the checkpoint.
new_versions (ChannelVersions): New channel versions as of this write.
config: The config to associate with the checkpoint.
checkpoint: The checkpoint to save.
metadata: Additional metadata to save with the checkpoint.
new_versions: New channel versions as of this write.
Returns:
RunnableConfig: Updated configuration after storing the checkpoint.
@@ -773,9 +773,9 @@ class AsyncShallowPostgresSaver(BasePostgresSaver):
This method saves intermediate writes associated with a checkpoint to the database.
Args:
config (RunnableConfig): Configuration of the related checkpoint.
writes (Sequence[Tuple[str, Any]]): List of writes to store, each as (channel, value) pair.
task_id (str): Identifier for the task creating the writes.
config: Configuration of the related checkpoint.
writes: List of writes to store, each as (channel, value) pair.
task_id: Identifier for the task creating the writes.
"""
query = (
self.UPSERT_CHECKPOINT_WRITES_SQL
@@ -801,7 +801,7 @@ class AsyncShallowPostgresSaver(BasePostgresSaver):
"""Create a database cursor as a context manager.
Args:
pipeline (bool): whether to use pipeline for the DB operations inside the context manager.
pipeline: whether to use pipeline for the DB operations inside the context manager.
Will be applied regardless of whether the AsyncShallowPostgresSaver instance was initialized with a pipeline.
If pipeline mode is not supported, will fall back to using transaction context manager.
"""
@@ -872,7 +872,7 @@ class AsyncShallowPostgresSaver(BasePostgresSaver):
provided config (matching the thread ID in the config).
Args:
config (RunnableConfig): The config to use for retrieving the checkpoint.
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
@@ -907,10 +907,10 @@ class AsyncShallowPostgresSaver(BasePostgresSaver):
checkpoint and overwrites a previous checkpoint, if it exists.
Args:
config (RunnableConfig): The config to associate with the checkpoint.
checkpoint (Checkpoint): The checkpoint to save.
metadata (CheckpointMetadata): Additional metadata to save with the checkpoint.
new_versions (ChannelVersions): New channel versions as of this write.
config: The config to associate with the checkpoint.
checkpoint: The checkpoint to save.
metadata: Additional metadata to save with the checkpoint.
new_versions: New channel versions as of this write.
Returns:
RunnableConfig: Updated configuration after storing the checkpoint.
@@ -931,10 +931,10 @@ class AsyncShallowPostgresSaver(BasePostgresSaver):
This method saves intermediate writes associated with a checkpoint to the database.
Args:
config (RunnableConfig): Configuration of the related checkpoint.
writes (Sequence[Tuple[str, Any]]): List of writes to store, each as (channel, value) pair.
task_id (str): Identifier for the task creating the writes.
task_path (str): Path of the task creating the writes.
config: Configuration of the related checkpoint.
writes: List of writes to store, each as (channel, value) pair.
task_id: Identifier for the task creating the writes.
task_path: Path of the task creating the writes.
"""
return asyncio.run_coroutine_threadsafe(
self.aput_writes(config, writes, task_id, task_path), self.loop
@@ -187,12 +187,12 @@ class AsyncPostgresStore(AsyncBatchedBaseStore, BasePostgresStore[_ainternal.Con
"""Create a new AsyncPostgresStore instance from a connection string.
Args:
conn_string (str): The Postgres connection info string.
pipeline (bool): Whether to use AsyncPipeline (only for single connections)
pool_config (Optional[PoolConfig]): Configuration for the connection pool.
conn_string: The Postgres connection info string.
pipeline: Whether to use AsyncPipeline (only for single connections)
pool_config: Configuration for the connection pool.
If provided, will create a connection pool and use it instead of a single connection.
This overrides the `pipeline` argument.
index (Optional[PostgresIndexConfig]): The embedding config.
index: The embedding config.
Returns:
AsyncPostgresStore: A new AsyncPostgresStore instance.
@@ -755,12 +755,12 @@ class PostgresStore(BaseStore, BasePostgresStore[_pg_internal.Conn]):
"""Create a new PostgresStore instance from a connection string.
Args:
conn_string (str): The Postgres connection info string.
pipeline (bool): whether to use Pipeline
pool_config (Optional[PoolArgs]): Configuration for the connection pool.
conn_string: The Postgres connection info string.
pipeline: whether to use Pipeline
pool_config: Configuration for the connection pool.
If provided, will create a connection pool and use it instead of a single connection.
This overrides the `pipeline` argument.
index (Optional[PostgresIndexConfig]): The index configuration for the store.
index: The index configuration for the store.
Returns:
PostgresStore: A new PostgresStore instance.
@@ -905,7 +905,7 @@ class PostgresStore(BaseStore, BasePostgresStore[_pg_internal.Conn]):
"""Create a database cursor as a context manager.
Args:
pipeline (bool): whether to use pipeline for the DB operations inside the context manager.
pipeline: whether to use pipeline for the DB operations inside the context manager.
Will be applied regardless of whether the PostgresStore instance was initialized with a pipeline.
If pipeline mode is not supported, will fall back to using transaction context manager.
"""
@@ -90,7 +90,7 @@ class SqliteSaver(BaseCheckpointSaver[str]):
"""Create a new SqliteSaver instance from a connection string.
Args:
conn_string (str): The SQLite connection string.
conn_string: The SQLite connection string.
Yields:
SqliteSaver: A new SqliteSaver instance.
@@ -187,7 +187,7 @@ class SqliteSaver(BaseCheckpointSaver[str]):
for the given thread ID is retrieved.
Args:
config (RunnableConfig): The config to use for retrieving the checkpoint.
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
@@ -293,10 +293,10 @@ class SqliteSaver(BaseCheckpointSaver[str]):
on the provided config. The checkpoints are ordered by checkpoint ID in descending order (newest first).
Args:
config (RunnableConfig): The config to use for listing the checkpoints.
filter (Optional[Dict[str, Any]]): Additional filtering criteria for metadata. Defaults to None.
before (Optional[RunnableConfig]): If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit (Optional[int]): The maximum number of checkpoints to return. Defaults to None.
config: The config to use for listing the checkpoints.
filter: Additional filtering criteria for metadata. Defaults to None.
before: If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit: The maximum number of checkpoints to return. Defaults to None.
Yields:
Iterator[CheckpointTuple]: An iterator of checkpoint tuples.
@@ -380,10 +380,10 @@ class SqliteSaver(BaseCheckpointSaver[str]):
with the provided config and its parent config (if any).
Args:
config (RunnableConfig): The config to associate with the checkpoint.
checkpoint (Checkpoint): The checkpoint to save.
metadata (CheckpointMetadata): Additional metadata to save with the checkpoint.
new_versions (ChannelVersions): New channel versions as of this write.
config: The config to associate with the checkpoint.
checkpoint: The checkpoint to save.
metadata: Additional metadata to save with the checkpoint.
new_versions: New channel versions as of this write.
Returns:
RunnableConfig: Updated configuration after storing the checkpoint.
@@ -437,10 +437,10 @@ class SqliteSaver(BaseCheckpointSaver[str]):
This method saves intermediate writes associated with a checkpoint to the SQLite database.
Args:
config (RunnableConfig): Configuration of the related checkpoint.
writes (Sequence[Tuple[str, Any]]): List of writes to store, each as (channel, value) pair.
task_id (str): Identifier for the task creating the writes.
task_path (str): Path of the task creating the writes.
config: Configuration of the related checkpoint.
writes: List of writes to store, each as (channel, value) pair.
task_id: Identifier for the task creating the writes.
task_path: Path of the task creating the writes.
"""
query = (
"INSERT OR REPLACE INTO writes (thread_id, checkpoint_ns, checkpoint_id, task_id, idx, channel, type, value) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
@@ -468,7 +468,7 @@ class SqliteSaver(BaseCheckpointSaver[str]):
"""Delete all checkpoints and writes associated with a thread ID.
Args:
thread_id (str): The thread ID to delete.
thread_id: The thread ID to delete.
Returns:
None
@@ -126,7 +126,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
"""Create a new AsyncSqliteSaver instance from a connection string.
Args:
conn_string (str): The SQLite connection string.
conn_string: The SQLite connection string.
Yields:
AsyncSqliteSaver: A new AsyncSqliteSaver instance.
@@ -143,7 +143,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
for the given thread ID is retrieved.
Args:
config (RunnableConfig): The config to use for retrieving the checkpoint.
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
@@ -178,10 +178,10 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
on the provided config. The checkpoints are ordered by checkpoint ID in descending order (newest first).
Args:
config (Optional[RunnableConfig]): Base configuration for filtering checkpoints.
filter (Optional[Dict[str, Any]]): Additional filtering criteria for metadata.
before (Optional[RunnableConfig]): If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit (Optional[int]): Maximum number of checkpoints to return.
config: Base configuration for filtering checkpoints.
filter: Additional filtering criteria for metadata.
before: If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit: Maximum number of checkpoints to return.
Yields:
Iterator[CheckpointTuple]: An iterator of matching checkpoint tuples.
@@ -221,10 +221,10 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
with the provided config and its parent config (if any).
Args:
config (RunnableConfig): The config to associate with the checkpoint.
checkpoint (Checkpoint): The checkpoint to save.
metadata (CheckpointMetadata): Additional metadata to save with the checkpoint.
new_versions (ChannelVersions): New channel versions as of this write.
config: The config to associate with the checkpoint.
checkpoint: The checkpoint to save.
metadata: Additional metadata to save with the checkpoint.
new_versions: New channel versions as of this write.
Returns:
RunnableConfig: Updated configuration after storing the checkpoint.
@@ -248,7 +248,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
"""Delete all checkpoints and writes associated with a thread ID.
Args:
thread_id (str): The thread ID to delete.
thread_id: The thread ID to delete.
Returns:
None
@@ -320,7 +320,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
for the given thread ID is retrieved.
Args:
config (RunnableConfig): The config to use for retrieving the checkpoint.
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
@@ -406,10 +406,10 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
on the provided config. The checkpoints are ordered by checkpoint ID in descending order (newest first).
Args:
config (Optional[RunnableConfig]): Base configuration for filtering checkpoints.
filter (Optional[Dict[str, Any]]): Additional filtering criteria for metadata.
before (Optional[RunnableConfig]): If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit (Optional[int]): Maximum number of checkpoints to return.
config: Base configuration for filtering checkpoints.
filter: Additional filtering criteria for metadata.
before: If provided, only checkpoints before the specified checkpoint ID are returned. Defaults to None.
limit: Maximum number of checkpoints to return.
Yields:
AsyncIterator[CheckpointTuple]: An asynchronous iterator of matching checkpoint tuples.
@@ -480,10 +480,10 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
with the provided config and its parent config (if any).
Args:
config (RunnableConfig): The config to associate with the checkpoint.
checkpoint (Checkpoint): The checkpoint to save.
metadata (CheckpointMetadata): Additional metadata to save with the checkpoint.
new_versions (ChannelVersions): New channel versions as of this write.
config: The config to associate with the checkpoint.
checkpoint: The checkpoint to save.
metadata: Additional metadata to save with the checkpoint.
new_versions: New channel versions as of this write.
Returns:
RunnableConfig: Updated configuration after storing the checkpoint.
@@ -531,10 +531,10 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
This method saves intermediate writes associated with a checkpoint to the database.
Args:
config (RunnableConfig): Configuration of the related checkpoint.
writes (Sequence[Tuple[str, Any]]): List of writes to store, each as (channel, value) pair.
task_id (str): Identifier for the task creating the writes.
task_path (str): Path of the task creating the writes.
config: Configuration of the related checkpoint.
writes: List of writes to store, each as (channel, value) pair.
task_id: Identifier for the task creating the writes.
task_path: Path of the task creating the writes.
"""
query = (
"INSERT OR REPLACE INTO writes (thread_id, checkpoint_ns, checkpoint_id, task_id, idx, channel, type, value) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
@@ -564,7 +564,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
"""Delete all checkpoints and writes associated with a thread ID.
Args:
thread_id (str): The thread ID to delete.
thread_id: The thread ID to delete.
Returns:
None
@@ -232,7 +232,7 @@ class BaseCheckpointSaver(Generic[V]):
"""Fetch a checkpoint using the given configuration.
Args:
config (RunnableConfig): Configuration specifying which checkpoint to retrieve.
config: Configuration specifying which checkpoint to retrieve.
Returns:
Optional[Checkpoint]: The requested checkpoint, or None if not found.
@@ -244,7 +244,7 @@ class BaseCheckpointSaver(Generic[V]):
"""Fetch a checkpoint tuple using the given configuration.
Args:
config (RunnableConfig): Configuration specifying which checkpoint to retrieve.
config: Configuration specifying which checkpoint to retrieve.
Returns:
Optional[CheckpointTuple]: The requested checkpoint tuple, or None if not found.
@@ -265,10 +265,10 @@ class BaseCheckpointSaver(Generic[V]):
"""List checkpoints that match the given criteria.
Args:
config (Optional[RunnableConfig]): Base configuration for filtering checkpoints.
filter (Optional[Dict[str, Any]]): Additional filtering criteria.
before (Optional[RunnableConfig]): List checkpoints created before this configuration.
limit (Optional[int]): Maximum number of checkpoints to return.
config: Base configuration for filtering checkpoints.
filter: Additional filtering criteria.
before: List checkpoints created before this configuration.
limit: Maximum number of checkpoints to return.
Returns:
Iterator[CheckpointTuple]: Iterator of matching checkpoint tuples.
@@ -288,10 +288,10 @@ class BaseCheckpointSaver(Generic[V]):
"""Store a checkpoint with its configuration and metadata.
Args:
config (RunnableConfig): Configuration for the checkpoint.
checkpoint (Checkpoint): The checkpoint to store.
metadata (CheckpointMetadata): Additional metadata for the checkpoint.
new_versions (ChannelVersions): New channel versions as of this write.
config: Configuration for the checkpoint.
checkpoint: The checkpoint to store.
metadata: Additional metadata for the checkpoint.
new_versions: New channel versions as of this write.
Returns:
RunnableConfig: Updated configuration after storing the checkpoint.
@@ -311,10 +311,10 @@ class BaseCheckpointSaver(Generic[V]):
"""Store intermediate writes linked to a checkpoint.
Args:
config (RunnableConfig): Configuration of the related checkpoint.
writes (List[Tuple[str, Any]]): List of writes to store.
task_id (str): Identifier for the task creating the writes.
task_path (str): Path of the task creating the writes.
config: Configuration of the related checkpoint.
writes: List of writes to store.
task_id: Identifier for the task creating the writes.
task_path: Path of the task creating the writes.
Raises:
NotImplementedError: Implement this method in your custom checkpoint saver.
@@ -328,7 +328,7 @@ class BaseCheckpointSaver(Generic[V]):
"""Delete all checkpoints and writes associated with a specific thread ID.
Args:
thread_id (str): The thread ID whose checkpoints should be deleted.
thread_id: The thread ID whose checkpoints should be deleted.
"""
raise NotImplementedError
@@ -336,7 +336,7 @@ class BaseCheckpointSaver(Generic[V]):
"""Asynchronously fetch a checkpoint using the given configuration.
Args:
config (RunnableConfig): Configuration specifying which checkpoint to retrieve.
config: Configuration specifying which checkpoint to retrieve.
Returns:
Optional[Checkpoint]: The requested checkpoint, or None if not found.
@@ -348,7 +348,7 @@ class BaseCheckpointSaver(Generic[V]):
"""Asynchronously fetch a checkpoint tuple using the given configuration.
Args:
config (RunnableConfig): Configuration specifying which checkpoint to retrieve.
config: Configuration specifying which checkpoint to retrieve.
Returns:
Optional[CheckpointTuple]: The requested checkpoint tuple, or None if not found.
@@ -369,10 +369,10 @@ class BaseCheckpointSaver(Generic[V]):
"""Asynchronously list checkpoints that match the given criteria.
Args:
config (Optional[RunnableConfig]): Base configuration for filtering checkpoints.
filter (Optional[Dict[str, Any]]): Additional filtering criteria for metadata.
before (Optional[RunnableConfig]): List checkpoints created before this configuration.
limit (Optional[int]): Maximum number of checkpoints to return.
config: Base configuration for filtering checkpoints.
filter: Additional filtering criteria for metadata.
before: List checkpoints created before this configuration.
limit: Maximum number of checkpoints to return.
Returns:
AsyncIterator[CheckpointTuple]: Async iterator of matching checkpoint tuples.
@@ -393,10 +393,10 @@ class BaseCheckpointSaver(Generic[V]):
"""Asynchronously store a checkpoint with its configuration and metadata.
Args:
config (RunnableConfig): Configuration for the checkpoint.
checkpoint (Checkpoint): The checkpoint to store.
metadata (CheckpointMetadata): Additional metadata for the checkpoint.
new_versions (ChannelVersions): New channel versions as of this write.
config: Configuration for the checkpoint.
checkpoint: The checkpoint to store.
metadata: Additional metadata for the checkpoint.
new_versions: New channel versions as of this write.
Returns:
RunnableConfig: Updated configuration after storing the checkpoint.
@@ -416,10 +416,10 @@ class BaseCheckpointSaver(Generic[V]):
"""Asynchronously store intermediate writes linked to a checkpoint.
Args:
config (RunnableConfig): Configuration of the related checkpoint.
writes (List[Tuple[str, Any]]): List of writes to store.
task_id (str): Identifier for the task creating the writes.
task_path (str): Path of the task creating the writes.
config: Configuration of the related checkpoint.
writes: List of writes to store.
task_id: Identifier for the task creating the writes.
task_path: Path of the task creating the writes.
Raises:
NotImplementedError: Implement this method in your custom checkpoint saver.
@@ -433,7 +433,7 @@ class BaseCheckpointSaver(Generic[V]):
"""Delete all checkpoints and writes associated with a specific thread ID.
Args:
thread_id (str): The thread ID whose checkpoints should be deleted.
thread_id: The thread ID whose checkpoints should be deleted.
"""
raise NotImplementedError
@@ -444,8 +444,8 @@ class BaseCheckpointSaver(Generic[V]):
as long as they are monotonically increasing.
Args:
current (Optional[V]): The current version identifier (int, float, or str).
channel (BaseChannel): The channel being versioned.
current: The current version identifier (int, float, or str).
channel: The channel being versioned.
Returns:
V: The next version identifier, which must be increasing.
@@ -41,7 +41,7 @@ class InMemorySaver(
If you are using the LangGraph Platform, no checkpointer needs to be specified. The correct managed checkpointer will be used automatically.
Args:
serde (Optional[SerializerProtocol]): The serializer to use for serializing and deserializing checkpoints. Defaults to None.
serde: The serializer to use for serializing and deserializing checkpoints. Defaults to None.
Examples:
@@ -138,7 +138,7 @@ class InMemorySaver(
for the given thread ID is retrieved.
Args:
config (RunnableConfig): The config to use for retrieving the checkpoint.
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
@@ -255,10 +255,10 @@ class InMemorySaver(
on the provided criteria.
Args:
config (Optional[RunnableConfig]): Base configuration for filtering checkpoints.
filter (Optional[Dict[str, Any]]): Additional filtering criteria for metadata.
before (Optional[RunnableConfig]): List checkpoints created before this configuration.
limit (Optional[int]): Maximum number of checkpoints to return.
config: Base configuration for filtering checkpoints.
filter: Additional filtering criteria for metadata.
before: List checkpoints created before this configuration.
limit: Maximum number of checkpoints to return.
Yields:
Iterator[CheckpointTuple]: An iterator of matching checkpoint tuples.
@@ -380,10 +380,10 @@ class InMemorySaver(
with the provided config.
Args:
config (RunnableConfig): The config to associate with the checkpoint.
checkpoint (Checkpoint): The checkpoint to save.
metadata (CheckpointMetadata): Additional metadata to save with the checkpoint.
new_versions (dict): New versions as of this write
config: The config to associate with the checkpoint.
checkpoint: The checkpoint to save.
metadata: Additional metadata to save with the checkpoint.
new_versions: New versions as of this write
Returns:
RunnableConfig: The updated config containing the saved checkpoint's timestamp.
@@ -427,10 +427,10 @@ class InMemorySaver(
with the provided config.
Args:
config (RunnableConfig): The config to associate with the writes.
writes (list[tuple[str, Any]]): The writes to save.
task_id (str): Identifier for the task creating the writes.
task_path (str): Path of the task creating the writes.
config: The config to associate with the writes.
writes: The writes to save.
task_id: Identifier for the task creating the writes.
task_path: Path of the task creating the writes.
Returns:
RunnableConfig: The updated config containing the saved writes' timestamp.
@@ -456,7 +456,7 @@ class InMemorySaver(
"""Delete all checkpoints and writes associated with a thread ID.
Args:
thread_id (str): The thread ID to delete.
thread_id: The thread ID to delete.
Returns:
None
@@ -477,7 +477,7 @@ class InMemorySaver(
method in a separate thread using asyncio.
Args:
config (RunnableConfig): The config to use for retrieving the checkpoint.
config: The config to use for retrieving the checkpoint.
Returns:
Optional[CheckpointTuple]: The retrieved checkpoint tuple, or None if no matching checkpoint was found.
@@ -498,7 +498,7 @@ class InMemorySaver(
method in a separate thread using asyncio.
Args:
config (RunnableConfig): The config to use for listing the checkpoints.
config: The config to use for listing the checkpoints.
Yields:
AsyncIterator[CheckpointTuple]: An asynchronous iterator of checkpoint tuples.
@@ -516,10 +516,10 @@ class InMemorySaver(
"""Asynchronous version of put.
Args:
config (RunnableConfig): The config to associate with the checkpoint.
checkpoint (Checkpoint): The checkpoint to save.
metadata (CheckpointMetadata): Additional metadata to save with the checkpoint.
new_versions (dict): New versions as of this write
config: The config to associate with the checkpoint.
checkpoint: The checkpoint to save.
metadata: Additional metadata to save with the checkpoint.
new_versions: New versions as of this write
Returns:
RunnableConfig: The updated config containing the saved checkpoint's timestamp.
@@ -539,10 +539,10 @@ class InMemorySaver(
method in a separate thread using asyncio.
Args:
config (RunnableConfig): The config to associate with the writes.
writes (List[Tuple[str, Any]]): The writes to save, each as a (channel, value) pair.
task_id (str): Identifier for the task creating the writes.
task_path (str): Path of the task creating the writes.
config: The config to associate with the writes.
writes: The writes to save, each as a (channel, value) pair.
task_id: Identifier for the task creating the writes.
task_path: Path of the task creating the writes.
Returns:
None
@@ -553,7 +553,7 @@ class InMemorySaver(
"""Delete all checkpoints and writes associated with a thread ID.
Args:
thread_id (str): The thread ID to delete.
thread_id: The thread ID to delete.
Returns:
None
@@ -52,13 +52,13 @@ class Item:
"""Represents a stored item with metadata.
Args:
value (dict[str, Any]): The stored data as a dictionary. Keys are filterable.
key (str): Unique identifier within the namespace.
namespace (tuple[str, ...]): Hierarchical path defining the collection in which this document resides.
value: The stored data as a dictionary. Keys are filterable.
key: Unique identifier within the namespace.
namespace: Hierarchical path defining the collection in which this document resides.
Represented as a tuple of strings, allowing for nested categorization.
For example: ("documents", 'user123')
created_at (datetime): Timestamp of item creation.
updated_at (datetime): Timestamp of last update.
created_at: Timestamp of item creation.
updated_at: Timestamp of last update.
"""
__slots__ = ("value", "key", "namespace", "created_at", "updated_at")
@@ -913,12 +913,12 @@ class BaseStore(ABC):
find specific collections, or navigate the namespace hierarchy.
Args:
prefix (Optional[Tuple[str, ...]]): Filter namespaces that start with this path.
suffix (Optional[Tuple[str, ...]]): Filter namespaces that end with this path.
max_depth (Optional[int]): Return namespaces up to this depth in the hierarchy.
prefix: Filter namespaces that start with this path.
suffix: Filter namespaces that end with this path.
max_depth: Return namespaces up to this depth in the hierarchy.
Namespaces deeper than this level will be truncated.
limit (int): Maximum number of namespaces to return (default 100).
offset (int): Number of namespaces to skip for pagination (default 0).
limit: Maximum number of namespaces to return (default 100).
offset: Number of namespaces to skip for pagination (default 0).
Returns:
List[Tuple[str, ...]]: A list of namespace tuples that match the criteria.
@@ -1162,12 +1162,12 @@ class BaseStore(ABC):
find specific collections, or navigate the namespace hierarchy.
Args:
prefix (Optional[Tuple[str, ...]]): Filter namespaces that start with this path.
suffix (Optional[Tuple[str, ...]]): Filter namespaces that end with this path.
max_depth (Optional[int]): Return namespaces up to this depth in the hierarchy.
prefix: Filter namespaces that start with this path.
suffix: Filter namespaces that end with this path.
max_depth: Return namespaces up to this depth in the hierarchy.
Namespaces deeper than this level will be truncated to this depth.
limit (int): Maximum number of namespaces to return (default 100).
offset (int): Number of namespaces to skip for pagination (default 0).
limit: Maximum number of namespaces to return (default 100).
offset: Number of namespaces to skip for pagination (default 0).
Returns:
List[Tuple[str, ...]]: A list of namespace tuples that match the criteria.
+5 -5
View File
@@ -101,8 +101,8 @@ def _download_repo_with_requests(repo_url: str, path: str) -> None:
"""Download a ZIP archive from the given URL and extracts it to the specified path.
Args:
repo_url (str): The URL of the repository to download.
path (str): The path where the repository should be extracted.
repo_url: The URL of the repository to download.
path: The path where the repository should be extracted.
"""
click.secho("📥 Attempting to download repository as a ZIP archive...", fg="yellow")
click.secho(f"URL: {repo_url}", fg="yellow")
@@ -136,7 +136,7 @@ def _get_template_url(template_name: str) -> Optional[str]:
Retrieves the template URL based on the provided template name.
Args:
template_name (str): The name of the template.
template_name: The name of the template.
Returns:
Optional[str]: The URL of the template if found, else None.
@@ -166,8 +166,8 @@ def create_new(path: Optional[str], template: Optional[str]) -> None:
"""Create a new LangGraph project at the specified PATH using the chosen TEMPLATE.
Args:
path (Optional[str]): The path where the new project will be created.
template (Optional[str]): The name of the template to use.
path: The path where the new project will be created.
template: The name of the template to use.
"""
# Prompt for path if not provided
if not path:
+1 -1
View File
@@ -225,7 +225,7 @@ class entrypoint:
as its result is cached by the checkpointer.
Args:
topic (str): The subject of the essay.
topic: The subject of the essay.
Returns:
dict: A dictionary containing the generated essay and the human review.
+17 -17
View File
@@ -79,11 +79,11 @@ class Graph:
"""Add a new node to the graph.
Args:
node (Union[str, RunnableLike]): The function or runnable this node will run.
node: The function or runnable this node will run.
If a string is provided, it will be used as the node name, and action will be used as the function or runnable.
action (Optional[RunnableLike]): The action associated with the node. (default: None)
action: The action associated with the node. (default: None)
Will be used as the node function or runnable if `node` is a string (node name).
metadata (Optional[dict[str, Any]]): The metadata associated with the node. (default: None)
metadata: The metadata associated with the node. (default: None)
"""
if isinstance(node, str):
for character in (NS_SEP, NS_END):
@@ -122,8 +122,8 @@ class Graph:
"""Add a directed edge from the start node to the end node.
Args:
start_key (str): The key of the start node of the edge.
end_key (str): The key of the end node of the edge.
start_key: The key of the start node of the edge.
end_key: The key of the end node of the edge.
"""
if self.compiled:
logger.warning(
@@ -161,14 +161,14 @@ class Graph:
"""Add a conditional edge from the starting node to any number of destination nodes.
Args:
source (str): The starting node. This conditional edge will run when
source: The starting node. This conditional edge will run when
exiting this node.
path (Union[Callable, Runnable]): The callable that determines the next
path: The callable that determines the next
node or nodes. If not specifying `path_map` it should return one or
more nodes. If it returns END, the graph will stop execution.
path_map (Optional[dict[Hashable, str]]): Optional mapping of paths to node
path_map: Optional mapping of paths to node
names. If omitted the paths returned by `path` should be node names.
then (Optional[str]): The name of a node to execute after the nodes
then: The name of a node to execute after the nodes
selected by `path`.
Returns:
@@ -222,12 +222,12 @@ class Graph:
"""Sets a conditional entry point in the graph.
Args:
path (Union[Callable, Runnable]): The callable that determines the next
path: The callable that determines the next
node or nodes. If not specifying `path_map` it should return one or
more nodes. If it returns END, the graph will stop execution.
path_map (Optional[dict[str, str]]): Optional mapping of paths to node
path_map: Optional mapping of paths to node
names. If omitted the paths returned by `path` should be node names.
then (Optional[str]): The name of a node to execute after the nodes
then: The name of a node to execute after the nodes
selected by `path`.
Returns:
@@ -323,15 +323,15 @@ class Graph:
streamed, batched, and run asynchronously.
Args:
checkpointer (Optional[Union[Checkpointer, Literal[False]]]): A checkpoint saver object or flag.
checkpointer: A checkpoint saver object or flag.
If provided, this Checkpointer serves as a fully versioned "short-term memory" for the graph,
allowing it to be paused, resumed, and replayed from any point.
If None, it may inherit the parent graph's checkpointer when used as a subgraph.
If False, it will not use or inherit any checkpointer.
interrupt_before (Optional[Sequence[str]]): An optional list of node names to interrupt before.
interrupt_after (Optional[Sequence[str]]): An optional list of node names to interrupt after.
debug (bool): A flag indicating whether to enable debug mode.
name (Optional[str]): The name to use for the compiled graph.
interrupt_before: An optional list of node names to interrupt before.
interrupt_after: An optional list of node names to interrupt after.
debug: A flag indicating whether to enable debug mode.
name: The name to use for the compiled graph.
Returns:
CompiledGraph: The compiled graph.
+19 -19
View File
@@ -118,8 +118,8 @@ class StateGraph(Graph):
The signature of a reducer function is (Value, Value) -> Value.
Args:
state_schema (Type[Any]): The schema class that defines the state.
config_schema (Optional[Type[Any]]): The schema class that defines the configuration.
state_schema: The schema class that defines the state.
config_schema: The schema class that defines the configuration.
Use this to expose configurable parameters in your API.
Example:
@@ -284,15 +284,15 @@ class StateGraph(Graph):
"""Add a new node to the state graph.
Args:
node (Union[str, RunnableLike]): The function or runnable this node will run.
node: The function or runnable this node will run.
If a string is provided, it will be used as the node name, and action will be used as the function or runnable.
action (Optional[RunnableLike]): The action associated with the node. (default: None)
action: The action associated with the node. (default: None)
Will be used as the node function or runnable if `node` is a string (node name).
metadata (Optional[dict[str, Any]]): The metadata associated with the node. (default: None)
input (Optional[Type[Any]]): The input schema for the node. (default: the graph's input schema)
retry (Optional[Union[RetryPolicy, Sequence[RetryPolicy]]]): The policy for retrying the node. (default: None)
metadata: The metadata associated with the node. (default: None)
input: The input schema for the node. (default: the graph's input schema)
retry: The policy for retrying the node. (default: None)
If a sequence is provided, the first matching policy will be applied.
destinations (Optional[Union[dict[str, str], tuple[str, ...]]]): Destinations that indicate where a node can route to.
destinations: Destinations that indicate where a node can route to.
This is useful for edgeless graphs with nodes that return `Command` objects.
If a dict is provided, the keys will be used as the target node names and the values will be used as the labels for the edges.
If a tuple is provided, the values will be used as the target node names.
@@ -432,8 +432,8 @@ class StateGraph(Graph):
the graph will wait for ALL of the start nodes to complete before executing the end node.
Args:
start_key (Union[str, list[str]]): The key(s) of the start node(s) of the edge.
end_key (str): The key of the end node of the edge.
start_key: The key(s) of the start node(s) of the edge.
end_key: The key of the end node of the edge.
Raises:
ValueError: If the start key is 'END' or if the start key or end key is not present in the graph.
@@ -476,14 +476,14 @@ class StateGraph(Graph):
"""Add a conditional edge from the starting node to any number of destination nodes.
Args:
source (str): The starting node. This conditional edge will run when
source: The starting node. This conditional edge will run when
exiting this node.
path (Union[Callable, Runnable]): The callable that determines the next
path: The callable that determines the next
node or nodes. If not specifying `path_map` it should return one or
more nodes. If it returns END, the graph will stop execution.
path_map (Optional[dict[Hashable, str]]): Optional mapping of paths to node
path_map: Optional mapping of paths to node
names. If omitted the paths returned by `path` should be node names.
then (Optional[str]): The name of a node to execute after the nodes
then: The name of a node to execute after the nodes
selected by `path`.
Returns:
@@ -571,15 +571,15 @@ class StateGraph(Graph):
streamed, batched, and run asynchronously.
Args:
checkpointer (Optional[Union[Checkpointer, Literal[False]]]): A checkpoint saver object or flag.
checkpointer: A checkpoint saver object or flag.
If provided, this Checkpointer serves as a fully versioned "short-term memory" for the graph,
allowing it to be paused, resumed, and replayed from any point.
If None, it may inherit the parent graph's checkpointer when used as a subgraph.
If False, it will not use or inherit any checkpointer.
interrupt_before (Optional[Sequence[str]]): An optional list of node names to interrupt before.
interrupt_after (Optional[Sequence[str]]): An optional list of node names to interrupt after.
debug (bool): A flag indicating whether to enable debug mode.
name (Optional[str]): The name to use for the compiled graph.
interrupt_before: An optional list of node names to interrupt before.
interrupt_after: An optional list of node names to interrupt after.
debug: A flag indicating whether to enable debug mode.
name: The name to use for the compiled graph.
Returns:
CompiledStateGraph: The compiled state graph.
+4 -4
View File
@@ -805,8 +805,8 @@ class Pregel(PregelProtocol):
"""Get the subgraphs of the graph.
Args:
namespace (Optional[str]): The namespace to filter the subgraphs by.
recurse (bool): Whether to recurse into the subgraphs.
namespace: The namespace to filter the subgraphs by.
recurse: Whether to recurse into the subgraphs.
If False, only the immediate subgraphs will be returned.
Returns:
@@ -844,8 +844,8 @@ class Pregel(PregelProtocol):
"""Get the subgraphs of the graph.
Args:
namespace (Optional[str]): The namespace to filter the subgraphs by.
recurse (bool): Whether to recurse into the subgraphs.
namespace: The namespace to filter the subgraphs by.
recurse: Whether to recurse into the subgraphs.
If False, only the immediate subgraphs will be returned.
Returns:
+2 -2
View File
@@ -263,8 +263,8 @@ class Send:
Initialize a new instance of the Send class.
Args:
node (str): The name of the target node to send the message to.
arg (Any): The state or message to send to the target node.
node: The name of the target node to send the message to.
arg: The state or message to send to the target node.
"""
self.node = node
self.arg = arg
+10 -10
View File
@@ -34,7 +34,7 @@ def recast_checkpoint_ns(ns: str) -> str:
"""Remove task IDs from checkpoint namespace.
Args:
ns (str): The checkpoint namespace with task IDs.
ns: The checkpoint namespace with task IDs.
Returns:
str: The checkpoint namespace without task IDs.
@@ -79,7 +79,7 @@ def merge_configs(*configs: Optional[RunnableConfig]) -> RunnableConfig:
"""Merge multiple configs into one.
Args:
*configs (Optional[RunnableConfig]): The configs to merge.
*configs: The configs to merge.
Returns:
RunnableConfig: The merged config.
@@ -159,15 +159,15 @@ def patch_config(
"""Patch a config with new values.
Args:
config (Optional[RunnableConfig]): The config to patch.
callbacks (Optional[BaseCallbackManager], optional): The callbacks to set.
config: The config to patch.
callbacks: The callbacks to set.
Defaults to None.
recursion_limit (Optional[int], optional): The recursion limit to set.
recursion_limit: The recursion limit to set.
Defaults to None.
max_concurrency (Optional[int], optional): The max concurrency to set.
max_concurrency: The max concurrency to set.
Defaults to None.
run_name (Optional[str], optional): The run name to set. Defaults to None.
configurable (Optional[Dict[str, Any]], optional): The configurable to set.
run_name: The run name to set. Defaults to None.
configurable: The configurable to set.
Defaults to None.
Returns:
@@ -199,7 +199,7 @@ def get_callback_manager_for_config(
"""Get a callback manager for a config.
Args:
config (RunnableConfig): The config.
config: The config.
Returns:
CallbackManager: The callback manager.
@@ -237,7 +237,7 @@ 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.
+3 -3
View File
@@ -67,7 +67,7 @@ def _set_config_context(
"""Set the child Runnable config + tracing context.
Args:
config (RunnableConfig): The config to set.
config: The config to set.
"""
config_token = var_child_runnable_config.set(config)
if run is not None:
@@ -83,7 +83,7 @@ def _unset_config_context(
"""Set the child Runnable config + tracing context.
Args:
config (RunnableConfig): The config to set.
config: The config to set.
"""
var_child_runnable_config.reset(token)
if run is not None:
@@ -108,7 +108,7 @@ def set_config_context(
"""Set the child Runnable config + tracing context.
Args:
config (RunnableConfig): The config to set.
config: The config to set.
"""
ctx = copy_context()
config_token = ctx.run(_set_config_context, config, run)
@@ -543,10 +543,10 @@ class ToolNode(RunnableCallable):
tool calls for tool invocation.
Args:
tool_call (ToolCall): The tool call to inject state and store into.
input (Union[list[AnyMessage], dict[str, Any], BaseModel]): The input state
tool_call: The tool call to inject state and store into.
input: The input state
to inject.
store (Optional[BaseStore]): The store to inject.
store: The store to inject.
Returns:
ToolCall: The tool call with injected state and store.
@@ -625,7 +625,7 @@ def tools_condition(
has tool calls. Otherwise, route to the end.
Args:
state (Union[list[AnyMessage], dict[str, Any], BaseModel]): The state to check for
state: The state to check for
tool calls. Must have a list of messages (MessageGraph) or have the
"messages" key (StateGraph).
+1 -1
View File
@@ -195,7 +195,7 @@ class Auth:
- authorization (str | None): The Authorization header value (e.g., "Bearer <token>")
Args:
fn (Callable): The authentication handler function to register.
fn: The authentication handler function to register.
Must return a representation of the user. This could be a:
- string (the user id)
- dict containing {"identity": str, "permissions": list[str]}
+3 -4
View File
@@ -10,11 +10,10 @@ class HTTPException(Exception):
Since this is defined in the auth module, we default to a 401 status code.
Args:
status_code (int, optional): HTTP status code for the error. Defaults to 401 "Unauthorized".
detail (str | None, optional): Detailed error message. If None, uses a default
status_code: HTTP status code for the error. Defaults to 401 "Unauthorized".
detail: Detailed error message. If None, uses a default
message based on the status code.
headers (typing.Mapping[str, str] | None, optional): Additional HTTP headers to
include in the error response.
headers: Additional HTTP headers to include in the error response.
Example:
Default: