mirror of
https://github.com/langchain-ai/langgraphjs.git
synced 2026-07-22 17:15:25 -04:00
perf(langgraph): Improve performance of createCheckpoint (#1621)
Co-authored-by: David Duong <david@duong.cz>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@langchain/langgraph": patch
|
||||
---
|
||||
|
||||
Improve graph execution performance by avoiding unnecessary cloning of checkpoints after every tick
|
||||
@@ -169,19 +169,12 @@ export function createCheckpoint<ValueType>(
|
||||
}
|
||||
}
|
||||
|
||||
const newVersionsSeen = {} as Record<string, Record<string, number | string>>;
|
||||
for (const k in checkpoint.versions_seen) {
|
||||
if (!Object.prototype.hasOwnProperty.call(checkpoint.versions_seen, k))
|
||||
continue;
|
||||
newVersionsSeen[k] = { ...checkpoint.versions_seen[k] };
|
||||
}
|
||||
|
||||
return {
|
||||
v: 4,
|
||||
id: options?.id ?? uuid6(step),
|
||||
ts: new Date().toISOString(),
|
||||
channel_values: values,
|
||||
channel_versions: { ...checkpoint.channel_versions },
|
||||
versions_seen: newVersionsSeen,
|
||||
channel_versions: checkpoint.channel_versions,
|
||||
versions_seen: checkpoint.versions_seen,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user