Compare commits

..
Author SHA1 Message Date
William FHandGitHub c3df8bd500 Ensure key is string (#3739)
Mainly relevenat for the in memory store.
2025-03-07 11:21:32 -08:00
2 changed files with 7 additions and 7 deletions
@@ -682,7 +682,7 @@ class BaseStore(ABC):
Returns:
The retrieved item or None if not found.
"""
return self.batch([GetOp(namespace, key, refresh_ttl)])[0]
return self.batch([GetOp(namespace, str(key), refresh_ttl)])[0]
def search(
self,
@@ -811,7 +811,7 @@ class BaseStore(ABC):
f"TTL is not supported by {self.__class__.__name__}. "
f"Use a store implementation that supports TTL or set ttl=None."
)
self.batch([PutOp(namespace, key, value, index=index, ttl=ttl)])
self.batch([PutOp(namespace, str(key), value, index=index, ttl=ttl)])
def delete(self, namespace: tuple[str, ...], key: str) -> None:
"""Delete an item.
@@ -820,7 +820,7 @@ class BaseStore(ABC):
namespace: Hierarchical path for the item.
key: Unique identifier within the namespace.
"""
self.batch([PutOp(namespace, key, None, ttl=None)])
self.batch([PutOp(namespace, str(key), None, ttl=None)])
def list_namespaces(
self,
@@ -887,7 +887,7 @@ class BaseStore(ABC):
Returns:
The retrieved item or None if not found.
"""
return (await self.abatch([GetOp(namespace, key, refresh_ttl)]))[0]
return (await self.abatch([GetOp(namespace, str(key), refresh_ttl)]))[0]
async def asearch(
self,
@@ -1027,7 +1027,7 @@ class BaseStore(ABC):
f"TTL is not supported by {self.__class__.__name__}. "
f"Use a store implementation that supports TTL or set ttl=None."
)
await self.abatch([PutOp(namespace, key, value, index=index, ttl=ttl)])
await self.abatch([PutOp(namespace, str(key), value, index=index, ttl=ttl)])
async def adelete(self, namespace: tuple[str, ...], key: str) -> None:
"""Asynchronously delete an item.
@@ -1036,7 +1036,7 @@ class BaseStore(ABC):
namespace: Hierarchical path for the item.
key: Unique identifier within the namespace.
"""
await self.abatch([PutOp(namespace, key, None)])
await self.abatch([PutOp(namespace, str(key), None)])
async def alist_namespaces(
self,
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langgraph-checkpoint"
version = "2.0.17"
version = "2.0.18"
description = "Library with base interfaces for LangGraph checkpoint savers."
authors = []
license = "MIT"