-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path__init__.py
More file actions
60 lines (52 loc) · 2.2 KB
/
Copy path__init__.py
File metadata and controls
60 lines (52 loc) · 2.2 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""GraphAnything — turn anything into a knowledge graph.
Public API for the unified graph-construction core. Three drivers consume it:
- CLI / REPL (human-driven) → `graphanything` console-script
- Skill / MCP (Claude-driven) → /graphanything
- Agent SDK (LLM-driven, headless) → register your own driver
All three go through the same Session state machine + extractor registry +
viz module. Adding a new source = registering an Extractor; adding a new
shell = wrapping the 5 verbs (propose / refine / sample / review / run).
LLM calls go through GraphAnything's built-in OpenAI-compatible client at
`GraphAnything.llm_client`, which talks to any `chat.completions`-shaped
endpoint (vLLM serve, llama.cpp, Ollama, LM Studio, OpenAI, …). 8 built-in
extractors, 10 schema presets, 9 viz formats, 17 MCP tools, 19 CLI
sub-commands.
"""
from __future__ import annotations
__all__ = [
"open_session",
"load_session",
"Session",
"Schema",
"register_extractor",
"list_extractors",
"run_extractor",
"list_presets",
"load_preset",
"render",
"ProvenanceStamp",
"attach_provenance",
]
def __getattr__(name):
# Lazy imports so heavy deps (networkx, prompt_toolkit) are only loaded
# when actually used. Keeps `graphanything --help` snappy.
import importlib
_map = {
"open_session": (".session", "open_session"),
"load_session": (".session", "load_session"),
"Session": (".session", "Session"),
"Schema": (".schema", "Schema"),
"register_extractor": (".extractors", "register_extractor"),
"list_extractors": (".extractors", "list_extractors"),
"run_extractor": (".extractors", "run_extractor"),
"list_presets": (".schema", "list_presets"),
"load_preset": (".schema", "load_preset"),
"render": (".viz", "render"),
"ProvenanceStamp": (".provenance", "ProvenanceStamp"),
"attach_provenance": (".provenance", "attach_provenance"),
}
if name in _map:
mod_name, attr = _map[name]
mod = importlib.import_module(mod_name, package=__name__)
return getattr(mod, attr)
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")