MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / load_subgraph_config

Function load_subgraph_config

workflow/subgraph_loader.py:63–78  ·  view source on GitHub ↗

Load a subgraph definition from disk. Returns a tuple of (graph_dict, resolved_path).

(file_path: str, *, parent_source: str | None = None)

Source from the content-addressed store, hash-verified

61
62
63def load_subgraph_config(file_path: str, *, parent_source: str | None = None) -> Tuple[Dict[str, Any], Dict[str, Any], str]:
64 """Load a subgraph definition from disk.
65
66 Returns a tuple of (graph_dict, resolved_path).
67 """
68
69 candidates = _resolve_candidate_paths(file_path, parent_source)
70 resolved_path = _resolve_existing_path(candidates).resolve()
71
72 if resolved_path not in _SUBGRAPH_CACHE:
73 _SUBGRAPH_CACHE[resolved_path] = _load_graph_dict(resolved_path)
74
75 payload = _SUBGRAPH_CACHE[resolved_path]
76 graph_dict = deepcopy(payload["graph"])
77 vars_dict = dict(payload["vars"])
78 return graph_dict, vars_dict, str(resolved_path)
79
80
81__all__ = ["load_subgraph_config"]

Callers 1

_build_subgraphMethod · 0.90

Calls 4

_resolve_candidate_pathsFunction · 0.85
_resolve_existing_pathFunction · 0.85
_load_graph_dictFunction · 0.85
resolveMethod · 0.80

Tested by

no test coverage detected