mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-22 09:35:07 +02:00
Update sqlite signature
This commit is contained in:
@@ -424,6 +424,7 @@ class SqliteSaver(BaseCheckpointSaver[str]):
|
|||||||
config: RunnableConfig,
|
config: RunnableConfig,
|
||||||
writes: Sequence[Tuple[str, Any]],
|
writes: Sequence[Tuple[str, Any]],
|
||||||
task_id: str,
|
task_id: str,
|
||||||
|
task_path: str = "",
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Store intermediate writes linked to a checkpoint.
|
"""Store intermediate writes linked to a checkpoint.
|
||||||
|
|
||||||
@@ -433,6 +434,7 @@ class SqliteSaver(BaseCheckpointSaver[str]):
|
|||||||
config (RunnableConfig): Configuration of the related checkpoint.
|
config (RunnableConfig): Configuration of the related checkpoint.
|
||||||
writes (Sequence[Tuple[str, Any]]): List of writes to store, each as (channel, value) pair.
|
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_id (str): Identifier for the task creating the writes.
|
||||||
|
task_path (str): Path of the task creating the writes.
|
||||||
"""
|
"""
|
||||||
query = (
|
query = (
|
||||||
"INSERT OR REPLACE INTO writes (thread_id, checkpoint_ns, checkpoint_id, task_id, idx, channel, type, value) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
|
"INSERT OR REPLACE INTO writes (thread_id, checkpoint_ns, checkpoint_id, task_id, idx, channel, type, value) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
|
||||||
|
|||||||
@@ -398,9 +398,11 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
|
|||||||
ORDER BY checkpoint_id DESC"""
|
ORDER BY checkpoint_id DESC"""
|
||||||
if limit:
|
if limit:
|
||||||
query += f" LIMIT {limit}"
|
query += f" LIMIT {limit}"
|
||||||
async with self.lock, self.conn.execute(
|
async with (
|
||||||
query, params
|
self.lock,
|
||||||
) as cur, self.conn.cursor() as wcur:
|
self.conn.execute(query, params) as cur,
|
||||||
|
self.conn.cursor() as wcur,
|
||||||
|
):
|
||||||
async for (
|
async for (
|
||||||
thread_id,
|
thread_id,
|
||||||
checkpoint_ns,
|
checkpoint_ns,
|
||||||
@@ -467,16 +469,19 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
|
|||||||
checkpoint_ns = config["configurable"]["checkpoint_ns"]
|
checkpoint_ns = config["configurable"]["checkpoint_ns"]
|
||||||
type_, serialized_checkpoint = self.serde.dumps_typed(checkpoint)
|
type_, serialized_checkpoint = self.serde.dumps_typed(checkpoint)
|
||||||
serialized_metadata = self.jsonplus_serde.dumps(metadata)
|
serialized_metadata = self.jsonplus_serde.dumps(metadata)
|
||||||
async with self.lock, self.conn.execute(
|
async with (
|
||||||
"INSERT OR REPLACE INTO checkpoints (thread_id, checkpoint_ns, checkpoint_id, parent_checkpoint_id, type, checkpoint, metadata) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
self.lock,
|
||||||
(
|
self.conn.execute(
|
||||||
str(config["configurable"]["thread_id"]),
|
"INSERT OR REPLACE INTO checkpoints (thread_id, checkpoint_ns, checkpoint_id, parent_checkpoint_id, type, checkpoint, metadata) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
||||||
checkpoint_ns,
|
(
|
||||||
checkpoint["id"],
|
str(config["configurable"]["thread_id"]),
|
||||||
config["configurable"].get("checkpoint_id"),
|
checkpoint_ns,
|
||||||
type_,
|
checkpoint["id"],
|
||||||
serialized_checkpoint,
|
config["configurable"].get("checkpoint_id"),
|
||||||
serialized_metadata,
|
type_,
|
||||||
|
serialized_checkpoint,
|
||||||
|
serialized_metadata,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
):
|
):
|
||||||
await self.conn.commit()
|
await self.conn.commit()
|
||||||
@@ -493,6 +498,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
|
|||||||
config: RunnableConfig,
|
config: RunnableConfig,
|
||||||
writes: Sequence[Tuple[str, Any]],
|
writes: Sequence[Tuple[str, Any]],
|
||||||
task_id: str,
|
task_id: str,
|
||||||
|
task_path: str = "",
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Store intermediate writes linked to a checkpoint asynchronously.
|
"""Store intermediate writes linked to a checkpoint asynchronously.
|
||||||
|
|
||||||
@@ -502,6 +508,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
|
|||||||
config (RunnableConfig): Configuration of the related checkpoint.
|
config (RunnableConfig): Configuration of the related checkpoint.
|
||||||
writes (Sequence[Tuple[str, Any]]): List of writes to store, each as (channel, value) pair.
|
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_id (str): Identifier for the task creating the writes.
|
||||||
|
task_path (str): Path of the task creating the writes.
|
||||||
"""
|
"""
|
||||||
query = (
|
query = (
|
||||||
"INSERT OR REPLACE INTO writes (thread_id, checkpoint_ns, checkpoint_id, task_id, idx, channel, type, value) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
|
"INSERT OR REPLACE INTO writes (thread_id, checkpoint_ns, checkpoint_id, task_id, idx, channel, type, value) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
|
||||||
|
|||||||
Reference in New Issue
Block a user