Skip to content

Commit 7d48f33

Browse files
wip on key sep
1 parent f98149b commit 7d48f33

File tree

6 files changed

+25
-14
lines changed

6 files changed

+25
-14
lines changed

langgraph/checkpoint/redis/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def get_tuple(self, config: RunnableConfig) -> Optional[CheckpointTuple]:
303303

304304
# Fetch pending_sends from parent checkpoint
305305
pending_sends = []
306-
if doc["parent_checkpoint_id"]:
306+
if "parent_checkpoint_id" in doc:
307307
pending_sends = self._load_pending_sends(
308308
thread_id=thread_id,
309309
checkpoint_ns=checkpoint_ns,

langgraph/checkpoint/redis/ashallow.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
{
3939
"index": {
4040
"name": "checkpoints",
41-
"prefix": CHECKPOINT_PREFIX + REDIS_KEY_SEPARATOR,
41+
"prefix": CHECKPOINT_PREFIX,
42+
"key_separator": REDIS_KEY_SEPARATOR,
4243
"storage_type": "json",
4344
},
4445
"fields": [
@@ -51,7 +52,8 @@
5152
{
5253
"index": {
5354
"name": "checkpoints_blobs",
54-
"prefix": CHECKPOINT_BLOB_PREFIX + REDIS_KEY_SEPARATOR,
55+
"prefix": CHECKPOINT_BLOB_PREFIX,
56+
"key_separator": REDIS_KEY_SEPARATOR,
5557
"storage_type": "json",
5658
},
5759
"fields": [
@@ -64,7 +66,8 @@
6466
{
6567
"index": {
6668
"name": "checkpoint_writes",
67-
"prefix": CHECKPOINT_WRITE_PREFIX + REDIS_KEY_SEPARATOR,
69+
"prefix": CHECKPOINT_WRITE_PREFIX,
70+
"key_separator": REDIS_KEY_SEPARATOR,
6871
"storage_type": "json",
6972
},
7073
"fields": [

langgraph/checkpoint/redis/base.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
{
3232
"index": {
3333
"name": "checkpoints",
34-
"prefix": CHECKPOINT_PREFIX + REDIS_KEY_SEPARATOR,
34+
"prefix": CHECKPOINT_PREFIX,
35+
"key_separator": REDIS_KEY_SEPARATOR,
3536
"storage_type": "json",
3637
},
3738
"fields": [
@@ -46,7 +47,8 @@
4647
{
4748
"index": {
4849
"name": "checkpoints_blobs",
49-
"prefix": CHECKPOINT_BLOB_PREFIX + REDIS_KEY_SEPARATOR,
50+
"prefix": CHECKPOINT_BLOB_PREFIX,
51+
"key_separator": REDIS_KEY_SEPARATOR,
5052
"storage_type": "json",
5153
},
5254
"fields": [
@@ -60,7 +62,8 @@
6062
{
6163
"index": {
6264
"name": "checkpoint_writes",
63-
"prefix": CHECKPOINT_WRITE_PREFIX + REDIS_KEY_SEPARATOR,
65+
"prefix": CHECKPOINT_WRITE_PREFIX,
66+
"key_separator": REDIS_KEY_SEPARATOR,
6467
"storage_type": "json",
6568
},
6669
"fields": [

langgraph/checkpoint/redis/shallow.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
{
3232
"index": {
3333
"name": "checkpoints",
34-
"prefix": CHECKPOINT_PREFIX + REDIS_KEY_SEPARATOR,
34+
"prefix": CHECKPOINT_PREFIX,
35+
"key_separator": REDIS_KEY_SEPARATOR,
3536
"storage_type": "json",
3637
},
3738
"fields": [
@@ -44,7 +45,8 @@
4445
{
4546
"index": {
4647
"name": "checkpoints_blobs",
47-
"prefix": CHECKPOINT_BLOB_PREFIX + REDIS_KEY_SEPARATOR,
48+
"prefix": CHECKPOINT_BLOB_PREFIX,
49+
"key_separator": REDIS_KEY_SEPARATOR,
4850
"storage_type": "json",
4951
},
5052
"fields": [
@@ -57,7 +59,8 @@
5759
{
5860
"index": {
5961
"name": "checkpoint_writes",
60-
"prefix": CHECKPOINT_WRITE_PREFIX + REDIS_KEY_SEPARATOR,
62+
"prefix": CHECKPOINT_WRITE_PREFIX,
63+
"key_separator": REDIS_KEY_SEPARATOR,
6164
"storage_type": "json",
6265
},
6366
"fields": [

langgraph/store/redis/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from redisvl.query import FilterQuery, VectorQuery
2626
from redisvl.redis.connection import RedisConnectionFactory
2727
from redisvl.utils.token_escaper import TokenEscaper
28-
from ulid import ULID
28+
from redisvl.utils.utils import create_ulid
2929

3030
from langgraph.store.redis.aio import AsyncRedisStore
3131
from langgraph.store.redis.base import (
@@ -223,7 +223,7 @@ def _batch_put_ops(
223223
# Generate IDs for PUT operations
224224
for _, op in put_ops:
225225
if op.value is not None:
226-
generated_doc_id = str(ULID())
226+
generated_doc_id = create_ulid()
227227
namespace = _namespace_to_text(op.namespace)
228228
doc_ids[(namespace, op.key)] = generated_doc_id
229229

langgraph/store/redis/base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
{
4545
"index": {
4646
"name": "store",
47-
"prefix": STORE_PREFIX + REDIS_KEY_SEPARATOR,
47+
"prefix": STORE_PREFIX,
48+
"key_separator": REDIS_KEY_SEPARATOR,
4849
"storage_type": "json",
4950
},
5051
"fields": [
@@ -57,7 +58,8 @@
5758
{
5859
"index": {
5960
"name": "store_vectors",
60-
"prefix": STORE_VECTOR_PREFIX + REDIS_KEY_SEPARATOR,
61+
"prefix": STORE_VECTOR_PREFIX,
62+
"key_separator": REDIS_KEY_SEPARATOR,
6163
"storage_type": "json",
6264
},
6365
"fields": [

0 commit comments

Comments
 (0)