@littlebigbrain/client 0.13.2 → 0.14.0
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.
- package/dist/client.d.ts +7 -51
- package/dist/client.js +7 -67
- package/dist/namespaces.d.ts +3 -7
- package/dist/namespaces.js +3 -13
- package/dist/schema.d.ts +207 -1243
- package/dist/types.d.ts +0 -2
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -8,14 +8,13 @@ export type { CallOptions, Query, QueryValue, RequestOptions, } from "./transpor
|
|
|
8
8
|
export { EntityNamespace, FactsNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
9
9
|
/**
|
|
10
10
|
* A typed HTTP client for a little big brain graph server. One instance is scoped to a
|
|
11
|
-
* single graph
|
|
11
|
+
* single graph; construct another for a different scope. All methods
|
|
12
12
|
* return the parsed JSON response and throw {@link LbbError} on failure.
|
|
13
13
|
*/
|
|
14
14
|
export declare class LbbClient {
|
|
15
15
|
private readonly baseUrl;
|
|
16
16
|
private readonly apiKey?;
|
|
17
17
|
private readonly graphName?;
|
|
18
|
-
private readonly branchName?;
|
|
19
18
|
private readonly stack?;
|
|
20
19
|
private readonly fetchImpl;
|
|
21
20
|
private readonly apiVersion;
|
|
@@ -38,17 +37,15 @@ export declare class LbbClient {
|
|
|
38
37
|
readonly embeddings: EmbeddingsNamespace;
|
|
39
38
|
constructor(options: LbbClientOptions);
|
|
40
39
|
graph(name: string, opts?: {
|
|
41
|
-
branch?: string;
|
|
42
40
|
stack?: string;
|
|
43
41
|
}): GraphNamespace;
|
|
44
42
|
/**
|
|
45
|
-
* A new client for a different graph
|
|
46
|
-
* Each instance is scoped to one graph
|
|
43
|
+
* A new client for a different graph on the same server and credential.
|
|
44
|
+
* Each instance is scoped to one graph, so use this to target another
|
|
47
45
|
* scope (e.g. creating a fresh graph) without mutating the current client.
|
|
48
46
|
*/
|
|
49
47
|
withScope(scope: {
|
|
50
48
|
graph?: string;
|
|
51
|
-
branch?: string;
|
|
52
49
|
stack?: string;
|
|
53
50
|
}): LbbClient;
|
|
54
51
|
/**
|
|
@@ -142,8 +139,8 @@ export declare class LbbClient {
|
|
|
142
139
|
idempotencyKey?: string;
|
|
143
140
|
}): Promise<Schemas["GraphRetractResponse"]>;
|
|
144
141
|
/**
|
|
145
|
-
* Create the scoped graph
|
|
146
|
-
* with the desired graph
|
|
142
|
+
* Create the scoped graph with an empty ontology. Construct the client
|
|
143
|
+
* with the desired graph first, then call `ontology.define` before
|
|
147
144
|
* writing typed data.
|
|
148
145
|
*/
|
|
149
146
|
createGraph(): Promise<Schemas["CreateGraphResponse"]>;
|
|
@@ -183,33 +180,10 @@ export declare class LbbClient {
|
|
|
183
180
|
observedAt?: string;
|
|
184
181
|
idempotencyKey?: string;
|
|
185
182
|
}): Promise<Schemas["GraphReloadResponse"]>;
|
|
186
|
-
/**
|
|
187
|
-
createBranch(body: Schemas["GraphBranchCreateRequest"]): Promise<Schemas["GraphBranchCreateResponse"]>;
|
|
188
|
-
/**
|
|
189
|
-
* Validate-then-merge: replay `from_branch`'s post-fork commits onto the
|
|
190
|
-
* SCOPED branch (its fork parent) as one new commit. A write — sends an
|
|
191
|
-
* Idempotency-Key so a retry replays instead of re-applying.
|
|
192
|
-
*/
|
|
193
|
-
mergeBranch(body: Schemas["GraphBranchMergeRequest"], opts?: {
|
|
194
|
-
idempotencyKey?: string;
|
|
195
|
-
}): Promise<Schemas["GraphBranchMergeResponse"]>;
|
|
196
|
-
/**
|
|
197
|
-
* Observe: store a conversation episode verbatim as EPISODE evidence,
|
|
198
|
-
* anchor + gate extracted facts on an observe branch, and optionally
|
|
199
|
-
* auto-merge when validation is clean. Flag-gated server-side
|
|
200
|
-
* (`--enable-observe`). A write — carries an Idempotency-Key.
|
|
201
|
-
*/
|
|
202
|
-
observe(body: Schemas["ObserveRequest"], opts?: {
|
|
203
|
-
idempotencyKey?: string;
|
|
204
|
-
}): Promise<Schemas["ObserveResponse"]>;
|
|
205
|
-
/** Delete the scoped graph, including every branch, feedback, and active graph-scoped job. */
|
|
183
|
+
/** Delete the scoped graph, including its feedback and active graph-scoped jobs. */
|
|
206
184
|
deleteGraph(opts: {
|
|
207
185
|
confirm: string;
|
|
208
186
|
}): Promise<Schemas["GraphDeleteResponse"]>;
|
|
209
|
-
/** Delete only the scoped branch. The server refuses to delete a graph's final live branch. */
|
|
210
|
-
deleteBranch(opts: {
|
|
211
|
-
confirm: string;
|
|
212
|
-
}): Promise<Schemas["GraphBranchDeleteResponse"]>;
|
|
213
187
|
/**
|
|
214
188
|
* Captured signals by flush-seq range, oldest first — the model-training
|
|
215
189
|
* feed. The `seq` on each signal is the temporal-split coordinate (train ≤ T,
|
|
@@ -285,16 +259,6 @@ export declare class LbbClient {
|
|
|
285
259
|
externalPlannerTrace(payload: Schemas["ExternalPlannerTraceV1"], opts?: {
|
|
286
260
|
idempotencyKey?: string;
|
|
287
261
|
}): Promise<Schemas["SignalIngestResponse"]>;
|
|
288
|
-
/** Planner training examples at or before an optional signal split. */
|
|
289
|
-
plannerDataset(opts?: {
|
|
290
|
-
limit?: number;
|
|
291
|
-
splitSeq?: number;
|
|
292
|
-
}): Promise<Schemas["PlannerDatasetResponse"]>;
|
|
293
|
-
/** Planner preference pairs at or before an optional signal split. */
|
|
294
|
-
plannerPreferenceDataset(opts?: {
|
|
295
|
-
limit?: number;
|
|
296
|
-
splitSeq?: number;
|
|
297
|
-
}): Promise<Schemas["PlannerPreferenceDatasetResponse"]>;
|
|
298
262
|
/** Suggest-ranker examples at or before an optional signal split. */
|
|
299
263
|
suggestDataset(opts?: {
|
|
300
264
|
limit?: number;
|
|
@@ -314,14 +278,6 @@ export declare class LbbClient {
|
|
|
314
278
|
runId: string;
|
|
315
279
|
allowRegression?: boolean;
|
|
316
280
|
}): Promise<unknown>;
|
|
317
|
-
/**
|
|
318
|
-
* Promote a finished `planner_lora` training run: gated on held-out slot
|
|
319
|
-
* exactness and recorded as a `kind=planner` training run.
|
|
320
|
-
*/
|
|
321
|
-
promotePlanner(opts: {
|
|
322
|
-
runId: string;
|
|
323
|
-
allowRegression?: boolean;
|
|
324
|
-
}): Promise<unknown>;
|
|
325
281
|
/**
|
|
326
282
|
* Append relevance labels for a set of ranked results — how little big brain
|
|
327
283
|
* gathers customer-specific qrels. Grade results (3 ideal/good, 1 partial,
|
|
@@ -489,6 +445,6 @@ export declare class LbbClient {
|
|
|
489
445
|
* rebuild fills it.
|
|
490
446
|
*/
|
|
491
447
|
schemaSummary(): Promise<Schemas["RdfSchemaSummaryResponse"]>;
|
|
492
|
-
/** List the graphs
|
|
448
|
+
/** List the graphs under the scoped tenant. */
|
|
493
449
|
listGraphs(): Promise<Schemas["GraphListResponse"]>;
|
|
494
450
|
}
|
package/dist/client.js
CHANGED
|
@@ -84,14 +84,13 @@ async function durableImportBody(source) {
|
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
86
|
* A typed HTTP client for a little big brain graph server. One instance is scoped to a
|
|
87
|
-
* single graph
|
|
87
|
+
* single graph; construct another for a different scope. All methods
|
|
88
88
|
* return the parsed JSON response and throw {@link LbbError} on failure.
|
|
89
89
|
*/
|
|
90
90
|
export class LbbClient {
|
|
91
91
|
baseUrl;
|
|
92
92
|
apiKey;
|
|
93
93
|
graphName;
|
|
94
|
-
branchName;
|
|
95
94
|
stack;
|
|
96
95
|
fetchImpl;
|
|
97
96
|
apiVersion;
|
|
@@ -120,7 +119,6 @@ export class LbbClient {
|
|
|
120
119
|
this.baseUrl = baseUrl.replace(/\/+$/, "");
|
|
121
120
|
this.apiKey = options.apiKey;
|
|
122
121
|
this.graphName = options.graph;
|
|
123
|
-
this.branchName = options.branch;
|
|
124
122
|
this.stack = options.stack;
|
|
125
123
|
this.apiVersion = options.apiVersion ?? "2026-07-23";
|
|
126
124
|
this.maxRetries = options.maxRetries ?? 6;
|
|
@@ -160,13 +158,12 @@ export class LbbClient {
|
|
|
160
158
|
graph(name, opts = {}) {
|
|
161
159
|
return new GraphNamespace(this.withScope({
|
|
162
160
|
graph: name,
|
|
163
|
-
branch: opts.branch ?? this.branchName,
|
|
164
161
|
stack: opts.stack ?? this.stack,
|
|
165
162
|
}));
|
|
166
163
|
}
|
|
167
164
|
/**
|
|
168
|
-
* A new client for a different graph
|
|
169
|
-
* Each instance is scoped to one graph
|
|
165
|
+
* A new client for a different graph on the same server and credential.
|
|
166
|
+
* Each instance is scoped to one graph, so use this to target another
|
|
170
167
|
* scope (e.g. creating a fresh graph) without mutating the current client.
|
|
171
168
|
*/
|
|
172
169
|
withScope(scope) {
|
|
@@ -174,7 +171,6 @@ export class LbbClient {
|
|
|
174
171
|
baseUrl: this.baseUrl,
|
|
175
172
|
apiKey: this.apiKey,
|
|
176
173
|
graph: scope.graph ?? this.graphName,
|
|
177
|
-
branch: scope.branch ?? this.branchName,
|
|
178
174
|
stack: scope.stack ?? this.stack,
|
|
179
175
|
fetch: this.fetchImpl,
|
|
180
176
|
apiVersion: this.apiVersion,
|
|
@@ -222,8 +218,6 @@ export class LbbClient {
|
|
|
222
218
|
const push = (key, value) => params.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
223
219
|
if (this.graphName !== undefined)
|
|
224
220
|
push("graph", this.graphName);
|
|
225
|
-
if (this.branchName !== undefined)
|
|
226
|
-
push("branch", this.branchName);
|
|
227
221
|
if (this.stack !== undefined)
|
|
228
222
|
push("stack", this.stack);
|
|
229
223
|
for (const [key, value] of Object.entries(query ?? {})) {
|
|
@@ -604,8 +598,8 @@ export class LbbClient {
|
|
|
604
598
|
});
|
|
605
599
|
}
|
|
606
600
|
/**
|
|
607
|
-
* Create the scoped graph
|
|
608
|
-
* with the desired graph
|
|
601
|
+
* Create the scoped graph with an empty ontology. Construct the client
|
|
602
|
+
* with the desired graph first, then call `ontology.define` before
|
|
609
603
|
* writing typed data.
|
|
610
604
|
*/
|
|
611
605
|
createGraph() {
|
|
@@ -658,46 +652,13 @@ export class LbbClient {
|
|
|
658
652
|
idempotencyKey: opts.idempotencyKey ?? this.idempotencyKey("reload"),
|
|
659
653
|
});
|
|
660
654
|
}
|
|
661
|
-
/**
|
|
662
|
-
createBranch(body) {
|
|
663
|
-
return this.request("POST", "/v1/graph/branch", { body });
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* Validate-then-merge: replay `from_branch`'s post-fork commits onto the
|
|
667
|
-
* SCOPED branch (its fork parent) as one new commit. A write — sends an
|
|
668
|
-
* Idempotency-Key so a retry replays instead of re-applying.
|
|
669
|
-
*/
|
|
670
|
-
mergeBranch(body, opts = {}) {
|
|
671
|
-
return this.request("POST", "/v1/graph/branch/merge", {
|
|
672
|
-
body,
|
|
673
|
-
idempotencyKey: opts.idempotencyKey ?? this.idempotencyKey("branch-merge"),
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* Observe: store a conversation episode verbatim as EPISODE evidence,
|
|
678
|
-
* anchor + gate extracted facts on an observe branch, and optionally
|
|
679
|
-
* auto-merge when validation is clean. Flag-gated server-side
|
|
680
|
-
* (`--enable-observe`). A write — carries an Idempotency-Key.
|
|
681
|
-
*/
|
|
682
|
-
observe(body, opts = {}) {
|
|
683
|
-
return this.request("POST", "/v1/memory/observe", {
|
|
684
|
-
body,
|
|
685
|
-
idempotencyKey: opts.idempotencyKey ?? this.idempotencyKey("observe"),
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
/** Delete the scoped graph, including every branch, feedback, and active graph-scoped job. */
|
|
655
|
+
/** Delete the scoped graph, including its feedback and active graph-scoped jobs. */
|
|
689
656
|
deleteGraph(opts) {
|
|
690
657
|
return this.request("POST", "/v1/graph/delete", {
|
|
691
658
|
query: { confirm: opts.confirm },
|
|
692
659
|
retry: true,
|
|
693
660
|
});
|
|
694
661
|
}
|
|
695
|
-
/** Delete only the scoped branch. The server refuses to delete a graph's final live branch. */
|
|
696
|
-
deleteBranch(opts) {
|
|
697
|
-
return this.request("DELETE", "/v1/graph/branch", {
|
|
698
|
-
query: { confirm: opts.confirm },
|
|
699
|
-
});
|
|
700
|
-
}
|
|
701
662
|
// --- models as runs (training-run registry + eval machinery) ---
|
|
702
663
|
/**
|
|
703
664
|
* Captured signals by flush-seq range, oldest first — the model-training
|
|
@@ -803,18 +764,6 @@ export class LbbClient {
|
|
|
803
764
|
],
|
|
804
765
|
}, opts);
|
|
805
766
|
}
|
|
806
|
-
/** Planner training examples at or before an optional signal split. */
|
|
807
|
-
plannerDataset(opts = {}) {
|
|
808
|
-
return this.request("GET", "/v1/models/planner-dataset", {
|
|
809
|
-
query: { limit: opts.limit, split_seq: opts.splitSeq },
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
/** Planner preference pairs at or before an optional signal split. */
|
|
813
|
-
plannerPreferenceDataset(opts = {}) {
|
|
814
|
-
return this.request("GET", "/v1/models/planner-preference-dataset", {
|
|
815
|
-
query: { limit: opts.limit, split_seq: opts.splitSeq },
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
767
|
/** Suggest-ranker examples at or before an optional signal split. */
|
|
819
768
|
suggestDataset(opts = {}) {
|
|
820
769
|
return this.request("GET", "/v1/models/suggest-dataset", {
|
|
@@ -837,15 +786,6 @@ export class LbbClient {
|
|
|
837
786
|
query: { run_id: opts.runId, allow_regression: opts.allowRegression },
|
|
838
787
|
});
|
|
839
788
|
}
|
|
840
|
-
/**
|
|
841
|
-
* Promote a finished `planner_lora` training run: gated on held-out slot
|
|
842
|
-
* exactness and recorded as a `kind=planner` training run.
|
|
843
|
-
*/
|
|
844
|
-
promotePlanner(opts) {
|
|
845
|
-
return this.request("POST", "/v1/models/promote-planner", {
|
|
846
|
-
query: { run_id: opts.runId, allow_regression: opts.allowRegression },
|
|
847
|
-
});
|
|
848
|
-
}
|
|
849
789
|
// --- relevance feedback ---
|
|
850
790
|
/**
|
|
851
791
|
* Append relevance labels for a set of ranked results — how little big brain
|
|
@@ -1128,7 +1068,7 @@ export class LbbClient {
|
|
|
1128
1068
|
schemaSummary() {
|
|
1129
1069
|
return this.request("GET", "/v1/graph/schema-summary");
|
|
1130
1070
|
}
|
|
1131
|
-
/** List the graphs
|
|
1071
|
+
/** List the graphs under the scoped tenant. */
|
|
1132
1072
|
listGraphs() {
|
|
1133
1073
|
return this.request("GET", "/v1/graphs");
|
|
1134
1074
|
}
|
package/dist/namespaces.d.ts
CHANGED
|
@@ -12,10 +12,9 @@ export declare class GraphNamespace {
|
|
|
12
12
|
readonly evals: EvalsNamespace;
|
|
13
13
|
readonly embeddings: EmbeddingsNamespace;
|
|
14
14
|
constructor(client: LbbClient);
|
|
15
|
-
|
|
16
|
-
/** Publication lifecycle for this graph/branch, including pre-first-publish state. */
|
|
15
|
+
/** Publication lifecycle for this graph, including pre-first-publish state. */
|
|
17
16
|
publicationStatus(): Promise<Schemas["PublicationStatusResponse"]>;
|
|
18
|
-
/** Wait until this graph
|
|
17
|
+
/** Wait until this graph has an exact generation covering `targetSeq`. */
|
|
19
18
|
waitForPublished(targetSeq: number, opts?: {
|
|
20
19
|
timeoutMs?: number;
|
|
21
20
|
pollIntervalMs?: number;
|
|
@@ -24,9 +23,6 @@ export declare class GraphNamespace {
|
|
|
24
23
|
delete(opts: {
|
|
25
24
|
confirm: string;
|
|
26
25
|
} & CallOptions): Promise<Schemas["GraphDeleteResponse"]>;
|
|
27
|
-
deleteBranch(opts: {
|
|
28
|
-
confirm: string;
|
|
29
|
-
} & CallOptions): Promise<Schemas["GraphBranchDeleteResponse"]>;
|
|
30
26
|
/** Retract edges/entities from the scoped graph. See {@link LbbClient.retract}. */
|
|
31
27
|
retract(body: Schemas["GraphRetractRequest"], opts?: CallOptions): Promise<Schemas["GraphRetractResponse"]>;
|
|
32
28
|
}
|
|
@@ -96,7 +92,7 @@ export declare class EntityNamespace {
|
|
|
96
92
|
export declare class EmbeddingsNamespace {
|
|
97
93
|
private readonly client;
|
|
98
94
|
constructor(client: LbbClient);
|
|
99
|
-
/** Every embedding of the
|
|
95
|
+
/** Every embedding of the graph with its status. */
|
|
100
96
|
list(opts?: CallOptions): Promise<Schemas["EmbeddingListResponse"]>;
|
|
101
97
|
/** One embedding: serving and building version, backfill, lag, recall. */
|
|
102
98
|
get(name: string, opts?: CallOptions): Promise<Schemas["EmbeddingStatus"]>;
|
package/dist/namespaces.js
CHANGED
|
@@ -37,14 +37,11 @@ export class GraphNamespace {
|
|
|
37
37
|
this.evals = client.evals;
|
|
38
38
|
this.embeddings = client.embeddings;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
return new GraphNamespace(this.client.withScope({ branch: name }));
|
|
42
|
-
}
|
|
43
|
-
/** Publication lifecycle for this graph/branch, including pre-first-publish state. */
|
|
40
|
+
/** Publication lifecycle for this graph, including pre-first-publish state. */
|
|
44
41
|
publicationStatus() {
|
|
45
42
|
return this.client.publicationStatus();
|
|
46
43
|
}
|
|
47
|
-
/** Wait until this graph
|
|
44
|
+
/** Wait until this graph has an exact generation covering `targetSeq`. */
|
|
48
45
|
waitForPublished(targetSeq, opts = {}) {
|
|
49
46
|
return this.client.waitForPublished(targetSeq, opts);
|
|
50
47
|
}
|
|
@@ -59,13 +56,6 @@ export class GraphNamespace {
|
|
|
59
56
|
retry: request.retry ?? true,
|
|
60
57
|
});
|
|
61
58
|
}
|
|
62
|
-
deleteBranch(opts) {
|
|
63
|
-
const { confirm, ...request } = opts;
|
|
64
|
-
return this.client.request("DELETE", "/v1/graph/branch", {
|
|
65
|
-
...request,
|
|
66
|
-
query: { confirm },
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
59
|
/** Retract edges/entities from the scoped graph. See {@link LbbClient.retract}. */
|
|
70
60
|
retract(body, opts = {}) {
|
|
71
61
|
return this.client.request("POST", "/v1/graph/retract", {
|
|
@@ -214,7 +204,7 @@ export class EmbeddingsNamespace {
|
|
|
214
204
|
constructor(client) {
|
|
215
205
|
this.client = client;
|
|
216
206
|
}
|
|
217
|
-
/** Every embedding of the
|
|
207
|
+
/** Every embedding of the graph with its status. */
|
|
218
208
|
list(opts = {}) {
|
|
219
209
|
return this.client.request("GET", "/v1/embeddings", opts);
|
|
220
210
|
}
|