From 0f0e31df2413f3a5c547329e9f71c9524d6d8d7a Mon Sep 17 00:00:00 2001 From: William FH <13333726+hinthornw@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:52:44 -0800 Subject: [PATCH] Nicer item repr (#2655) --- libs/checkpoint/langgraph/store/base/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/checkpoint/langgraph/store/base/__init__.py b/libs/checkpoint/langgraph/store/base/__init__.py index b2ab49527..c635e43ed 100644 --- a/libs/checkpoint/langgraph/store/base/__init__.py +++ b/libs/checkpoint/langgraph/store/base/__init__.py @@ -80,13 +80,16 @@ class Item: def dict(self) -> dict: return { - "value": self.value, - "key": self.key, "namespace": list(self.namespace), + "key": self.key, + "value": self.value, "created_at": self.created_at.isoformat(), "updated_at": self.updated_at.isoformat(), } + def __repr__(self) -> str: + return f"Item({', '.join(f'{k}={v!r}' for k, v in self.dict().items())})" + class SearchItem(Item): """Represents an item returned from a search operation with additional metadata."""