You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d8f4854
Browse filesBrowse the repository at this point in the historyBrowse files
authored
fix(langchain): align Store deletion, validation and removal errors (#6324)
* fix(langchain): honor sync Store put deletion semantics
(cherry picked from commit 9cc5841)
Signed-off-by: Hao Zhe <[email protected]>
* fix(langgraph): delete item when store put receives None
LangGraph's BaseStore contract treats a None value passed to put() as a
deletion. OpenVikingStore.batch() already dispatched PutOp with a None
value to delete(), and the inherited aput() reaches the same path through
abatch(), but the sync put() override wrote None straight through the
ordinary JSON record path.
Before this change, put(namespace, key, None) stored a record whose value
was null: get() returned an Item with value None, search() still listed
the record, and list_namespaces() kept exposing the namespace. Calling it
on a key that did not exist created a new null-valued record instead of
doing nothing.
The sync put() now delegates the None case to the existing delete(),
after the unsupported-TTL guard so that put(..., None, ttl=...) still
raises NotImplementedError and stays consistent with aput(). get() now
returns None, search() omits the item, the namespace disappears once its
last record is removed, and deleting a missing key is a no-op. The value
annotation was widened to dict[str, Any] | None to match BaseStore.
(cherry picked from commit 8578bd0)
Signed-off-by: Hao Zhe <[email protected]>
* fix(langchain): make OpenVikingStore.put(None) delete the item (fixes#5821)
LangGraph's BaseStore.put() defines value=None as a deletion signal. The
OpenViking adapter's batch / async paths already routed None through
self.delete(...), but the sync put() override wrote the None through the
ordinary JSON storage path, persisting a record whose value is JSON null.
After the fix, put(namespace, key, None) delegates to delete(namespace, key)
and returns, matching the public BaseStore contract:
- get() returns None for the deleted key.
- search() no longer returns the deleted item.
- list_namespaces() no longer keeps the deleted item's namespace.
- Deleting a missing key is a no-op (no null-valued record is created).
The value type annotation is widened to "Mapping[str, Any] | None" to
match the call sites batch already uses (op.value is forwarded as-is).
(cherry picked from commit 564f8f1)
Signed-off-by: Hao Zhe <[email protected]>
* fix(langchain): propagate store removal failures
(cherry picked from commit d9a8c82)
Signed-off-by: Hao Zhe <[email protected]>
* fix(langchain): validate namespaces before sync Store writes
(cherry picked from commit 13a9e2c)
Signed-off-by: Hao Zhe <[email protected]>
* test(langchain): cover Store write and deletion contracts together
Keep contributed deletion coverage in the adapter suite and remove overlapping assertions. Exercise sync, async and batch removal failures, partial cleanup and retry, invalid put(None) namespaces, independent items and unsupported TTL. Document partial removal behavior.
Signed-off-by: Hao Zhe <[email protected]>
---------
Signed-off-by: Hao Zhe <[email protected]>
Co-authored-by: ktz03 <[email protected]>
Co-authored-by: varun-projects <[email protected]>
Co-authored-by: RerankerGuo <[email protected]>
Copy file name to clipboardExpand all lines: docs/en/agent-integrations/07-langchain-langgraph.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -256,8 +256,16 @@ from langchain_openviking import OpenVikingStore
256
256
store = OpenVikingStore(url="http://localhost:1933", api_key="...")
Copy file name to clipboardExpand all lines: docs/zh/agent-integrations/07-langchain-langgraph.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -244,8 +244,15 @@ from langchain_openviking import OpenVikingStore
244
244
store = OpenVikingStore(url="http://localhost:1933", api_key="...")
0 commit comments