Add get_store function

This commit is contained in:
Nuno Campos
2025-01-20 16:03:27 -08:00
parent ac64f50383
commit b2213e523e
+8 -1
View File
@@ -23,9 +23,11 @@ from langgraph.constants import (
CONFIG_KEY_CHECKPOINT_ID,
CONFIG_KEY_CHECKPOINT_MAP,
CONFIG_KEY_CHECKPOINT_NS,
CONFIG_KEY_STORE,
NS_END,
NS_SEP,
)
from langgraph.store.base import BaseStore
def recast_checkpoint_ns(ns: str) -> str:
@@ -332,4 +334,9 @@ def get_config() -> RunnableConfig:
if var_config := var_child_runnable_config.get():
return var_config
else:
raise RuntimeError("Called get_configurable outside of a runnable context")
raise RuntimeError("Called get_config outside of a runnable context")
def get_store() -> BaseStore:
config = get_config()
return config[CONF][CONFIG_KEY_STORE]