|
1 | 1 | """Tests for AsyncRedisStore."""
|
2 | 2 |
|
3 |
| -import uuid |
4 | 3 | from typing import Any, AsyncGenerator, Dict, Sequence, cast
|
5 | 4 |
|
6 | 5 | import pytest
|
7 | 6 | from langchain_anthropic import ChatAnthropic
|
8 | 7 | from langchain_core.messages import BaseMessage, HumanMessage
|
9 | 8 | from langchain_core.runnables import RunnableConfig
|
10 | 9 | from langchain_openai import OpenAIEmbeddings
|
| 10 | +from redis.asyncio import Redis |
| 11 | +from ulid import ULID |
| 12 | + |
| 13 | +from langgraph.checkpoint.redis import AsyncRedisSaver |
11 | 14 | from langgraph.constants import START
|
12 | 15 | from langgraph.graph import MessagesState, StateGraph
|
13 | 16 | from langgraph.store.base import (
|
@@ -286,6 +289,7 @@ async def test_list_namespaces(store: AsyncRedisStore) -> None:
|
286 | 289 | for namespace in test_namespaces:
|
287 | 290 | await store.adelete(namespace, "dummy")
|
288 | 291 |
|
| 292 | + |
289 | 293 | # TODO
|
290 | 294 | @pytest.mark.skip(reason="Skipping for v0.0.1 release")
|
291 | 295 | @pytest.mark.asyncio
|
@@ -527,7 +531,7 @@ def call_model(
|
527 | 531 | # Store new memories if the user asks the model to remember
|
528 | 532 | if "remember" in last_message.content.lower(): # type:ignore[union-attr]
|
529 | 533 | memory = "User name is Bob"
|
530 |
| - store.put(namespace, str(uuid.uuid4()), {"data": memory}) |
| 534 | + store.put(namespace, str(ULID()), {"data": memory}) |
531 | 535 |
|
532 | 536 | messages = [{"role": "system", "content": system_msg}]
|
533 | 537 | messages.extend([msg.model_dump() for msg in state["messages"]])
|
|
0 commit comments