mindgraph-sdk 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0 (2026-04-16)
4
+
5
+ ### Synthesis (Projects)
6
+
7
+ Scoped-corpus synthesis: mine cross-document signals for a `Project` and turn top idea clusters into Article nodes via a background job.
8
+
9
+ - `signals(project_uid, *, signals=None, target_types=None)` — `GET /synthesis/signals/{project_uid}`. Returns entity bridges, claim hubs, ranked/clustered claim hubs, theory support gaps, concept clusters, analogy candidates, and dialectical pairs.
10
+ - `run_synthesis(project_uid)` — `POST /synthesis/run/{project_uid}`. Spawns a background synthesis job and returns `{"job_id": ...}`; poll with `get_job()`.
11
+
3
12
  ## 0.2.0 (2026-03-30)
4
13
 
5
14
  ### New Entity Types
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mindgraph-sdk
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Python client for the MindGraph Cloud API
5
5
  License-Expression: MIT
6
6
  Keywords: agent,ai,cognitive,knowledge-graph,mindgraph
@@ -125,6 +125,23 @@ entity = graph.find_or_create_entity("Some Entity")
125
125
  | `governance(**kwargs)` | Create policies, set safety budgets, request/resolve approvals |
126
126
  | `execution(**kwargs)` | Track execution lifecycle and register agents |
127
127
 
128
+ ### Synthesis (Projects)
129
+
130
+ Scope a corpus to a `Project` (via `commit(action="project", ...)` then link documents with `PartOfProject`), then mine cross-document signals and generate synthesis articles.
131
+
132
+ | Method | Description |
133
+ |--------|-------------|
134
+ | `signals(project_uid, *, signals?, target_types?)` | Mine cross-document structural signals for a project |
135
+ | `run_synthesis(project_uid)` | Spawn async synthesis job that turns top clusters into Article nodes; returns `{"job_id": ...}` |
136
+
137
+ ```python
138
+ project = graph.commit(action="project", label="Q2 China strategy")
139
+ # ...link documents to the project via PartOfProject edges...
140
+ signals = graph.signals(project["uid"], signals="clustered_claim_hubs,dialectical_pairs")
141
+ job = graph.run_synthesis(project["uid"])
142
+ status = graph.get_job(job["job_id"])
143
+ ```
144
+
128
145
  ### CRUD
129
146
 
130
147
  | Method | Description |
@@ -111,6 +111,23 @@ entity = graph.find_or_create_entity("Some Entity")
111
111
  | `governance(**kwargs)` | Create policies, set safety budgets, request/resolve approvals |
112
112
  | `execution(**kwargs)` | Track execution lifecycle and register agents |
113
113
 
114
+ ### Synthesis (Projects)
115
+
116
+ Scope a corpus to a `Project` (via `commit(action="project", ...)` then link documents with `PartOfProject`), then mine cross-document signals and generate synthesis articles.
117
+
118
+ | Method | Description |
119
+ |--------|-------------|
120
+ | `signals(project_uid, *, signals?, target_types?)` | Mine cross-document structural signals for a project |
121
+ | `run_synthesis(project_uid)` | Spawn async synthesis job that turns top clusters into Article nodes; returns `{"job_id": ...}` |
122
+
123
+ ```python
124
+ project = graph.commit(action="project", label="Q2 China strategy")
125
+ # ...link documents to the project via PartOfProject edges...
126
+ signals = graph.signals(project["uid"], signals="clustered_claim_hubs,dialectical_pairs")
127
+ job = graph.run_synthesis(project["uid"])
128
+ status = graph.get_job(job["job_id"])
129
+ ```
130
+
114
131
  ### CRUD
115
132
 
116
133
  | Method | Description |
@@ -24,6 +24,7 @@ class MindGraph:
24
24
  *,
25
25
  api_key: str | None = None,
26
26
  jwt: str | None = None,
27
+ org_id: str | None = None,
27
28
  timeout: float = 30.0,
28
29
  max_retries: int = 3,
29
30
  retry_backoff: float = 1.0,
@@ -36,6 +37,8 @@ class MindGraph:
36
37
  headers["Authorization"] = f"Bearer {api_key}"
37
38
  elif jwt:
38
39
  headers["Authorization"] = f"Bearer {jwt}"
40
+ if org_id:
41
+ headers["X-MindGraph-Org"] = org_id
39
42
  self._client = httpx.Client(
40
43
  base_url=self.base_url, headers=headers, timeout=timeout
41
44
  )
@@ -1065,3 +1068,46 @@ class MindGraph:
1065
1068
  """Backfill: compile articles for all documents and eligible entities."""
1066
1069
  return self._request("POST", "/wiki/compile/all")
1067
1070
 
1071
+ # ---- Synthesis (Projects) ----
1072
+
1073
+ def signals(
1074
+ self,
1075
+ project_uid: str,
1076
+ *,
1077
+ signals: str | None = None,
1078
+ target_types: str | None = None,
1079
+ ) -> dict[str, Any]:
1080
+ """Mine cross-document structural signals for a project's corpus.
1081
+
1082
+ Returns entity bridges, claim hubs, ranked/clustered claim hubs,
1083
+ theory support gaps, concept clusters, analogy candidates, and
1084
+ dialectical pairs. Blocking; no LLM calls.
1085
+
1086
+ Args:
1087
+ project_uid: UID of the Project node.
1088
+ signals: Comma-separated subset of signal names to compute
1089
+ (e.g. ``"clustered_claim_hubs,dialectical_pairs"``). If
1090
+ omitted, all signals run.
1091
+ target_types: Comma-separated node types filter for
1092
+ ``entity_bridges`` and ``claim_hubs``.
1093
+ """
1094
+ params: dict[str, str] = {}
1095
+ if signals is not None:
1096
+ params["signals"] = signals
1097
+ if target_types is not None:
1098
+ params["target_types"] = target_types
1099
+ qs = "&".join(f"{k}={v}" for k, v in params.items())
1100
+ path = f"/synthesis/signals/{project_uid}"
1101
+ if qs:
1102
+ path = f"{path}?{qs}"
1103
+ return self._request("GET", path)
1104
+
1105
+ def run_synthesis(self, project_uid: str) -> dict[str, Any]:
1106
+ """Spawn a background synthesis job for a project.
1107
+
1108
+ Mines signals, selects top idea clusters, runs LLM synthesis,
1109
+ and persists candidate Article nodes linked via ``Covers`` edges.
1110
+
1111
+ Returns ``{"job_id": str}``; poll with :meth:`get_job`.
1112
+ """
1113
+ return self._request("POST", f"/synthesis/run/{project_uid}")
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "mindgraph-sdk"
7
- version = "0.3.0"
7
+ version = "0.4.0"
8
8
  description = "Python client for the MindGraph Cloud API"
9
9
  readme = "README.md"
10
10
  license = "MIT"