langgraph-api 0.0.33__py3-none-any.whl → 0.0.34__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of langgraph-api might be problematic. Click here for more details.
- langgraph_api/serde.py +9 -3
- {langgraph_api-0.0.33.dist-info → langgraph_api-0.0.34.dist-info}/METADATA +2 -2
- {langgraph_api-0.0.33.dist-info → langgraph_api-0.0.34.dist-info}/RECORD +8 -8
- langgraph_storage/checkpoint.py +9 -1
- langgraph_storage/ops.py +12 -2
- {langgraph_api-0.0.33.dist-info → langgraph_api-0.0.34.dist-info}/LICENSE +0 -0
- {langgraph_api-0.0.33.dist-info → langgraph_api-0.0.34.dist-info}/WHEEL +0 -0
- {langgraph_api-0.0.33.dist-info → langgraph_api-0.0.34.dist-info}/entry_points.txt +0 -0
langgraph_api/serde.py
CHANGED
|
@@ -52,11 +52,17 @@ def default(obj):
|
|
|
52
52
|
# https://github.com/ijl/orjson#serialize
|
|
53
53
|
if isinstance(obj, Fragment):
|
|
54
54
|
return orjson.Fragment(obj.buf)
|
|
55
|
-
if
|
|
55
|
+
if (
|
|
56
|
+
hasattr(obj, "model_dump")
|
|
57
|
+
and callable(obj.model_dump)
|
|
58
|
+
and not isinstance(obj, type)
|
|
59
|
+
):
|
|
56
60
|
return obj.model_dump()
|
|
57
|
-
elif hasattr(obj, "dict") and callable(obj.dict):
|
|
61
|
+
elif hasattr(obj, "dict") and callable(obj.dict) and not isinstance(obj, type):
|
|
58
62
|
return obj.dict()
|
|
59
|
-
elif
|
|
63
|
+
elif (
|
|
64
|
+
hasattr(obj, "_asdict") and callable(obj._asdict) and not isinstance(obj, type)
|
|
65
|
+
):
|
|
60
66
|
return obj._asdict()
|
|
61
67
|
elif isinstance(obj, BaseException):
|
|
62
68
|
return {"error": type(obj).__name__, "message": str(obj)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: langgraph-api
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.34
|
|
4
4
|
Summary:
|
|
5
5
|
License: Elastic-2.0
|
|
6
6
|
Author: Nuno Campos
|
|
@@ -15,7 +15,7 @@ Requires-Dist: httpx (>=0.25.0)
|
|
|
15
15
|
Requires-Dist: jsonschema-rs (>=0.20.0,<0.30)
|
|
16
16
|
Requires-Dist: langchain-core (>=0.2.38,<0.4.0)
|
|
17
17
|
Requires-Dist: langgraph (>=0.2.56,<0.4.0)
|
|
18
|
-
Requires-Dist: langgraph-checkpoint (>=2.0.
|
|
18
|
+
Requires-Dist: langgraph-checkpoint (>=2.0.23,<3.0)
|
|
19
19
|
Requires-Dist: langgraph-sdk (>=0.1.58,<0.2.0)
|
|
20
20
|
Requires-Dist: langsmith (>=0.1.63,<0.4.0)
|
|
21
21
|
Requires-Dist: orjson (>=3.9.7)
|
|
@@ -72,7 +72,7 @@ langgraph_api/patch.py,sha256=82xjuFqY7tgrUm-k1XWHI6k8S6QovSD0zhe--8_xW4o,1296
|
|
|
72
72
|
langgraph_api/queue_entrypoint.py,sha256=4xICUxXarNV8DhnaqAMhVi3xCmyVKCL3J5NzHxPA9Xc,1835
|
|
73
73
|
langgraph_api/route.py,sha256=fM4qYCGbmH0a3_cV8uKocb1sLklehxO6HhdRXqLK6OM,4421
|
|
74
74
|
langgraph_api/schema.py,sha256=hNbg6ep2wiGBBtBJVNBgMYA8uC33AfaqhRXXVUY_At8,5361
|
|
75
|
-
langgraph_api/serde.py,sha256=
|
|
75
|
+
langgraph_api/serde.py,sha256=HfaIBNfdKg2W_mIpw_er5irG3GlIiiVqkqfbDgnYHpg,3671
|
|
76
76
|
langgraph_api/server.py,sha256=CiNK327zTsEpoVGeJK1JOtZHvOBYRoz0CnBTZUmsC7c,4567
|
|
77
77
|
langgraph_api/sse.py,sha256=2wNodCOP2eg7a9mpSu0S3FQ0CHk2BBV_vv0UtIgJIcc,4034
|
|
78
78
|
langgraph_api/state.py,sha256=8jx4IoTCOjTJuwzuXJKKFwo1VseHjNnw_CCq4x1SW14,2284
|
|
@@ -85,18 +85,18 @@ langgraph_license/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU
|
|
|
85
85
|
langgraph_license/middleware.py,sha256=_ODIYzQkymr6W9_Fp9wtf1kAQspnpsmr53xuzyF2GA0,612
|
|
86
86
|
langgraph_license/validation.py,sha256=Uu_G8UGO_WTlLsBEY0gTVWjRR4czYGfw5YAD3HLZoj0,203
|
|
87
87
|
langgraph_storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
88
|
-
langgraph_storage/checkpoint.py,sha256=
|
|
88
|
+
langgraph_storage/checkpoint.py,sha256=X6YHrCwIPVE0iEQy16GhleyyHUdXdCkC-c-Q1SW-rAM,3884
|
|
89
89
|
langgraph_storage/database.py,sha256=I0AgFeJ-NSTT34vxKxQBUf1z2syFP0S8QpKCqTixrzY,5652
|
|
90
90
|
langgraph_storage/inmem_stream.py,sha256=8bxkILIuFpr7P7RQ37SQAxrpRKvmbHdRB_nbfFiomlk,3263
|
|
91
|
-
langgraph_storage/ops.py,sha256=
|
|
91
|
+
langgraph_storage/ops.py,sha256=bCgQd7VVezTsTZQe4QlWk-TZiD5YkUFU0_vi7Gxg4YE,72963
|
|
92
92
|
langgraph_storage/queue.py,sha256=UDgsUTtUMfBSRDrQ8Onis-FJO4n7KTsX6sdpbY8Hs0A,5055
|
|
93
93
|
langgraph_storage/retry.py,sha256=XmldOP4e_H5s264CagJRVnQMDFcEJR_dldVR1Hm5XvM,763
|
|
94
94
|
langgraph_storage/store.py,sha256=33-J5-Xvobb9ArSa-GezP5KtfXgzWkHUHPyjRYmdw-E,2985
|
|
95
95
|
langgraph_storage/ttl_dict.py,sha256=FlpEY8EANeXWKo_G5nmIotPquABZGyIJyk6HD9u6vqY,1533
|
|
96
96
|
logging.json,sha256=3RNjSADZmDq38eHePMm1CbP6qZ71AmpBtLwCmKU9Zgo,379
|
|
97
97
|
openapi.json,sha256=6okfuwPAKB2Hi1tup-EFza49pmN_iD2Yt5JktMALcq4,127984
|
|
98
|
-
langgraph_api-0.0.
|
|
99
|
-
langgraph_api-0.0.
|
|
100
|
-
langgraph_api-0.0.
|
|
101
|
-
langgraph_api-0.0.
|
|
102
|
-
langgraph_api-0.0.
|
|
98
|
+
langgraph_api-0.0.34.dist-info/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
|
|
99
|
+
langgraph_api-0.0.34.dist-info/METADATA,sha256=w65HKkHiBPnTZRwJQyFjMTU9TE-kjQnOajtuUL2aBng,4027
|
|
100
|
+
langgraph_api-0.0.34.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
101
|
+
langgraph_api-0.0.34.dist-info/entry_points.txt,sha256=3EYLgj89DfzqJHHYGxPH4A_fEtClvlRbWRUHaXO7hj4,77
|
|
102
|
+
langgraph_api-0.0.34.dist-info/RECORD,,
|
langgraph_storage/checkpoint.py
CHANGED
|
@@ -105,7 +105,15 @@ class InMemorySaver(MemorySaver):
|
|
|
105
105
|
MEMORY = InMemorySaver()
|
|
106
106
|
|
|
107
107
|
|
|
108
|
-
def Checkpointer(*args, **kwargs):
|
|
108
|
+
def Checkpointer(*args, unpack_hook=None, **kwargs):
|
|
109
|
+
if unpack_hook is not None:
|
|
110
|
+
saver = InMemorySaver(
|
|
111
|
+
serde=Serializer(__unpack_ext_hook__=unpack_hook), **kwargs
|
|
112
|
+
)
|
|
113
|
+
saver.writes = MEMORY.writes
|
|
114
|
+
saver.blobs = MEMORY.blobs
|
|
115
|
+
saver.storage = MEMORY.storage
|
|
116
|
+
return saver
|
|
109
117
|
return MEMORY
|
|
110
118
|
|
|
111
119
|
|
langgraph_storage/ops.py
CHANGED
|
@@ -15,6 +15,7 @@ from typing import Any, Literal, cast
|
|
|
15
15
|
from uuid import UUID, uuid4
|
|
16
16
|
|
|
17
17
|
import structlog
|
|
18
|
+
from langgraph.checkpoint.serde.jsonplus import _msgpack_ext_hook_to_json
|
|
18
19
|
from langgraph.pregel.debug import CheckpointPayload
|
|
19
20
|
from langgraph.pregel.types import StateSnapshot
|
|
20
21
|
from langgraph_sdk import Auth
|
|
@@ -949,6 +950,11 @@ class Threads(Authenticated):
|
|
|
949
950
|
checkpointer.writes[
|
|
950
951
|
(str(new_thread_id), checkpoint_ns, checkpoint_id)
|
|
951
952
|
] = mapped
|
|
953
|
+
# Copy the blobs
|
|
954
|
+
for k in list(checkpointer.blobs):
|
|
955
|
+
if str(k[0]) == str(thread_id):
|
|
956
|
+
new_key = (str(new_thread_id), *k[1:])
|
|
957
|
+
checkpointer.blobs[new_key] = checkpointer.blobs[k]
|
|
952
958
|
|
|
953
959
|
async def row_generator() -> AsyncIterator[Thread]:
|
|
954
960
|
yield new_thread
|
|
@@ -967,7 +973,7 @@ class Threads(Authenticated):
|
|
|
967
973
|
ctx: Auth.types.BaseAuthContext | None = None,
|
|
968
974
|
) -> StateSnapshot:
|
|
969
975
|
"""Get state for a thread."""
|
|
970
|
-
checkpointer = Checkpointer(conn)
|
|
976
|
+
checkpointer = Checkpointer(conn, unpack_hook=_msgpack_ext_hook_to_json)
|
|
971
977
|
thread_id = _ensure_uuid(config["configurable"]["thread_id"])
|
|
972
978
|
# Auth will be applied here so no need to use filters downstream
|
|
973
979
|
thread_iter = await Threads.get(conn, thread_id, ctx=ctx)
|
|
@@ -1186,7 +1192,11 @@ class Threads(Authenticated):
|
|
|
1186
1192
|
# If graph_id exists, get state history
|
|
1187
1193
|
if graph_id := thread_metadata.get("graph_id"):
|
|
1188
1194
|
async with get_graph(
|
|
1189
|
-
graph_id,
|
|
1195
|
+
graph_id,
|
|
1196
|
+
thread_config,
|
|
1197
|
+
checkpointer=Checkpointer(
|
|
1198
|
+
conn, unpack_hook=_msgpack_ext_hook_to_json
|
|
1199
|
+
),
|
|
1190
1200
|
) as graph:
|
|
1191
1201
|
# Convert before parameter if it's a string
|
|
1192
1202
|
before_param = (
|
|
File without changes
|
|
File without changes
|
|
File without changes
|