langgraph-runtime-inmem 0.6.4__py3-none-any.whl → 0.6.6__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.
- langgraph_runtime_inmem/__init__.py +1 -1
- langgraph_runtime_inmem/database.py +2 -0
- langgraph_runtime_inmem/ops.py +40 -21
- {langgraph_runtime_inmem-0.6.4.dist-info → langgraph_runtime_inmem-0.6.6.dist-info}/METADATA +1 -1
- {langgraph_runtime_inmem-0.6.4.dist-info → langgraph_runtime_inmem-0.6.6.dist-info}/RECORD +6 -6
- {langgraph_runtime_inmem-0.6.4.dist-info → langgraph_runtime_inmem-0.6.6.dist-info}/WHEEL +0 -0
|
@@ -182,6 +182,8 @@ async def start_pool() -> None:
|
|
|
182
182
|
for a in GLOBAL_STORE["assistants"]:
|
|
183
183
|
if a["metadata"].get("created_by") == "system":
|
|
184
184
|
GLOBAL_STORE["assistants"].remove(a)
|
|
185
|
+
if "context" not in a:
|
|
186
|
+
a["context"] = {}
|
|
185
187
|
for k in ["crons"]:
|
|
186
188
|
if not GLOBAL_STORE.get(k):
|
|
187
189
|
GLOBAL_STORE[k] = {}
|
langgraph_runtime_inmem/ops.py
CHANGED
|
@@ -378,7 +378,7 @@ class Assistants(Authenticated):
|
|
|
378
378
|
"version": new_version,
|
|
379
379
|
"graph_id": graph_id if graph_id is not None else assistant["graph_id"],
|
|
380
380
|
"config": config if config is not None else assistant["config"],
|
|
381
|
-
"context": context if context is not None else assistant
|
|
381
|
+
"context": context if context is not None else assistant.get("context", {}),
|
|
382
382
|
"metadata": metadata if metadata is not None else assistant["metadata"],
|
|
383
383
|
"created_at": now,
|
|
384
384
|
"name": name if name is not None else assistant["name"],
|
|
@@ -1958,10 +1958,16 @@ class Runs(Authenticated):
|
|
|
1958
1958
|
# wait for the run to complete
|
|
1959
1959
|
# Rely on this join's auth
|
|
1960
1960
|
async for mode, chunk, _ in Runs.Stream.join(
|
|
1961
|
-
run_id,
|
|
1961
|
+
run_id,
|
|
1962
|
+
thread_id=thread_id,
|
|
1963
|
+
ctx=ctx,
|
|
1964
|
+
ignore_404=True,
|
|
1965
|
+
stream_mode=["values", "updates", "error"],
|
|
1962
1966
|
):
|
|
1963
1967
|
if mode == b"values":
|
|
1964
1968
|
last_chunk = chunk
|
|
1969
|
+
elif mode == b"updates" and b"__interrupt__" in chunk:
|
|
1970
|
+
last_chunk = chunk
|
|
1965
1971
|
elif mode == b"error":
|
|
1966
1972
|
last_chunk = orjson.dumps({"__error__": orjson.Fragment(chunk)})
|
|
1967
1973
|
# if we received a final chunk, return it
|
|
@@ -2217,16 +2223,20 @@ class Runs(Authenticated):
|
|
|
2217
2223
|
thread_id: UUID,
|
|
2218
2224
|
ignore_404: bool = False,
|
|
2219
2225
|
cancel_on_disconnect: bool = False,
|
|
2220
|
-
|
|
2226
|
+
stream_channel: asyncio.Queue | None = None,
|
|
2227
|
+
stream_mode: list[StreamMode] | StreamMode,
|
|
2221
2228
|
last_event_id: str | None = None,
|
|
2222
2229
|
ctx: Auth.types.BaseAuthContext | None = None,
|
|
2223
2230
|
) -> AsyncIterator[tuple[bytes, bytes, bytes | None]]:
|
|
2224
2231
|
"""Stream the run output."""
|
|
2225
2232
|
from langgraph_api.asyncio import create_task
|
|
2226
2233
|
|
|
2234
|
+
if stream_mode and not isinstance(stream_mode, list):
|
|
2235
|
+
stream_mode = [stream_mode]
|
|
2236
|
+
|
|
2227
2237
|
queue = (
|
|
2228
|
-
|
|
2229
|
-
if
|
|
2238
|
+
stream_channel
|
|
2239
|
+
if stream_channel
|
|
2230
2240
|
else await Runs.Stream.subscribe(run_id, stream_mode=stream_mode)
|
|
2231
2241
|
)
|
|
2232
2242
|
|
|
@@ -2247,6 +2257,7 @@ class Runs(Authenticated):
|
|
|
2247
2257
|
status_code=404, detail="Thread not found"
|
|
2248
2258
|
)
|
|
2249
2259
|
)
|
|
2260
|
+
run = await Runs.get(conn, run_id, thread_id=thread_id, ctx=ctx)
|
|
2250
2261
|
channel_prefix = f"run:{run_id}:stream:"
|
|
2251
2262
|
len_prefix = len(channel_prefix.encode())
|
|
2252
2263
|
|
|
@@ -2258,14 +2269,18 @@ class Runs(Authenticated):
|
|
|
2258
2269
|
if data == b"done":
|
|
2259
2270
|
return
|
|
2260
2271
|
else:
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2272
|
+
mode = topic[len_prefix:]
|
|
2273
|
+
if mode == b"updates" and "updates" not in stream_mode:
|
|
2274
|
+
continue
|
|
2275
|
+
else:
|
|
2276
|
+
yield mode, data, id
|
|
2277
|
+
logger.debug(
|
|
2278
|
+
"Replayed run event",
|
|
2279
|
+
run_id=str(run_id),
|
|
2280
|
+
message_id=id,
|
|
2281
|
+
stream_mode=mode,
|
|
2282
|
+
data=data,
|
|
2283
|
+
)
|
|
2269
2284
|
|
|
2270
2285
|
while True:
|
|
2271
2286
|
try:
|
|
@@ -2278,14 +2293,18 @@ class Runs(Authenticated):
|
|
|
2278
2293
|
break
|
|
2279
2294
|
else:
|
|
2280
2295
|
# Extract mode from topic
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2296
|
+
mode = topic[len_prefix:]
|
|
2297
|
+
if mode == b"updates" and "updates" not in stream_mode:
|
|
2298
|
+
continue
|
|
2299
|
+
else:
|
|
2300
|
+
yield mode, data, id
|
|
2301
|
+
logger.debug(
|
|
2302
|
+
"Streamed run event",
|
|
2303
|
+
run_id=str(run_id),
|
|
2304
|
+
stream_mode=mode,
|
|
2305
|
+
message_id=id,
|
|
2306
|
+
data=data,
|
|
2307
|
+
)
|
|
2289
2308
|
except TimeoutError:
|
|
2290
2309
|
# Check if the run is still pending
|
|
2291
2310
|
run_iter = await Runs.get(
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
langgraph_runtime_inmem/__init__.py,sha256=
|
|
1
|
+
langgraph_runtime_inmem/__init__.py,sha256=KDmH2YP4H44U-xjgCT_hgTMK9eR-VgmkmI6wGA-0k4g,310
|
|
2
2
|
langgraph_runtime_inmem/checkpoint.py,sha256=nc1G8DqVdIu-ibjKTqXfbPfMbAsKjPObKqegrSzo6Po,4432
|
|
3
|
-
langgraph_runtime_inmem/database.py,sha256=
|
|
3
|
+
langgraph_runtime_inmem/database.py,sha256=G_6L2khpRDSpS2Vs_SujzHayODcwG5V2IhFP7LLBXgw,6349
|
|
4
4
|
langgraph_runtime_inmem/inmem_stream.py,sha256=65z_2mBNJ0-yJsXWnlYwRc71039_y6Sa0MN8fL_U3Ko,4581
|
|
5
5
|
langgraph_runtime_inmem/lifespan.py,sha256=t0w2MX2dGxe8yNtSX97Z-d2pFpllSLS4s1rh2GJDw5M,3557
|
|
6
6
|
langgraph_runtime_inmem/metrics.py,sha256=HhO0RC2bMDTDyGBNvnd2ooLebLA8P1u5oq978Kp_nAA,392
|
|
7
|
-
langgraph_runtime_inmem/ops.py,sha256=
|
|
7
|
+
langgraph_runtime_inmem/ops.py,sha256=QHkoJiiKoKuMTNKlkpApxNsDhiR2CtlcQDR-zraTuew,89412
|
|
8
8
|
langgraph_runtime_inmem/queue.py,sha256=nqfgz7j_Jkh5Ek5-RsHB2Uvwbxguu9IUPkGXIxvFPns,10037
|
|
9
9
|
langgraph_runtime_inmem/retry.py,sha256=XmldOP4e_H5s264CagJRVnQMDFcEJR_dldVR1Hm5XvM,763
|
|
10
10
|
langgraph_runtime_inmem/store.py,sha256=rTfL1JJvd-j4xjTrL8qDcynaWF6gUJ9-GDVwH0NBD_I,3506
|
|
11
|
-
langgraph_runtime_inmem-0.6.
|
|
12
|
-
langgraph_runtime_inmem-0.6.
|
|
13
|
-
langgraph_runtime_inmem-0.6.
|
|
11
|
+
langgraph_runtime_inmem-0.6.6.dist-info/METADATA,sha256=hkFJC5S9J-g-c1eGRwLWUh1nsMCE4omusGOeMIKar8M,565
|
|
12
|
+
langgraph_runtime_inmem-0.6.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
13
|
+
langgraph_runtime_inmem-0.6.6.dist-info/RECORD,,
|
|
File without changes
|