-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsitecustomize.py
More file actions
38 lines (26 loc) · 1.17 KB
/
Copy pathsitecustomize.py
File metadata and controls
38 lines (26 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""Process-wide compatibility shims loaded automatically by Python startup.
This module is imported by Python's site initialization when present on sys.path.
It provides a narrow workaround for incompatible langgraph/langgraph-prebuilt
combinations that expect newer runtime symbols/attributes.
"""
from typing import TypedDict
def _patch_langgraph_runtime() -> None:
try:
import langgraph.runtime as runtime_mod
except Exception:
return
if not hasattr(runtime_mod, "ExecutionInfo"):
class ExecutionInfo(TypedDict, total=False):
pass
runtime_mod.ExecutionInfo = ExecutionInfo # type: ignore[attr-defined]
if not hasattr(runtime_mod, "ServerInfo"):
class ServerInfo(TypedDict, total=False):
pass
runtime_mod.ServerInfo = ServerInfo # type: ignore[attr-defined]
runtime_cls = getattr(runtime_mod, "Runtime", None)
if runtime_cls is not None:
if not hasattr(runtime_cls, "execution_info"):
setattr(runtime_cls, "execution_info", None)
if not hasattr(runtime_cls, "server_info"):
setattr(runtime_cls, "server_info", None)
_patch_langgraph_runtime()