@littlebigbrain/client 0.2.0 → 0.3.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/README.md +1 -2
- package/dist/client.d.ts +21 -43
- package/dist/client.js +53 -62
- package/dist/index.d.ts +1 -1
- package/dist/namespaces.d.ts +5 -21
- package/dist/namespaces.js +18 -31
- package/dist/schema.d.ts +211 -7
- package/dist/types.d.ts +22 -37
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @littlebigbrain/client
|
|
2
2
|
|
|
3
|
-
TypeScript client for the [
|
|
3
|
+
TypeScript client for the [little big brain](https://littlebigbrain.com) graph + hybrid search HTTP
|
|
4
4
|
API. Request and response types are generated from the committed
|
|
5
5
|
[`contracts/openapi.json`](https://github.com/littlebigbrains/lbb-typescript/blob/main/contracts/openapi.json) (the single source of
|
|
6
6
|
truth, derived from the Rust `lbb-api` types); the client itself is a thin,
|
|
@@ -105,7 +105,6 @@ and `elapsedMs`.
|
|
|
105
105
|
| Index lifecycle | `indexes.run`, `indexes.build`, `indexes.delta`, `indexes.gc`, `compact` |
|
|
106
106
|
| Inspection | `entities.list`, `entities.filterByAttributes`, `status`, `metadata`, `summary` |
|
|
107
107
|
| Schema activation | `schema.view`, `schema.preview`, `schema.publish`, `schema.audit` |
|
|
108
|
-
| Database admin | `admin.createStack`, `admin.stack`, `admin.rotateStackKey`, `admin.deleteStack` |
|
|
109
108
|
|
|
110
109
|
Common request/response shapes have direct imports such as `SearchRequest`,
|
|
111
110
|
`SearchResponse`, `Entity`, `GraphSummary`, `CommitRequest`, `AskResponse`, and
|
package/dist/client.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { ImportLine,
|
|
1
|
+
import type { ImportLine, LbbClientOptions, LbbStackActivityResponse, LbbStackActivityWindow, ListResponse, RawLbbResponse, RdfExportOptions, RdfImportOptions, Schemas, SparqlResults } from "./types.js";
|
|
2
2
|
import { type RequestOptions } from "./transport.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ContextNamespace, EntityNamespace, GraphNamespace, IndexNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace } from "./namespaces.js";
|
|
4
4
|
export { parseSparqlResults } from "./types.js";
|
|
5
|
-
export type { AttributeFilter, AttributeFilterOp, AttributeFilterValue, EntityAttributeFilterOptions, EntityPropertiesLine, FetchLike, FlatProperties, ImportLine,
|
|
5
|
+
export type { AttributeFilter, AttributeFilterOp, AttributeFilterValue, EntityAttributeFilterOptions, EntityPropertiesLine, FetchLike, FlatProperties, ImportLine, LbbClientOptions, LbbRequestEvent, LbbResponseEvent, LbbErrorPayload, LbbStackActivityResponse, LbbStackActivityWindow, ListResponse, RawLbbResponse, RdfExportOptions, RdfImportOptions, Schemas, SparqlResults, SparqlResultsJson, SparqlTerm, AskRequest, AskResponse, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, SearchRequest, SearchResponse, SearchResult, Snapshot, } from "./types.js";
|
|
6
6
|
export { LbbError } from "./transport.js";
|
|
7
7
|
export type { CallOptions, Query, QueryValue, RequestOptions, } from "./transport.js";
|
|
8
8
|
export type { EntityListOptions, HybridSearchOptions } from "./namespaces.js";
|
|
9
|
-
export {
|
|
9
|
+
export { ContextNamespace, EntityNamespace, FactsNamespace, GraphNamespace, IndexNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
10
10
|
/**
|
|
11
|
-
* A typed HTTP client for a
|
|
11
|
+
* A typed HTTP client for a little big brain graph server. One instance is scoped to a
|
|
12
12
|
* single graph/branch; construct another for a different scope. All methods
|
|
13
13
|
* return the parsed JSON response and throw {@link LbbError} on failure.
|
|
14
14
|
*/
|
|
@@ -25,7 +25,6 @@ export declare class LbbClient {
|
|
|
25
25
|
private readonly timeoutMs;
|
|
26
26
|
private readonly onRequest?;
|
|
27
27
|
private readonly onResponse?;
|
|
28
|
-
readonly admin: AdminNamespace;
|
|
29
28
|
readonly context: ContextNamespace;
|
|
30
29
|
readonly search: SearchNamespace;
|
|
31
30
|
readonly indexes: IndexNamespace;
|
|
@@ -87,18 +86,13 @@ export declare class LbbClient {
|
|
|
87
86
|
idempotencyKey?: string;
|
|
88
87
|
}): Promise<Schemas["GraphImportResponse"]>;
|
|
89
88
|
/**
|
|
90
|
-
* Bulk-ingest N-Triples without client-side conversion. Resource-object
|
|
89
|
+
* Bulk-ingest N-Triples, Turtle, N-Quads, or TriG without client-side conversion. Resource-object
|
|
91
90
|
* triples become keyed Resource edges; literal-object triples become text
|
|
92
91
|
* properties on the subject Resource.
|
|
93
92
|
*/
|
|
94
|
-
importRdf(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
observedAt?: string;
|
|
98
|
-
resourceType?: string;
|
|
99
|
-
edgeIdempotency?: "append" | "skip_unchanged";
|
|
100
|
-
idempotencyKey?: string;
|
|
101
|
-
}): Promise<Schemas["GraphRdfImportResponse"]>;
|
|
93
|
+
importRdf(rdf: string, opts?: RdfImportOptions): Promise<Schemas["GraphRdfImportResponse"]>;
|
|
94
|
+
/** Export the snapshot-visible RDF projection as Turtle, N-Triples, TriG, or N-Quads. */
|
|
95
|
+
exportRdf(opts?: RdfExportOptions): Promise<string>;
|
|
102
96
|
/**
|
|
103
97
|
* Retract specific edges and/or every edge touching given entities. Appends
|
|
104
98
|
* superseding retract events rather than deleting — history stays visible in an
|
|
@@ -113,7 +107,7 @@ export declare class LbbClient {
|
|
|
113
107
|
/** Fork the scoped branch from an existing branch in the same graph. */
|
|
114
108
|
createBranch(body: Schemas["GraphBranchCreateRequest"]): Promise<Schemas["GraphBranchCreateResponse"]>;
|
|
115
109
|
/**
|
|
116
|
-
*
|
|
110
|
+
* Validate-then-merge: replay `from_branch`'s post-fork commits onto the
|
|
117
111
|
* SCOPED branch (its fork parent) as one new commit. A write — sends an
|
|
118
112
|
* Idempotency-Key so a retry replays instead of re-applying.
|
|
119
113
|
*/
|
|
@@ -121,7 +115,7 @@ export declare class LbbClient {
|
|
|
121
115
|
idempotencyKey?: string;
|
|
122
116
|
}): Promise<Schemas["GraphBranchMergeResponse"]>;
|
|
123
117
|
/**
|
|
124
|
-
*
|
|
118
|
+
* Observe: store a conversation episode verbatim as EPISODE evidence,
|
|
125
119
|
* anchor + gate extracted facts on an observe branch, and optionally
|
|
126
120
|
* auto-merge when validation is clean. Flag-gated server-side
|
|
127
121
|
* (`--enable-observe`). A write — carries an Idempotency-Key.
|
|
@@ -147,7 +141,7 @@ export declare class LbbClient {
|
|
|
147
141
|
limit?: number;
|
|
148
142
|
}): Promise<Schemas["VocabExportResponse"]>;
|
|
149
143
|
/**
|
|
150
|
-
* Captured signals by flush-seq range, oldest first — the
|
|
144
|
+
* Captured signals by flush-seq range, oldest first — the model-training
|
|
151
145
|
* feed. The `seq` on each signal is the temporal-split coordinate (train ≤ T,
|
|
152
146
|
* eval > T).
|
|
153
147
|
*/
|
|
@@ -256,7 +250,7 @@ export declare class LbbClient {
|
|
|
256
250
|
}): Promise<Schemas["ExtractorDatasetResponse"]>;
|
|
257
251
|
/**
|
|
258
252
|
* Promote a finished `extractor_lora` training run: gated on held-out fact
|
|
259
|
-
* F1, recorded as a
|
|
253
|
+
* F1, recorded as a `kind=extractor` training run whose adapter resident
|
|
260
254
|
* extraction then serves.
|
|
261
255
|
*/
|
|
262
256
|
promoteExtractor(opts: {
|
|
@@ -265,7 +259,7 @@ export declare class LbbClient {
|
|
|
265
259
|
}): Promise<unknown>;
|
|
266
260
|
/**
|
|
267
261
|
* Promote a finished `planner_lora` training run: gated on held-out slot
|
|
268
|
-
* exactness, recorded as a
|
|
262
|
+
* exactness, recorded as a `kind=planner` training run whose adapter `/v1/ask`
|
|
269
263
|
* then serves.
|
|
270
264
|
*/
|
|
271
265
|
promotePlanner(opts: {
|
|
@@ -278,29 +272,29 @@ export declare class LbbClient {
|
|
|
278
272
|
multiSearch(body: Schemas["HybridMultiSearchRequest"]): Promise<Schemas["HybridMultiSearchResponse"]>;
|
|
279
273
|
/**
|
|
280
274
|
* Grounded prefix completion from the index vocabulary + ontology. Optionally
|
|
281
|
-
* narrow relation completions by a type-signature `context`
|
|
275
|
+
* narrow relation completions by a type-signature `context` — a type
|
|
282
276
|
* pair that admits a single relation flags `signature_forced`.
|
|
283
277
|
*/
|
|
284
278
|
suggest(body: Schemas["SearchSuggestRequest"]): Promise<Schemas["SearchSuggestResponse"]>;
|
|
285
279
|
/**
|
|
286
|
-
* Snap free text to the nearest real vocabulary item
|
|
280
|
+
* Snap free text to the nearest real vocabulary item. Embedding cosine
|
|
287
281
|
* on a managed graph, else lexical; never fabricates a term.
|
|
288
282
|
*/
|
|
289
283
|
resolveTerm(body: Schemas["ResolveTermRequest"]): Promise<Schemas["ResolveTermResponse"]>;
|
|
290
284
|
/**
|
|
291
285
|
* Ground a natural-language question to the graph's real vocabulary, retrieve
|
|
292
|
-
* against the pinned snapshot, and answer with citations (
|
|
286
|
+
* against the pinned snapshot, and answer with citations (`/v1/ask`).
|
|
293
287
|
*/
|
|
294
288
|
ask(body: Schemas["AskRequest"]): Promise<Schemas["AskResponse"]>;
|
|
295
289
|
/**
|
|
296
290
|
* Name the relation between two entities (`/v1/decode`): the DB narrows the
|
|
297
|
-
* candidates to the type pair's admissible relations
|
|
291
|
+
* candidates to the type pair's admissible relations, answers alone
|
|
298
292
|
* when the pair forces a single relation, and otherwise decodes it with the
|
|
299
293
|
* graph-native fine-tuned model — the "DB narrows, cheap model decodes" call.
|
|
300
294
|
*/
|
|
301
295
|
decode(body: Schemas["DecodeRequest"]): Promise<Schemas["DecodeResponse"]>;
|
|
302
296
|
/**
|
|
303
|
-
* Report which completion mechanisms will carry on this graph
|
|
297
|
+
* Report which completion mechanisms will carry on this graph:
|
|
304
298
|
* signature sparsity, name semantics, sampled narrowing recall, and a
|
|
305
299
|
* narrow / narrow+finetune / lexical-first recommendation.
|
|
306
300
|
*/
|
|
@@ -308,7 +302,7 @@ export declare class LbbClient {
|
|
|
308
302
|
sample?: number;
|
|
309
303
|
}): Promise<Schemas["GroundabilityReport"]>;
|
|
310
304
|
/**
|
|
311
|
-
* Append relevance labels for a set of search results — how
|
|
305
|
+
* Append relevance labels for a set of search results — how little big brain
|
|
312
306
|
* gathers customer-specific qrels. Grade results (3 ideal/good, 1 partial,
|
|
313
307
|
* 0 bad), referencing the search response's `search_id` so labels tie back to
|
|
314
308
|
* that ranking. Stored apart from customer facts and exported via
|
|
@@ -443,7 +437,7 @@ export declare class LbbClient {
|
|
|
443
437
|
/** The rule set stored on the scoped graph branch (version + rules). */
|
|
444
438
|
graphRules(): Promise<Schemas["RuleSet"]>;
|
|
445
439
|
/**
|
|
446
|
-
*
|
|
440
|
+
* Derive edges from calibrated retrieval matches (preview): each
|
|
447
441
|
* candidate scored `P >= threshold` becomes a derived edge `(anchor, relation,
|
|
448
442
|
* matched)` with a typed `Retrieval` provenance leaf. Pass either explicit
|
|
449
443
|
* `candidates` or a `query` the server runs as BM25 entity retrieval.
|
|
@@ -518,22 +512,6 @@ export declare class LbbClient {
|
|
|
518
512
|
summary(): Promise<Schemas["GraphSummaryResponse"]>;
|
|
519
513
|
/** List the graphs (and branches) under the scoped tenant. */
|
|
520
514
|
listGraphs(): Promise<Schemas["GraphListResponse"]>;
|
|
521
|
-
/** Create a database stack and return its one-time stack API key. */
|
|
522
|
-
adminCreateStack(body: LbbAdminStackCreateRequest): Promise<LbbAdminStackResponse>;
|
|
523
|
-
/** Inspect a database stack without returning secret key material. */
|
|
524
|
-
adminStack(slug: string): Promise<LbbAdminStackResponse>;
|
|
525
|
-
/** Rotate a database stack key and return the new one-time API key. */
|
|
526
|
-
adminRotateStackKey(slug: string): Promise<LbbAdminStackResponse>;
|
|
527
|
-
/** Delete a database stack after confirming the slug. */
|
|
528
|
-
adminDeleteStack(slug: string): Promise<LbbAdminStackDeleteResponse>;
|
|
529
|
-
/**
|
|
530
|
-
* Mint a short-lived `lbb_ses_…` session token for an account. A trusted
|
|
531
|
-
* co-located service uses it (with `?stack=<slug>`) to call the data plane on
|
|
532
|
-
* the account's behalf without handling the stack's mode-bearing stack key.
|
|
533
|
-
*/
|
|
534
|
-
adminMintSession(accountId: string, ttlSeconds?: number): Promise<LbbAdminSessionResponse>;
|
|
535
|
-
/** Customer-visible activity for one database stack. */
|
|
536
|
-
adminStackActivity(slug: string, window?: LbbStackActivityWindow): Promise<LbbStackActivityResponse>;
|
|
537
515
|
/** Activity for the stack selected by the bearer stack key or session. */
|
|
538
516
|
stackActivity(window?: LbbStackActivityWindow): Promise<LbbStackActivityResponse>;
|
|
539
517
|
}
|
package/dist/client.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { parseSparqlResults } from "./types.js";
|
|
2
2
|
import { parseLbbError, parseResponseJson, retryAllowed, retryDelayForAttempt, retryableStatus, sleep, } from "./transport.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ContextNamespace, EntityNamespace, GraphNamespace, IndexNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
4
4
|
export { parseSparqlResults } from "./types.js";
|
|
5
5
|
export { LbbError } from "./transport.js";
|
|
6
|
-
export {
|
|
6
|
+
export { ContextNamespace, EntityNamespace, FactsNamespace, GraphNamespace, IndexNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
7
7
|
/**
|
|
8
|
-
* A typed HTTP client for a
|
|
8
|
+
* A typed HTTP client for a little big brain graph server. One instance is scoped to a
|
|
9
9
|
* single graph/branch; construct another for a different scope. All methods
|
|
10
10
|
* return the parsed JSON response and throw {@link LbbError} on failure.
|
|
11
11
|
*/
|
|
@@ -22,7 +22,6 @@ export class LbbClient {
|
|
|
22
22
|
timeoutMs;
|
|
23
23
|
onRequest;
|
|
24
24
|
onResponse;
|
|
25
|
-
admin;
|
|
26
25
|
context;
|
|
27
26
|
search;
|
|
28
27
|
indexes;
|
|
@@ -57,7 +56,6 @@ export class LbbClient {
|
|
|
57
56
|
throw new Error("no fetch implementation available; pass options.fetch");
|
|
58
57
|
}
|
|
59
58
|
this.fetchImpl = chosen;
|
|
60
|
-
this.admin = new AdminNamespace(this);
|
|
61
59
|
this.context = new ContextNamespace(this);
|
|
62
60
|
this.search = new SearchNamespace(this);
|
|
63
61
|
this.indexes = new IndexNamespace(this);
|
|
@@ -213,9 +211,16 @@ export class LbbClient {
|
|
|
213
211
|
});
|
|
214
212
|
if (!response.ok)
|
|
215
213
|
throw parseLbbError(response.status, text.trim(), requestId);
|
|
214
|
+
const responseContentType = response.headers?.get("content-type")?.toLowerCase() ?? "";
|
|
215
|
+
const isRdfText = responseContentType.includes("text/turtle") ||
|
|
216
|
+
responseContentType.includes("application/n-triples") ||
|
|
217
|
+
responseContentType.includes("application/trig") ||
|
|
218
|
+
responseContentType.includes("application/n-quads");
|
|
216
219
|
return {
|
|
217
220
|
data: text
|
|
218
|
-
?
|
|
221
|
+
? isRdfText
|
|
222
|
+
? text
|
|
223
|
+
: parseResponseJson(text, response.status, requestId)
|
|
219
224
|
: undefined,
|
|
220
225
|
status: response.status,
|
|
221
226
|
requestId,
|
|
@@ -289,25 +294,48 @@ export class LbbClient {
|
|
|
289
294
|
});
|
|
290
295
|
}
|
|
291
296
|
/**
|
|
292
|
-
* Bulk-ingest N-Triples without client-side conversion. Resource-object
|
|
297
|
+
* Bulk-ingest N-Triples, Turtle, N-Quads, or TriG without client-side conversion. Resource-object
|
|
293
298
|
* triples become keyed Resource edges; literal-object triples become text
|
|
294
299
|
* properties on the subject Resource.
|
|
295
300
|
*/
|
|
296
|
-
importRdf(
|
|
301
|
+
importRdf(rdf, opts = {}) {
|
|
302
|
+
const format = opts.format ?? "ntriples";
|
|
303
|
+
const contentTypes = {
|
|
304
|
+
ntriples: "application/n-triples",
|
|
305
|
+
turtle: "text/turtle",
|
|
306
|
+
nquads: "application/n-quads",
|
|
307
|
+
trig: "application/trig",
|
|
308
|
+
};
|
|
297
309
|
return this.request("POST", "/v1/graph/import/rdf", {
|
|
298
|
-
rawBody:
|
|
299
|
-
contentType:
|
|
310
|
+
rawBody: rdf,
|
|
311
|
+
contentType: contentTypes[format],
|
|
300
312
|
query: {
|
|
301
313
|
batch: opts.batch,
|
|
302
314
|
strict: opts.strict,
|
|
303
315
|
observed_at: opts.observedAt,
|
|
304
|
-
format
|
|
316
|
+
format,
|
|
317
|
+
base_iri: opts.baseIri,
|
|
318
|
+
graph_uri: opts.graphUri,
|
|
319
|
+
blank_node_scope: opts.blankNodeScope,
|
|
305
320
|
resource_type: opts.resourceType,
|
|
306
321
|
edge_idempotency: opts.edgeIdempotency,
|
|
307
322
|
},
|
|
308
323
|
idempotencyKey: opts.idempotencyKey ?? this.idempotencyKey("import-rdf"),
|
|
309
324
|
});
|
|
310
325
|
}
|
|
326
|
+
/** Export the snapshot-visible RDF projection as Turtle, N-Triples, TriG, or N-Quads. */
|
|
327
|
+
exportRdf(opts = {}) {
|
|
328
|
+
return this.request("GET", "/v1/graph/export/rdf", {
|
|
329
|
+
query: {
|
|
330
|
+
format: opts.format === "ntriples" ? "nt" : opts.format,
|
|
331
|
+
max_triples: opts.maxTriples,
|
|
332
|
+
as_of_valid_time: opts.asOfValidTime,
|
|
333
|
+
as_of_commit_seq: opts.asOfCommitSeq,
|
|
334
|
+
entailment: opts.entailment,
|
|
335
|
+
reason: opts.reason,
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
}
|
|
311
339
|
/**
|
|
312
340
|
* Retract specific edges and/or every edge touching given entities. Appends
|
|
313
341
|
* superseding retract events rather than deleting — history stays visible in an
|
|
@@ -329,7 +357,7 @@ export class LbbClient {
|
|
|
329
357
|
return this.request("POST", "/v1/graph/branch", { body });
|
|
330
358
|
}
|
|
331
359
|
/**
|
|
332
|
-
*
|
|
360
|
+
* Validate-then-merge: replay `from_branch`'s post-fork commits onto the
|
|
333
361
|
* SCOPED branch (its fork parent) as one new commit. A write — sends an
|
|
334
362
|
* Idempotency-Key so a retry replays instead of re-applying.
|
|
335
363
|
*/
|
|
@@ -340,7 +368,7 @@ export class LbbClient {
|
|
|
340
368
|
});
|
|
341
369
|
}
|
|
342
370
|
/**
|
|
343
|
-
*
|
|
371
|
+
* Observe: store a conversation episode verbatim as EPISODE evidence,
|
|
344
372
|
* anchor + gate extracted facts on an observe branch, and optionally
|
|
345
373
|
* auto-merge when validation is clean. Flag-gated server-side
|
|
346
374
|
* (`--enable-observe`). A write — carries an Idempotency-Key.
|
|
@@ -361,7 +389,7 @@ export class LbbClient {
|
|
|
361
389
|
query: { confirm: opts.confirm },
|
|
362
390
|
});
|
|
363
391
|
}
|
|
364
|
-
// --- models as runs (
|
|
392
|
+
// --- models as runs (training-run registry + eval machinery) ---
|
|
365
393
|
/**
|
|
366
394
|
* The graph's grounding vocabulary as byte-sorted, deduped string sections —
|
|
367
395
|
* the canonical input for a decoder-side automaton (FST/trie) and the
|
|
@@ -373,7 +401,7 @@ export class LbbClient {
|
|
|
373
401
|
});
|
|
374
402
|
}
|
|
375
403
|
/**
|
|
376
|
-
* Captured signals by flush-seq range, oldest first — the
|
|
404
|
+
* Captured signals by flush-seq range, oldest first — the model-training
|
|
377
405
|
* feed. The `seq` on each signal is the temporal-split coordinate (train ≤ T,
|
|
378
406
|
* eval > T).
|
|
379
407
|
*/
|
|
@@ -505,7 +533,7 @@ export class LbbClient {
|
|
|
505
533
|
}
|
|
506
534
|
/**
|
|
507
535
|
* Promote a finished `extractor_lora` training run: gated on held-out fact
|
|
508
|
-
* F1, recorded as a
|
|
536
|
+
* F1, recorded as a `kind=extractor` training run whose adapter resident
|
|
509
537
|
* extraction then serves.
|
|
510
538
|
*/
|
|
511
539
|
promoteExtractor(opts) {
|
|
@@ -515,7 +543,7 @@ export class LbbClient {
|
|
|
515
543
|
}
|
|
516
544
|
/**
|
|
517
545
|
* Promote a finished `planner_lora` training run: gated on held-out slot
|
|
518
|
-
* exactness, recorded as a
|
|
546
|
+
* exactness, recorded as a `kind=planner` training run whose adapter `/v1/ask`
|
|
519
547
|
* then serves.
|
|
520
548
|
*/
|
|
521
549
|
promotePlanner(opts) {
|
|
@@ -534,14 +562,14 @@ export class LbbClient {
|
|
|
534
562
|
}
|
|
535
563
|
/**
|
|
536
564
|
* Grounded prefix completion from the index vocabulary + ontology. Optionally
|
|
537
|
-
* narrow relation completions by a type-signature `context`
|
|
565
|
+
* narrow relation completions by a type-signature `context` — a type
|
|
538
566
|
* pair that admits a single relation flags `signature_forced`.
|
|
539
567
|
*/
|
|
540
568
|
suggest(body) {
|
|
541
569
|
return this.request("POST", "/v1/search/suggest", { body });
|
|
542
570
|
}
|
|
543
571
|
/**
|
|
544
|
-
* Snap free text to the nearest real vocabulary item
|
|
572
|
+
* Snap free text to the nearest real vocabulary item. Embedding cosine
|
|
545
573
|
* on a managed graph, else lexical; never fabricates a term.
|
|
546
574
|
*/
|
|
547
575
|
resolveTerm(body) {
|
|
@@ -549,14 +577,14 @@ export class LbbClient {
|
|
|
549
577
|
}
|
|
550
578
|
/**
|
|
551
579
|
* Ground a natural-language question to the graph's real vocabulary, retrieve
|
|
552
|
-
* against the pinned snapshot, and answer with citations (
|
|
580
|
+
* against the pinned snapshot, and answer with citations (`/v1/ask`).
|
|
553
581
|
*/
|
|
554
582
|
ask(body) {
|
|
555
583
|
return this.request("POST", "/v1/ask", { body });
|
|
556
584
|
}
|
|
557
585
|
/**
|
|
558
586
|
* Name the relation between two entities (`/v1/decode`): the DB narrows the
|
|
559
|
-
* candidates to the type pair's admissible relations
|
|
587
|
+
* candidates to the type pair's admissible relations, answers alone
|
|
560
588
|
* when the pair forces a single relation, and otherwise decodes it with the
|
|
561
589
|
* graph-native fine-tuned model — the "DB narrows, cheap model decodes" call.
|
|
562
590
|
*/
|
|
@@ -564,7 +592,7 @@ export class LbbClient {
|
|
|
564
592
|
return this.request("POST", "/v1/decode", { body });
|
|
565
593
|
}
|
|
566
594
|
/**
|
|
567
|
-
* Report which completion mechanisms will carry on this graph
|
|
595
|
+
* Report which completion mechanisms will carry on this graph:
|
|
568
596
|
* signature sparsity, name semantics, sampled narrowing recall, and a
|
|
569
597
|
* narrow / narrow+finetune / lexical-first recommendation.
|
|
570
598
|
*/
|
|
@@ -574,7 +602,7 @@ export class LbbClient {
|
|
|
574
602
|
});
|
|
575
603
|
}
|
|
576
604
|
/**
|
|
577
|
-
* Append relevance labels for a set of search results — how
|
|
605
|
+
* Append relevance labels for a set of search results — how little big brain
|
|
578
606
|
* gathers customer-specific qrels. Grade results (3 ideal/good, 1 partial,
|
|
579
607
|
* 0 bad), referencing the search response's `search_id` so labels tie back to
|
|
580
608
|
* that ranking. Stored apart from customer facts and exported via
|
|
@@ -772,7 +800,7 @@ export class LbbClient {
|
|
|
772
800
|
return this.request("GET", "/v1/inference/rules");
|
|
773
801
|
}
|
|
774
802
|
/**
|
|
775
|
-
*
|
|
803
|
+
* Derive edges from calibrated retrieval matches (preview): each
|
|
776
804
|
* candidate scored `P >= threshold` becomes a derived edge `(anchor, relation,
|
|
777
805
|
* matched)` with a typed `Retrieval` provenance leaf. Pass either explicit
|
|
778
806
|
* `candidates` or a `query` the server runs as BM25 entity retrieval.
|
|
@@ -883,44 +911,7 @@ export class LbbClient {
|
|
|
883
911
|
listGraphs() {
|
|
884
912
|
return this.request("GET", "/v1/graphs");
|
|
885
913
|
}
|
|
886
|
-
// ---
|
|
887
|
-
/** Create a database stack and return its one-time stack API key. */
|
|
888
|
-
adminCreateStack(body) {
|
|
889
|
-
return this.request("POST", "/api/admin/stacks", { body });
|
|
890
|
-
}
|
|
891
|
-
/** Inspect a database stack without returning secret key material. */
|
|
892
|
-
adminStack(slug) {
|
|
893
|
-
return this.request("GET", "/api/admin/stacks", { query: { stack: slug } });
|
|
894
|
-
}
|
|
895
|
-
/** Rotate a database stack key and return the new one-time API key. */
|
|
896
|
-
adminRotateStackKey(slug) {
|
|
897
|
-
return this.request("POST", "/api/admin/stacks/rotate-key", {
|
|
898
|
-
query: { stack: slug },
|
|
899
|
-
});
|
|
900
|
-
}
|
|
901
|
-
/** Delete a database stack after confirming the slug. */
|
|
902
|
-
adminDeleteStack(slug) {
|
|
903
|
-
return this.request("DELETE", "/api/admin/stacks", {
|
|
904
|
-
query: { stack: slug, confirm: slug },
|
|
905
|
-
});
|
|
906
|
-
}
|
|
907
|
-
/**
|
|
908
|
-
* Mint a short-lived `lbb_ses_…` session token for an account. A trusted
|
|
909
|
-
* co-located service uses it (with `?stack=<slug>`) to call the data plane on
|
|
910
|
-
* the account's behalf without handling the stack's mode-bearing stack key.
|
|
911
|
-
*/
|
|
912
|
-
adminMintSession(accountId, ttlSeconds) {
|
|
913
|
-
const body = { account_id: accountId };
|
|
914
|
-
if (ttlSeconds !== undefined)
|
|
915
|
-
body.ttl_seconds = ttlSeconds;
|
|
916
|
-
return this.request("POST", "/api/admin/sessions", { body });
|
|
917
|
-
}
|
|
918
|
-
/** Customer-visible activity for one database stack. */
|
|
919
|
-
adminStackActivity(slug, window = "24h") {
|
|
920
|
-
return this.request("GET", "/api/admin/stacks/activity", {
|
|
921
|
-
query: { stack: slug, window },
|
|
922
|
-
});
|
|
923
|
-
}
|
|
914
|
+
// --- stack activity ---
|
|
924
915
|
/** Activity for the stack selected by the bearer stack key or session. */
|
|
925
916
|
stackActivity(window = "24h") {
|
|
926
917
|
return this.request("GET", "/v1/stack/activity", { query: { window } });
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { LbbClient, LbbError, parseSparqlResults } from "./client.js";
|
|
2
|
-
export type {
|
|
2
|
+
export type { LbbClientOptions, CallOptions, RequestOptions, EntityListOptions, HybridSearchOptions, LbbRequestEvent, LbbResponseEvent, LbbStackActivityResponse, LbbStackActivityWindow, FetchLike, Schemas, SparqlResults, SparqlResultsJson, SparqlTerm, AskRequest, AskResponse, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, SearchRequest, SearchResponse, SearchResult, Snapshot, } from "./client.js";
|
|
3
3
|
export type { components, paths, operations } from "./schema.js";
|
package/dist/namespaces.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LbbClient } from "./client.js";
|
|
2
2
|
import type { CallOptions } from "./transport.js";
|
|
3
|
-
import { type EntityAttributeFilterOptions, type ImportLine, type ListResponse, type Schemas } from "./types.js";
|
|
3
|
+
import { type EntityAttributeFilterOptions, type ImportLine, type ListResponse, type RdfExportOptions, type RdfImportOptions, type Schemas } from "./types.js";
|
|
4
4
|
export interface HybridSearchOptions extends CallOptions {
|
|
5
5
|
topK?: number;
|
|
6
6
|
source?: string;
|
|
@@ -35,6 +35,8 @@ export declare class GraphNamespace {
|
|
|
35
35
|
} & CallOptions): Promise<unknown>;
|
|
36
36
|
/** Retract edges/entities from the scoped graph. See {@link LbbClient.retract}. */
|
|
37
37
|
retract(body: Schemas["GraphRetractRequest"], opts?: CallOptions): Promise<Schemas["GraphRetractResponse"]>;
|
|
38
|
+
/** Export this graph's current snapshot as Turtle, N-Triples, TriG, or N-Quads. */
|
|
39
|
+
exportRdf(opts?: RdfExportOptions): Promise<string>;
|
|
38
40
|
}
|
|
39
41
|
export declare class FactsNamespace {
|
|
40
42
|
private readonly client;
|
|
@@ -49,19 +51,12 @@ export declare class FactsNamespace {
|
|
|
49
51
|
idempotencyKey?: string;
|
|
50
52
|
}): Promise<Schemas["GraphImportResponse"]>;
|
|
51
53
|
/**
|
|
52
|
-
* Bulk-load N-Triples through the native RDF import endpoint.
|
|
54
|
+
* Bulk-load N-Triples, Turtle, N-Quads, or TriG through the native RDF import endpoint.
|
|
53
55
|
*
|
|
54
56
|
* Statements are committed through the fixed RDF_TRIPLE relation; source RDF
|
|
55
57
|
* predicates and literal term details are preserved as edge metadata.
|
|
56
58
|
*/
|
|
57
|
-
importRdf(
|
|
58
|
-
batch?: number;
|
|
59
|
-
strict?: boolean;
|
|
60
|
-
observedAt?: string;
|
|
61
|
-
resourceType?: string;
|
|
62
|
-
edgeIdempotency?: "append" | "skip_unchanged";
|
|
63
|
-
idempotencyKey?: string;
|
|
64
|
-
}): Promise<Schemas["GraphRdfImportResponse"]>;
|
|
59
|
+
importRdf(rdf: string, opts?: CallOptions & RdfImportOptions): Promise<Schemas["GraphRdfImportResponse"]>;
|
|
65
60
|
}
|
|
66
61
|
export declare class SearchNamespace {
|
|
67
62
|
private readonly client;
|
|
@@ -188,14 +183,3 @@ export declare class QueryNamespace {
|
|
|
188
183
|
infer(body: Schemas["InferenceRunRequest"], opts?: CallOptions): Promise<Schemas["InferenceRunResponse"]>;
|
|
189
184
|
premises(body: Schemas["RetrievalPremiseRequest"], opts?: CallOptions): Promise<Schemas["RetrievalPremiseResponse"]>;
|
|
190
185
|
}
|
|
191
|
-
/** Database administration. Keep stack credentials on trusted servers only. */
|
|
192
|
-
export declare class AdminNamespace {
|
|
193
|
-
private readonly client;
|
|
194
|
-
constructor(client: LbbClient);
|
|
195
|
-
createStack(body: import("./types.js").LbbAdminStackCreateRequest): Promise<import("./types.js").LbbAdminStackResponse>;
|
|
196
|
-
stack(slug: string): Promise<import("./types.js").LbbAdminStackResponse>;
|
|
197
|
-
rotateStackKey(slug: string): Promise<import("./types.js").LbbAdminStackResponse>;
|
|
198
|
-
deleteStack(slug: string): Promise<import("./types.js").LbbAdminStackDeleteResponse>;
|
|
199
|
-
mintSession(accountId: string, ttlSeconds?: number): Promise<import("./types.js").LbbAdminSessionResponse>;
|
|
200
|
-
stackActivity(slug: string, window?: import("./types.js").LbbStackActivityWindow): Promise<import("./types.js").LbbStackActivityResponse>;
|
|
201
|
-
}
|
package/dist/namespaces.js
CHANGED
|
@@ -51,6 +51,10 @@ export class GraphNamespace {
|
|
|
51
51
|
body,
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
+
/** Export this graph's current snapshot as Turtle, N-Triples, TriG, or N-Quads. */
|
|
55
|
+
exportRdf(opts = {}) {
|
|
56
|
+
return this.client.exportRdf(opts);
|
|
57
|
+
}
|
|
54
58
|
}
|
|
55
59
|
export class FactsNamespace {
|
|
56
60
|
client;
|
|
@@ -79,23 +83,31 @@ export class FactsNamespace {
|
|
|
79
83
|
});
|
|
80
84
|
}
|
|
81
85
|
/**
|
|
82
|
-
* Bulk-load N-Triples through the native RDF import endpoint.
|
|
86
|
+
* Bulk-load N-Triples, Turtle, N-Quads, or TriG through the native RDF import endpoint.
|
|
83
87
|
*
|
|
84
88
|
* Statements are committed through the fixed RDF_TRIPLE relation; source RDF
|
|
85
89
|
* predicates and literal term details are preserved as edge metadata.
|
|
86
90
|
*/
|
|
87
|
-
importRdf(
|
|
88
|
-
const { batch, strict, observedAt, resourceType, edgeIdempotency, ...request } = opts;
|
|
91
|
+
importRdf(rdf, opts = {}) {
|
|
92
|
+
const { format = "ntriples", baseIri, graphUri, blankNodeScope, batch, strict, observedAt, resourceType, edgeIdempotency, ...request } = opts;
|
|
89
93
|
return this.client.request("POST", "/v1/graph/import/rdf", {
|
|
90
94
|
...request,
|
|
91
95
|
idempotencyKey: request.idempotencyKey ?? this.client.idempotencyKey("import-rdf"),
|
|
92
|
-
rawBody:
|
|
93
|
-
contentType:
|
|
96
|
+
rawBody: rdf,
|
|
97
|
+
contentType: {
|
|
98
|
+
ntriples: "application/n-triples",
|
|
99
|
+
turtle: "text/turtle",
|
|
100
|
+
nquads: "application/n-quads",
|
|
101
|
+
trig: "application/trig",
|
|
102
|
+
}[format],
|
|
94
103
|
query: {
|
|
95
104
|
batch,
|
|
96
105
|
strict,
|
|
97
106
|
observed_at: observedAt,
|
|
98
|
-
format
|
|
107
|
+
format,
|
|
108
|
+
base_iri: baseIri,
|
|
109
|
+
graph_uri: graphUri,
|
|
110
|
+
blank_node_scope: blankNodeScope,
|
|
99
111
|
resource_type: resourceType,
|
|
100
112
|
edge_idempotency: edgeIdempotency,
|
|
101
113
|
},
|
|
@@ -455,28 +467,3 @@ export class QueryNamespace {
|
|
|
455
467
|
});
|
|
456
468
|
}
|
|
457
469
|
}
|
|
458
|
-
/** Database administration. Keep stack credentials on trusted servers only. */
|
|
459
|
-
export class AdminNamespace {
|
|
460
|
-
client;
|
|
461
|
-
constructor(client) {
|
|
462
|
-
this.client = client;
|
|
463
|
-
}
|
|
464
|
-
createStack(body) {
|
|
465
|
-
return this.client.adminCreateStack(body);
|
|
466
|
-
}
|
|
467
|
-
stack(slug) {
|
|
468
|
-
return this.client.adminStack(slug);
|
|
469
|
-
}
|
|
470
|
-
rotateStackKey(slug) {
|
|
471
|
-
return this.client.adminRotateStackKey(slug);
|
|
472
|
-
}
|
|
473
|
-
deleteStack(slug) {
|
|
474
|
-
return this.client.adminDeleteStack(slug);
|
|
475
|
-
}
|
|
476
|
-
mintSession(accountId, ttlSeconds) {
|
|
477
|
-
return this.client.adminMintSession(accountId, ttlSeconds);
|
|
478
|
-
}
|
|
479
|
-
stackActivity(slug, window = "24h") {
|
|
480
|
-
return this.client.adminStackActivity(slug, window);
|
|
481
|
-
}
|
|
482
|
-
}
|
package/dist/schema.d.ts
CHANGED
|
@@ -360,6 +360,23 @@ export interface paths {
|
|
|
360
360
|
patch?: never;
|
|
361
361
|
trace?: never;
|
|
362
362
|
};
|
|
363
|
+
"/v1/graph/export/rdf": {
|
|
364
|
+
parameters: {
|
|
365
|
+
query?: never;
|
|
366
|
+
header?: never;
|
|
367
|
+
path?: never;
|
|
368
|
+
cookie?: never;
|
|
369
|
+
};
|
|
370
|
+
/** Export the snapshot-visible RDF projection as Turtle, N-Triples, TriG, or N-Quads (hard 100,000-statement materialization ceiling) */
|
|
371
|
+
get: operations["get_v1_graph_export_rdf"];
|
|
372
|
+
put?: never;
|
|
373
|
+
post?: never;
|
|
374
|
+
delete?: never;
|
|
375
|
+
options?: never;
|
|
376
|
+
head?: never;
|
|
377
|
+
patch?: never;
|
|
378
|
+
trace?: never;
|
|
379
|
+
};
|
|
363
380
|
"/v1/graph/groundability": {
|
|
364
381
|
parameters: {
|
|
365
382
|
query?: never;
|
|
@@ -403,7 +420,7 @@ export interface paths {
|
|
|
403
420
|
};
|
|
404
421
|
get?: never;
|
|
405
422
|
put?: never;
|
|
406
|
-
/** Bulk-ingest N-Triples
|
|
423
|
+
/** Bulk-ingest N-Triples, Turtle, N-Quads, or TriG through the fixed RDF_TRIPLE relation; RDF terms and named-graph labels are preserved as edge metadata */
|
|
407
424
|
post: operations["post_v1_graph_import_rdf"];
|
|
408
425
|
delete?: never;
|
|
409
426
|
options?: never;
|
|
@@ -1273,7 +1290,7 @@ export interface paths {
|
|
|
1273
1290
|
};
|
|
1274
1291
|
get?: never;
|
|
1275
1292
|
put?: never;
|
|
1276
|
-
/** Audit current graph data against the active SHACL schema bundle */
|
|
1293
|
+
/** Audit current graph data against the active SHACL schema bundle; JSON by default, or a standard RDF sh:ValidationReport as Turtle/N-Triples */
|
|
1277
1294
|
post: operations["post_v1_schema_audit"];
|
|
1278
1295
|
delete?: never;
|
|
1279
1296
|
options?: never;
|
|
@@ -3279,7 +3296,7 @@ export interface components {
|
|
|
3279
3296
|
uri: string;
|
|
3280
3297
|
};
|
|
3281
3298
|
/**
|
|
3282
|
-
* @description Aggregate outcome of an RDF import. Every
|
|
3299
|
+
* @description Aggregate outcome of an RDF import. Every RDF statement is committed
|
|
3283
3300
|
* through a fixed `RDF_TRIPLE` edge; source predicate and literal term metadata
|
|
3284
3301
|
* are stored on the edge so the RDF/SPARQL projection can emit source RDF terms
|
|
3285
3302
|
* while avoiding one ontology relation/property per source predicate.
|
|
@@ -4309,8 +4326,10 @@ export interface components {
|
|
|
4309
4326
|
name: string;
|
|
4310
4327
|
required: boolean;
|
|
4311
4328
|
/**
|
|
4312
|
-
* @description Lowercase
|
|
4313
|
-
*
|
|
4329
|
+
* @description Lowercase value type: bool | i64 | f64 | datetime | keyword | text |
|
|
4330
|
+
* bytes | vector_f32 | keyword_set | i64_set. The `*_set` types hold a
|
|
4331
|
+
* sorted, deduplicated member set filterable by membership
|
|
4332
|
+
* (`overlaps`/`contains_all`/`not_overlaps`).
|
|
4314
4333
|
*/
|
|
4315
4334
|
value_type: string;
|
|
4316
4335
|
};
|
|
@@ -4646,6 +4665,15 @@ export interface components {
|
|
|
4646
4665
|
keyword: string;
|
|
4647
4666
|
} | {
|
|
4648
4667
|
text: string;
|
|
4668
|
+
} | {
|
|
4669
|
+
/**
|
|
4670
|
+
* @description Members of a `keyword_set` field. Order and duplicates don't matter on
|
|
4671
|
+
* the wire; the commit path canonicalizes (sorts, deduplicates) at rest.
|
|
4672
|
+
*/
|
|
4673
|
+
keyword_set: string[];
|
|
4674
|
+
} | {
|
|
4675
|
+
/** @description Members of an `i64_set` field; canonicalized like `keyword_set`. */
|
|
4676
|
+
i64_set: number[];
|
|
4649
4677
|
};
|
|
4650
4678
|
/**
|
|
4651
4679
|
* @description One leaf of a derived edge's provenance trail. A tagged union so a calibrated
|
|
@@ -5390,6 +5418,21 @@ export interface components {
|
|
|
5390
5418
|
/** @enum {string} */
|
|
5391
5419
|
op: "gte";
|
|
5392
5420
|
value: components["schemas"]["SearchFilterValue"];
|
|
5421
|
+
} | {
|
|
5422
|
+
field: string;
|
|
5423
|
+
/** @enum {string} */
|
|
5424
|
+
op: "overlaps";
|
|
5425
|
+
values: components["schemas"]["SearchFilterValue"][];
|
|
5426
|
+
} | {
|
|
5427
|
+
field: string;
|
|
5428
|
+
/** @enum {string} */
|
|
5429
|
+
op: "contains_all";
|
|
5430
|
+
values: components["schemas"]["SearchFilterValue"][];
|
|
5431
|
+
} | {
|
|
5432
|
+
field: string;
|
|
5433
|
+
/** @enum {string} */
|
|
5434
|
+
op: "not_overlaps";
|
|
5435
|
+
values: components["schemas"]["SearchFilterValue"][];
|
|
5393
5436
|
} | {
|
|
5394
5437
|
field: string;
|
|
5395
5438
|
last_as_prefix?: boolean;
|
|
@@ -10060,6 +10103,157 @@ export interface operations {
|
|
|
10060
10103
|
};
|
|
10061
10104
|
};
|
|
10062
10105
|
};
|
|
10106
|
+
get_v1_graph_export_rdf: {
|
|
10107
|
+
parameters: {
|
|
10108
|
+
query?: {
|
|
10109
|
+
/** @description Graph name (default `main`) */
|
|
10110
|
+
graph?: string;
|
|
10111
|
+
/** @description Branch name (default `main`) */
|
|
10112
|
+
branch?: string;
|
|
10113
|
+
/** @description RDF format: turtle (default), nt/ntriples, trig, or nq/nquads */
|
|
10114
|
+
format?: string;
|
|
10115
|
+
/** @description Optional lower output ceiling; cannot exceed the server hard cap */
|
|
10116
|
+
max_triples?: string;
|
|
10117
|
+
/** @description RFC3339 valid-time snapshot pin */
|
|
10118
|
+
as_of_valid_time?: string;
|
|
10119
|
+
/** @description Commit-sequence snapshot pin */
|
|
10120
|
+
as_of_commit_seq?: string;
|
|
10121
|
+
/** @description subclass (default) or none */
|
|
10122
|
+
entailment?: string;
|
|
10123
|
+
/** @description Include stored rule-derived facts when true */
|
|
10124
|
+
reason?: string;
|
|
10125
|
+
};
|
|
10126
|
+
header?: {
|
|
10127
|
+
/** @description API contract version to pin. Use `2026-06-22` for this beta-breaking shape. */
|
|
10128
|
+
"Lbb-Version"?: string;
|
|
10129
|
+
};
|
|
10130
|
+
path?: never;
|
|
10131
|
+
cookie?: never;
|
|
10132
|
+
};
|
|
10133
|
+
requestBody?: never;
|
|
10134
|
+
responses: {
|
|
10135
|
+
/** @description RDF graph */
|
|
10136
|
+
200: {
|
|
10137
|
+
headers: {
|
|
10138
|
+
/** @description API contract version used for the response */
|
|
10139
|
+
"Lbb-Version"?: string;
|
|
10140
|
+
/** @description Request correlation id */
|
|
10141
|
+
"X-Request-Id"?: string;
|
|
10142
|
+
[name: string]: unknown;
|
|
10143
|
+
};
|
|
10144
|
+
content: {
|
|
10145
|
+
"application/n-quads": string;
|
|
10146
|
+
"application/n-triples": string;
|
|
10147
|
+
"application/trig": string;
|
|
10148
|
+
"text/turtle": string;
|
|
10149
|
+
};
|
|
10150
|
+
};
|
|
10151
|
+
/** @description Bad request */
|
|
10152
|
+
400: {
|
|
10153
|
+
headers: {
|
|
10154
|
+
/** @description API contract version used for the response */
|
|
10155
|
+
"Lbb-Version"?: string;
|
|
10156
|
+
/** @description Request correlation id */
|
|
10157
|
+
"X-Request-Id"?: string;
|
|
10158
|
+
[name: string]: unknown;
|
|
10159
|
+
};
|
|
10160
|
+
content: {
|
|
10161
|
+
"application/json": components["schemas"]["LbbErrorEnvelope"];
|
|
10162
|
+
};
|
|
10163
|
+
};
|
|
10164
|
+
/** @description Unauthorized */
|
|
10165
|
+
401: {
|
|
10166
|
+
headers: {
|
|
10167
|
+
/** @description API contract version used for the response */
|
|
10168
|
+
"Lbb-Version"?: string;
|
|
10169
|
+
/** @description Request correlation id */
|
|
10170
|
+
"X-Request-Id"?: string;
|
|
10171
|
+
[name: string]: unknown;
|
|
10172
|
+
};
|
|
10173
|
+
content: {
|
|
10174
|
+
"application/json": components["schemas"]["LbbErrorEnvelope"];
|
|
10175
|
+
};
|
|
10176
|
+
};
|
|
10177
|
+
/** @description Forbidden */
|
|
10178
|
+
403: {
|
|
10179
|
+
headers: {
|
|
10180
|
+
/** @description API contract version used for the response */
|
|
10181
|
+
"Lbb-Version"?: string;
|
|
10182
|
+
/** @description Request correlation id */
|
|
10183
|
+
"X-Request-Id"?: string;
|
|
10184
|
+
[name: string]: unknown;
|
|
10185
|
+
};
|
|
10186
|
+
content: {
|
|
10187
|
+
"application/json": components["schemas"]["LbbErrorEnvelope"];
|
|
10188
|
+
};
|
|
10189
|
+
};
|
|
10190
|
+
/** @description Not found */
|
|
10191
|
+
404: {
|
|
10192
|
+
headers: {
|
|
10193
|
+
/** @description API contract version used for the response */
|
|
10194
|
+
"Lbb-Version"?: string;
|
|
10195
|
+
/** @description Request correlation id */
|
|
10196
|
+
"X-Request-Id"?: string;
|
|
10197
|
+
[name: string]: unknown;
|
|
10198
|
+
};
|
|
10199
|
+
content: {
|
|
10200
|
+
"application/json": components["schemas"]["LbbErrorEnvelope"];
|
|
10201
|
+
};
|
|
10202
|
+
};
|
|
10203
|
+
/** @description Conflict */
|
|
10204
|
+
409: {
|
|
10205
|
+
headers: {
|
|
10206
|
+
/** @description API contract version used for the response */
|
|
10207
|
+
"Lbb-Version"?: string;
|
|
10208
|
+
/** @description Request correlation id */
|
|
10209
|
+
"X-Request-Id"?: string;
|
|
10210
|
+
[name: string]: unknown;
|
|
10211
|
+
};
|
|
10212
|
+
content: {
|
|
10213
|
+
"application/json": components["schemas"]["LbbErrorEnvelope"];
|
|
10214
|
+
};
|
|
10215
|
+
};
|
|
10216
|
+
/** @description Rate limit exceeded */
|
|
10217
|
+
429: {
|
|
10218
|
+
headers: {
|
|
10219
|
+
/** @description API contract version used for the response */
|
|
10220
|
+
"Lbb-Version"?: string;
|
|
10221
|
+
/** @description Request correlation id */
|
|
10222
|
+
"X-Request-Id"?: string;
|
|
10223
|
+
[name: string]: unknown;
|
|
10224
|
+
};
|
|
10225
|
+
content: {
|
|
10226
|
+
"application/json": components["schemas"]["LbbErrorEnvelope"];
|
|
10227
|
+
};
|
|
10228
|
+
};
|
|
10229
|
+
/** @description Internal server error */
|
|
10230
|
+
500: {
|
|
10231
|
+
headers: {
|
|
10232
|
+
/** @description API contract version used for the response */
|
|
10233
|
+
"Lbb-Version"?: string;
|
|
10234
|
+
/** @description Request correlation id */
|
|
10235
|
+
"X-Request-Id"?: string;
|
|
10236
|
+
[name: string]: unknown;
|
|
10237
|
+
};
|
|
10238
|
+
content: {
|
|
10239
|
+
"application/json": components["schemas"]["LbbErrorEnvelope"];
|
|
10240
|
+
};
|
|
10241
|
+
};
|
|
10242
|
+
/** @description Service unavailable */
|
|
10243
|
+
503: {
|
|
10244
|
+
headers: {
|
|
10245
|
+
/** @description API contract version used for the response */
|
|
10246
|
+
"Lbb-Version"?: string;
|
|
10247
|
+
/** @description Request correlation id */
|
|
10248
|
+
"X-Request-Id"?: string;
|
|
10249
|
+
[name: string]: unknown;
|
|
10250
|
+
};
|
|
10251
|
+
content: {
|
|
10252
|
+
"application/json": components["schemas"]["LbbErrorEnvelope"];
|
|
10253
|
+
};
|
|
10254
|
+
};
|
|
10255
|
+
};
|
|
10256
|
+
};
|
|
10063
10257
|
get_v1_graph_groundability: {
|
|
10064
10258
|
parameters: {
|
|
10065
10259
|
query?: {
|
|
@@ -10357,8 +10551,14 @@ export interface operations {
|
|
|
10357
10551
|
observed_at?: string;
|
|
10358
10552
|
/** @description Edge duplicate handling: skip_unchanged (default) or append for fresh high-throughput loads */
|
|
10359
10553
|
edge_idempotency?: string;
|
|
10360
|
-
/** @description RDF format
|
|
10554
|
+
/** @description RDF format: ntriples (default), turtle, nquads, or trig */
|
|
10361
10555
|
format?: string;
|
|
10556
|
+
/** @description Optional base IRI for resolving relative IRIs in Turtle or TriG */
|
|
10557
|
+
base_iri?: string;
|
|
10558
|
+
/** @description Optional named-graph IRI for N-Triples or Turtle input */
|
|
10559
|
+
graph_uri?: string;
|
|
10560
|
+
/** @description Optional stable document scope for blank-node labels across chunks; omit to preserve labels exactly across retries and chunk boundaries */
|
|
10561
|
+
blank_node_scope?: string;
|
|
10362
10562
|
/** @description Entity type name for imported RDF resources (default Resource) */
|
|
10363
10563
|
resource_type?: string;
|
|
10364
10564
|
};
|
|
@@ -17959,6 +18159,8 @@ export interface operations {
|
|
|
17959
18159
|
graph?: string;
|
|
17960
18160
|
/** @description Branch name (default `main`) */
|
|
17961
18161
|
branch?: string;
|
|
18162
|
+
/** @description Response format: json (default), turtle, or nt/ntriples */
|
|
18163
|
+
format?: string;
|
|
17962
18164
|
};
|
|
17963
18165
|
header?: {
|
|
17964
18166
|
/** @description API contract version to pin. Use `2026-06-22` for this beta-breaking shape. */
|
|
@@ -17971,7 +18173,7 @@ export interface operations {
|
|
|
17971
18173
|
};
|
|
17972
18174
|
requestBody?: never;
|
|
17973
18175
|
responses: {
|
|
17974
|
-
/** @description
|
|
18176
|
+
/** @description SHACL validation report */
|
|
17975
18177
|
200: {
|
|
17976
18178
|
headers: {
|
|
17977
18179
|
/** @description API contract version used for the response */
|
|
@@ -17982,6 +18184,8 @@ export interface operations {
|
|
|
17982
18184
|
};
|
|
17983
18185
|
content: {
|
|
17984
18186
|
"application/json": components["schemas"]["SchemaAuditReport"];
|
|
18187
|
+
"application/n-triples": string;
|
|
18188
|
+
"text/turtle": string;
|
|
17985
18189
|
};
|
|
17986
18190
|
};
|
|
17987
18191
|
/** @description Bad request */
|
package/dist/types.d.ts
CHANGED
|
@@ -45,6 +45,27 @@ export type EntityPropertiesLine = {
|
|
|
45
45
|
};
|
|
46
46
|
/** One bulk-import line: a triplet, or an entity-properties record. */
|
|
47
47
|
export type ImportLine = Schemas["TripletInput"] | EntityPropertiesLine;
|
|
48
|
+
export interface RdfImportOptions {
|
|
49
|
+
format?: "ntriples" | "turtle" | "nquads" | "trig";
|
|
50
|
+
baseIri?: string;
|
|
51
|
+
graphUri?: string;
|
|
52
|
+
/** Stable document scope for blank labels across chunks; omit for legacy stable labels. */
|
|
53
|
+
blankNodeScope?: string;
|
|
54
|
+
batch?: number;
|
|
55
|
+
strict?: boolean;
|
|
56
|
+
observedAt?: string;
|
|
57
|
+
resourceType?: string;
|
|
58
|
+
edgeIdempotency?: "append" | "skip_unchanged";
|
|
59
|
+
idempotencyKey?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface RdfExportOptions {
|
|
62
|
+
format?: "turtle" | "ntriples" | "trig" | "nquads";
|
|
63
|
+
maxTriples?: number;
|
|
64
|
+
asOfValidTime?: string;
|
|
65
|
+
asOfCommitSeq?: number;
|
|
66
|
+
entailment?: "subclass" | "none";
|
|
67
|
+
reason?: boolean;
|
|
68
|
+
}
|
|
48
69
|
export type AttributeFilterOp = "eq" | "ne" | "lt" | "le" | "gt" | "ge";
|
|
49
70
|
export type AttributeFilterValue = string | number | boolean | {
|
|
50
71
|
dateTime: string;
|
|
@@ -132,7 +153,7 @@ export declare function parseSparqlResults(response: Schemas["SparqlTextResponse
|
|
|
132
153
|
export declare function firstPatternVariable(patterns: Schemas["AnalyticTriplePattern"][]): string;
|
|
133
154
|
export declare function attributeFilter(filter: AttributeFilter, defaultVar: string): Schemas["SparqlFilter"];
|
|
134
155
|
export interface LbbClientOptions {
|
|
135
|
-
/** Base URL of the
|
|
156
|
+
/** Base URL of the little big brain server, e.g. `https://db.eu.littlebigbrain.com`. */
|
|
136
157
|
baseUrl: string;
|
|
137
158
|
/** Stack API key (`lbb_sk_test_…` / `lbb_sk_live_…`) or single-mode token. */
|
|
138
159
|
apiKey?: string;
|
|
@@ -177,29 +198,6 @@ export interface LbbResponseEvent {
|
|
|
177
198
|
retryCount: number;
|
|
178
199
|
elapsedMs: number;
|
|
179
200
|
}
|
|
180
|
-
export interface LbbStackView {
|
|
181
|
-
stack_id: string;
|
|
182
|
-
owner_id?: string;
|
|
183
|
-
name: string;
|
|
184
|
-
slug: string;
|
|
185
|
-
tenant_id: string;
|
|
186
|
-
default_graph: string;
|
|
187
|
-
default_branch: string;
|
|
188
|
-
created_at_micros: number;
|
|
189
|
-
api_key_hint: string;
|
|
190
|
-
api_key_rotated_at_micros: number;
|
|
191
|
-
}
|
|
192
|
-
export interface LbbAdminStackCreateRequest {
|
|
193
|
-
owner_id: string;
|
|
194
|
-
name: string;
|
|
195
|
-
slug?: string;
|
|
196
|
-
}
|
|
197
|
-
export interface LbbAdminStackResponse {
|
|
198
|
-
ok: true;
|
|
199
|
-
stack: LbbStackView;
|
|
200
|
-
api_key?: string;
|
|
201
|
-
active_api_key_count?: number;
|
|
202
|
-
}
|
|
203
201
|
export type LbbStackActivityWindow = "1h" | "4h" | "12h" | "24h";
|
|
204
202
|
export interface LbbStackActivityResponse {
|
|
205
203
|
ok: true;
|
|
@@ -276,19 +274,6 @@ export interface LbbStackActivityResponse {
|
|
|
276
274
|
}>;
|
|
277
275
|
partial: boolean;
|
|
278
276
|
}
|
|
279
|
-
export interface LbbAdminSessionResponse {
|
|
280
|
-
ok: true;
|
|
281
|
-
/** A `lbb_ses_…` session token scoped to the account. */
|
|
282
|
-
token: string;
|
|
283
|
-
expires_at_micros: number;
|
|
284
|
-
}
|
|
285
|
-
export interface LbbAdminStackDeleteResponse {
|
|
286
|
-
ok: true;
|
|
287
|
-
deleted_stack: LbbStackView;
|
|
288
|
-
tenant_prefix: string;
|
|
289
|
-
objects_deleted: number;
|
|
290
|
-
bytes_deleted: number;
|
|
291
|
-
}
|
|
292
277
|
export interface LbbErrorPayload {
|
|
293
278
|
type?: string;
|
|
294
279
|
code?: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@littlebigbrain/client",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "TypeScript client for the
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "TypeScript client for the little big brain graph + hybrid search HTTP API",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|