diff --git a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py index d918d6ba1c..843c9dbfec 100644 --- a/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py +++ b/libs/checkpoint-postgres/langgraph/checkpoint/postgres/__init__.py @@ -261,15 +261,13 @@ def get_writes_by_cache_key(self, cache_key: str) -> List[Any]: cache_key (str): The cache key to use for retrieving the checkpoints. Returns: - List[CheckpointTuple]: A list of retrieved checkpoint tuples. Empty list if none found. + List[Any]: A list of retrieved checkpoint writes. Empty list if none found. Examples: >>> cache_key = "some_unique_cache_key" - >>> checkpoint_tuples = memory.get_writes_by_cache_key(cache_key) - >>> for tuple in checkpoint_tuples: - ... print(tuple) - CheckpointTuple(...) - CheckpointTuple(...) + >>> checkpoint_writes = memory.get_writes_by_cache_key(cache_key) + >>> for write in checkpoint_writes: + ... print(write) """ results = [] try: diff --git a/libs/checkpoint/langgraph/checkpoint/base/__init__.py b/libs/checkpoint/langgraph/checkpoint/base/__init__.py index 56eaf1e80b..62210c9b2b 100644 --- a/libs/checkpoint/langgraph/checkpoint/base/__init__.py +++ b/libs/checkpoint/langgraph/checkpoint/base/__init__.py @@ -424,14 +424,14 @@ def get_next_version(self, current: Optional[V], channel: ChannelProtocol) -> V: def aget_writes_by_cache_key( self, cache_key: str - ) -> Optional[List[CheckpointTuple]]: + ) -> Optional[List[Any]]: """Get a checkpoint tuple from the database based on a cache key. Args: cache_key (str): The cache key to use for retrieving the checkpoint. Returns: - List[CheckpointTuple]: A list of retrieved checkpoint tuples. Empty list if none found. + List[Any]: A list of retrieved checkpoint writes. Empty list if none found. """ raise NotImplementedError @@ -442,7 +442,7 @@ def get_writes_by_cache_key(self, cache_key: str) -> Optional[List[Any]]: cache_key (str): The cache key to use for retrieving the checkpoint. Returns: - List[CheckpointTuple]: A list of retrieved checkpoint tuples. Empty list if none found. + List[Any]: A list of retrieved checkpoint writes. Empty list if none found. """ pass diff --git a/libs/langgraph/tests/test_cache.py b/libs/langgraph/tests/test_cache.py index 8c0f56bd56..926f0f3fa1 100644 --- a/libs/langgraph/tests/test_cache.py +++ b/libs/langgraph/tests/test_cache.py @@ -50,10 +50,8 @@ def custom_cache_key(input: Any, config: Optional[RunnableConfig] = None) -> str "metadata": config.get("metadata", {}), } config_str = json.dumps(relevant_config, sort_keys=True) - print() # Combine input and config strings combined_str = f"{input_str}|{config_str}" - print("combined_str", combined_str) # Generate a hash of the combined string return hashlib.md5(combined_str.encode("utf-8")).hexdigest() @@ -92,7 +90,6 @@ def analyzer_one(data: State) -> State: def retriever_one(data: State) -> State: nonlocal call_count call_count += 1 - print("increasing count", call_count) return {"docs": ["doc1", "doc2"]} def retriever_two(data: State) -> State: @@ -100,7 +97,6 @@ def retriever_two(data: State) -> State: return {"docs": ["doc3", "doc4"]} def qa(data: State) -> State: - print("qaaaa", data["docs"]) return {"answer": ",".join(data["docs"])} def rewrite_query_then(data: State) -> Literal["retriever_two"]: