docstrings for checkpoint-sqlite

This commit is contained in:
Sydney Runkle
2025-05-01 13:40:21 -04:00
parent 8ce33b948c
commit 6c6bfbc63a
2 changed files with 40 additions and 40 deletions
@@ -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