codekingpro/portable-devtools
114k
1import sys2from typing import Any3from warnings import warn4 5from langgraph._internal._constants import (6 CONF,7 CONFIG_KEY_CHECKPOINTER,8 TASKS,9)10from langgraph.warnings import LangGraphDeprecatedSinceV1011 12__all__ = (13 "TAG_NOSTREAM",14 "TAG_HIDDEN",15 "START",16 "END",17 # retained for backwards compatibility (mostly langgraph-api), should be removed in v2 (or earlier)18 "CONF",19 "TASKS",20 "CONFIG_KEY_CHECKPOINTER",21)22 23# --- Public constants ---24TAG_NOSTREAM = sys.intern("nostream")25"""Tag to disable streaming for a chat model."""26TAG_HIDDEN = sys.intern("langsmith:hidden")27"""Tag to hide a node/edge from certain tracing/streaming environments."""28END = sys.intern("__end__")29"""The last (maybe virtual) node in graph-style Pregel."""30START = sys.intern("__start__")31"""The first (maybe virtual) node in graph-style Pregel."""32 33 34def __getattr__(name: str) -> Any:35 if name in ["Send", "Interrupt"]:36 warn(37 f"Importing {name} from langgraph.constants is deprecated. "38 f"Please use 'from langgraph.types import {name}' instead.",39 LangGraphDeprecatedSinceV10,40 stacklevel=2,41 )42 43 from importlib import import_module44 45 module = import_module("langgraph.types")46 return getattr(module, name)47 48 try:49 from importlib import import_module50 51 private_constants = import_module("langgraph._internal._constants")52 attr = getattr(private_constants, name)53 warn(54 f"Importing {name} from langgraph.constants is deprecated. "55 f"This constant is now private and should not be used directly. "56 "Please let the LangGraph team know if you need this value.",57 LangGraphDeprecatedSinceV10,58 stacklevel=2,59 )60 return attr61 except AttributeError:62 pass63 64 raise AttributeError(f"module has no attribute '{name}'")65 