@littlebigbrain/client 0.10.0 → 0.11.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 +12 -27
- package/dist/client.d.ts +6 -79
- package/dist/client.js +6 -138
- package/dist/index.d.ts +1 -1
- package/dist/namespaces.d.ts +5 -60
- package/dist/namespaces.js +7 -161
- package/dist/schema.d.ts +454 -4861
- package/dist/types.d.ts +0 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,11 +36,10 @@ await graph.facts.create(
|
|
|
36
36
|
const published = await lbb.readSnapshot();
|
|
37
37
|
console.log(published.snapshot.served_at_seq, published.query_lag_commits);
|
|
38
38
|
|
|
39
|
-
// 3.
|
|
40
|
-
const
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
);
|
|
39
|
+
// 3. Query the snapshot with SPARQL.
|
|
40
|
+
const rows = await lbb.sparqlRows({
|
|
41
|
+
query: "SELECT ?s ?o WHERE { ?s <policy:retention> ?o } LIMIT 10",
|
|
42
|
+
});
|
|
44
43
|
```
|
|
45
44
|
|
|
46
45
|
For hosted use, `baseUrl` is required and must be the exact `endpoint_url`
|
|
@@ -49,23 +48,6 @@ parameters; they are not encoded in the hostname.
|
|
|
49
48
|
|
|
50
49
|
## Examples
|
|
51
50
|
|
|
52
|
-
**Search with filters.** Pass the request body to filter before ranking — here, only facts an ACL principal may see:
|
|
53
|
-
|
|
54
|
-
```ts
|
|
55
|
-
const results = await graph.search.hybrid({
|
|
56
|
-
query: "incident response runbook",
|
|
57
|
-
targets: ["entities"],
|
|
58
|
-
search: {
|
|
59
|
-
filters: {
|
|
60
|
-
op: "overlaps",
|
|
61
|
-
field: "acl",
|
|
62
|
-
values: ["user:rino@example.com", "group:engineering"],
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
top_k: 20,
|
|
66
|
-
});
|
|
67
|
-
```
|
|
68
|
-
|
|
69
51
|
**Bulk import.** Load an array of records (or an NDJSON string) in one call:
|
|
70
52
|
|
|
71
53
|
```ts
|
|
@@ -93,10 +75,13 @@ commit is durable and final publication was enqueued; it does not mean indexes
|
|
|
93
75
|
have already reached `committed_commit_seq`. An empty iterable is rejected
|
|
94
76
|
locally before an import POST is sent.
|
|
95
77
|
|
|
96
|
-
**Time-travel read.** Pin
|
|
78
|
+
**Time-travel read.** Pin a SPARQL read to a past instant — results reflect the graph as it was then:
|
|
97
79
|
|
|
98
80
|
```ts
|
|
99
|
-
const asOf = await
|
|
81
|
+
const asOf = await lbb.sparqlRows({
|
|
82
|
+
query: "SELECT ?s ?o WHERE { ?s <policy:retention> ?o }",
|
|
83
|
+
as_of_valid_time: "2026-01-01T00:00:00Z",
|
|
84
|
+
});
|
|
100
85
|
```
|
|
101
86
|
|
|
102
87
|
**SPARQL.** `sparqlRows` runs a SPARQL 1.1 SELECT/ASK and returns parsed rows:
|
|
@@ -113,9 +98,9 @@ Methods return parsed JSON and throw `LbbError` (with `status`, `code`, `message
|
|
|
113
98
|
|
|
114
99
|
## More
|
|
115
100
|
|
|
116
|
-
The `graph(...)` scope exposes `facts`, `
|
|
117
|
-
`
|
|
118
|
-
|
|
101
|
+
The `graph(...)` scope exposes `facts`, `entities`, `ontology`, `query`,
|
|
102
|
+
`search` (feedback surfaces), and `schema` namespaces. `query` runs SPARQL,
|
|
103
|
+
the one query language on the API; `schema`
|
|
119
104
|
reads or atomically publishes the active ontology/shapes bundle. Writes enqueue
|
|
120
105
|
published-generation maintenance automatically. Every generated shape is
|
|
121
106
|
available as `Schemas["TypeName"]`.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { DurableImportSource, ImportLine, LbbClientOptions, ListResponse, RawLbbResponse, ReadConsistencyOptions, RdfImportOptions, Schemas, SearchConsistency, SparqlResults } from "./types.js";
|
|
2
2
|
import { type CallOptions, type RequestOptions } from "./transport.js";
|
|
3
|
-
import {
|
|
3
|
+
import { EntityNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace } from "./namespaces.js";
|
|
4
4
|
export { parseSparqlResults } from "./types.js";
|
|
5
|
-
export type { AttributeFilter, AttributeFilterOp, AttributeFilterValue, EntityAttributeFilterOptions, EntityPropertiesLine, DurableImportLine, DurableImportSource, FetchLike, FlatProperties, ImportLine, LbbClientOptions, LbbRequestEvent, LbbResponseEvent, LbbRetryEvent, LbbErrorPayload, ListResponse, RawLbbResponse, ReadConsistencyOptions, RdfImportOptions, Schemas, SearchConsistency, SparqlResults, SparqlResultsJson, SparqlTerm, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView,
|
|
5
|
+
export type { AttributeFilter, AttributeFilterOp, AttributeFilterValue, EntityAttributeFilterOptions, EntityPropertiesLine, DurableImportLine, DurableImportSource, FetchLike, FlatProperties, ImportLine, LbbClientOptions, LbbRequestEvent, LbbResponseEvent, LbbRetryEvent, LbbErrorPayload, ListResponse, RawLbbResponse, ReadConsistencyOptions, RdfImportOptions, Schemas, SearchConsistency, SparqlResults, SparqlResultsJson, SparqlTerm, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, Snapshot, } from "./types.js";
|
|
6
6
|
export { LbbCapabilityError, LbbError } from "./transport.js";
|
|
7
7
|
export type { CallOptions, Query, QueryValue, RequestOptions, } from "./transport.js";
|
|
8
|
-
export
|
|
9
|
-
export { ContextNamespace, EntityNamespace, FactsNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
8
|
+
export { EntityNamespace, FactsNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
10
9
|
export interface IndexLineageObservation {
|
|
11
10
|
metadata: Schemas["GraphMetadataResponse"];
|
|
12
11
|
lineage: Schemas["IndexLineage"];
|
|
@@ -39,7 +38,6 @@ export declare class LbbClient {
|
|
|
39
38
|
private capabilities?;
|
|
40
39
|
/** A5 default read consistency applied when a read omits its own value. */
|
|
41
40
|
readonly defaultConsistency?: SearchConsistency;
|
|
42
|
-
readonly context: ContextNamespace;
|
|
43
41
|
readonly search: SearchNamespace;
|
|
44
42
|
readonly entities: EntityNamespace;
|
|
45
43
|
readonly schema: SchemaNamespace;
|
|
@@ -213,47 +211,6 @@ export declare class LbbClient {
|
|
|
213
211
|
deleteBranch(opts: {
|
|
214
212
|
confirm: string;
|
|
215
213
|
}): Promise<Schemas["GraphBranchDeleteResponse"]>;
|
|
216
|
-
embeddingConfig(): Promise<Schemas["ManagedEmbeddingConfigResponse"]>;
|
|
217
|
-
/** List the embedding models available on this deployment. */
|
|
218
|
-
embeddingModels(): Promise<Schemas["ManagedEmbeddingModelsResponse"]>;
|
|
219
|
-
/**
|
|
220
|
-
* Choose the model used automatically for writes and vector queries.
|
|
221
|
-
* Provider credentials and native dimension discovery stay server-side.
|
|
222
|
-
*/
|
|
223
|
-
setEmbeddingModel(modelId: string, opts?: {
|
|
224
|
-
autoEmbedQuery?: boolean;
|
|
225
|
-
}): Promise<Schemas["ManagedEmbeddingConfigResponse"]>;
|
|
226
|
-
/** Advanced configuration escape hatch. Prefer `setEmbeddingModel`. */
|
|
227
|
-
setEmbeddingConfig(body: Schemas["ManagedEmbeddingConfigRequest"]): Promise<Schemas["ManagedEmbeddingConfigResponse"]>;
|
|
228
|
-
submitEmbeddingBackfill(opts?: {
|
|
229
|
-
batchSize?: number;
|
|
230
|
-
limit?: number;
|
|
231
|
-
full?: boolean;
|
|
232
|
-
idempotencyKey?: string;
|
|
233
|
-
}): Promise<Schemas["ManagedEmbeddingBackfillJobStatusResponse"]>;
|
|
234
|
-
embeddingBackfillJob(jobId: string): Promise<Schemas["ManagedEmbeddingBackfillJobStatusResponse"]>;
|
|
235
|
-
cancelEmbeddingBackfill(jobId: string): Promise<Schemas["ManagedEmbeddingBackfillJobStatusResponse"]>;
|
|
236
|
-
backfillEmbeddings(opts?: {
|
|
237
|
-
batchSize?: number;
|
|
238
|
-
limit?: number;
|
|
239
|
-
full?: boolean;
|
|
240
|
-
idempotencyKey?: string;
|
|
241
|
-
timeoutMs?: number;
|
|
242
|
-
pollIntervalMs?: number;
|
|
243
|
-
}): Promise<Schemas["ManagedEmbeddingBackfillResponse"]>;
|
|
244
|
-
promoteEmbedding(opts: {
|
|
245
|
-
runId: string;
|
|
246
|
-
allowRegression?: boolean;
|
|
247
|
-
}): Promise<Schemas["ManagedEmbeddingPromoteResponse"]>;
|
|
248
|
-
/**
|
|
249
|
-
* The graph's grounding vocabulary as byte-sorted, deduped string sections —
|
|
250
|
-
* the canonical input for a decoder-side automaton (FST/trie) and the
|
|
251
|
-
* vocabulary half of an export bundle.
|
|
252
|
-
*/
|
|
253
|
-
vocabExport(opts?: {
|
|
254
|
-
sections?: string[];
|
|
255
|
-
limit?: number;
|
|
256
|
-
}): Promise<Schemas["VocabExportResponse"]>;
|
|
257
214
|
/**
|
|
258
215
|
* Captured signals by flush-seq range, oldest first — the model-training
|
|
259
216
|
* feed. The `seq` on each signal is the temporal-split coordinate (train ≤ T,
|
|
@@ -366,29 +323,11 @@ export declare class LbbClient {
|
|
|
366
323
|
runId: string;
|
|
367
324
|
allowRegression?: boolean;
|
|
368
325
|
}): Promise<unknown>;
|
|
369
|
-
/** Full semantic hybrid search from a request body (`POST /v1/graph/search`). */
|
|
370
|
-
graphSearch(body: Schemas["SemanticGraphSearchRequest"], opts?: ReadConsistencyOptions): Promise<Schemas["SemanticGraphSearchResponse"]>;
|
|
371
|
-
/** Reciprocal-rank-fusion across sub-queries. */
|
|
372
|
-
multiSearch(body: Schemas["HybridMultiSearchRequest"]): Promise<Schemas["HybridMultiSearchResponse"]>;
|
|
373
326
|
/**
|
|
374
|
-
*
|
|
375
|
-
* narrow relation completions by a type-signature `context` — a type
|
|
376
|
-
* pair that admits a single relation flags `signature_forced`.
|
|
377
|
-
*/
|
|
378
|
-
suggest(body: Schemas["SearchSuggestRequest"]): Promise<Schemas["SearchSuggestResponse"]>;
|
|
379
|
-
/** Snap free text to the nearest term in the pinned published vocabulary. */
|
|
380
|
-
resolveTerm(body: Schemas["ResolveTermRequest"]): Promise<Schemas["ResolveTermResponse"]>;
|
|
381
|
-
/** Decode a relation from the graph's admissible published vocabulary. */
|
|
382
|
-
decode(body: Schemas["DecodeRequest"]): Promise<Schemas["DecodeResponse"]>;
|
|
383
|
-
/** Report completion strategy fitness for the pinned published graph. */
|
|
384
|
-
groundability(opts?: {
|
|
385
|
-
sample?: number;
|
|
386
|
-
}): Promise<Schemas["GroundabilityReport"]>;
|
|
387
|
-
/**
|
|
388
|
-
* Append relevance labels for a set of search results — how little big brain
|
|
327
|
+
* Append relevance labels for a set of ranked results — how little big brain
|
|
389
328
|
* gathers customer-specific qrels. Grade results (3 ideal/good, 1 partial,
|
|
390
|
-
* 0 bad), referencing the
|
|
391
|
-
*
|
|
329
|
+
* 0 bad), referencing the ranking's `search_id` so labels tie back to it.
|
|
330
|
+
* Stored apart from customer facts and exported via
|
|
392
331
|
* {@link searchFeedbackExport} as training/eval data for embedding fine-tuning.
|
|
393
332
|
*/
|
|
394
333
|
searchFeedback(body: Schemas["SearchFeedbackRequest"], opts?: {
|
|
@@ -396,10 +335,6 @@ export declare class LbbClient {
|
|
|
396
335
|
}): Promise<Schemas["SearchFeedbackResponse"]>;
|
|
397
336
|
/** Export the stored relevance labels as qrels-style rows for training. */
|
|
398
337
|
searchFeedbackExport(): Promise<Schemas["SearchFeedbackExportResponse"]>;
|
|
399
|
-
/** BM25 search. */
|
|
400
|
-
fullTextSearch(body: Schemas["FullTextSearchRequest"], opts?: ReadConsistencyOptions): Promise<Schemas["FullTextSearchResponse"]>;
|
|
401
|
-
/** ANN/vector search. */
|
|
402
|
-
embeddingSearch(body: Schemas["EmbeddingSearchRequest"], opts?: ReadConsistencyOptions): Promise<Schemas["EmbeddingSearchResponse"]>;
|
|
403
338
|
/**
|
|
404
339
|
* Ranked incoming/outgoing neighborhood for a graph entity.
|
|
405
340
|
*
|
|
@@ -476,14 +411,6 @@ export declare class LbbClient {
|
|
|
476
411
|
* is the ASK answer (or `null` for a SELECT).
|
|
477
412
|
*/
|
|
478
413
|
sparqlRows(body: Schemas["SparqlTextRequest"], opts?: ReadConsistencyOptions): Promise<SparqlResults>;
|
|
479
|
-
/**
|
|
480
|
-
* Basic-graph-pattern query with group-graph-pattern combinators
|
|
481
|
-
* (UNION / OPTIONAL / MINUS / EXISTS / NOT EXISTS) folded over the base
|
|
482
|
-
* patterns. The complement to {@link sparql}: this route carries the
|
|
483
|
-
* combinators (but not FILTER/aggregation), so use it when a query needs an
|
|
484
|
-
* optional/union/negated leg rather than a grouped aggregate.
|
|
485
|
-
*/
|
|
486
|
-
analytics(body: Schemas["AnalyticQueryRequest"]): Promise<Schemas["AnalyticQueryResponse"]>;
|
|
487
414
|
/**
|
|
488
415
|
* The active ontology (entity types and relations) for the scoped graph.
|
|
489
416
|
* Pass `{ counts: true }` to include a per-relation current-edge count
|
package/dist/client.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { parseSparqlResults } from "./types.js";
|
|
2
2
|
import { bodyMarksTerminal, errorCodeFromBody, fullJitterBackoffMs, parseLbbError, parseResponseJson, retryAllowed, retryableStatus, retryDelayMs, sleep, } from "./transport.js";
|
|
3
3
|
import { LbbCapabilityError } from "./transport.js";
|
|
4
|
-
import {
|
|
4
|
+
import { EntityNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
5
5
|
export { parseSparqlResults } from "./types.js";
|
|
6
6
|
export { LbbCapabilityError, LbbError } from "./transport.js";
|
|
7
|
-
export {
|
|
7
|
+
export { EntityNamespace, FactsNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
8
8
|
function durableImportBytes(line) {
|
|
9
9
|
if (line instanceof Uint8Array)
|
|
10
10
|
return line;
|
|
@@ -105,7 +105,6 @@ export class LbbClient {
|
|
|
105
105
|
capabilities;
|
|
106
106
|
/** A5 default read consistency applied when a read omits its own value. */
|
|
107
107
|
defaultConsistency;
|
|
108
|
-
context;
|
|
109
108
|
search;
|
|
110
109
|
entities;
|
|
111
110
|
schema;
|
|
@@ -148,7 +147,6 @@ export class LbbClient {
|
|
|
148
147
|
throw new Error("no fetch implementation available; pass options.fetch");
|
|
149
148
|
}
|
|
150
149
|
this.fetchImpl = chosen;
|
|
151
|
-
this.context = new ContextNamespace(this);
|
|
152
150
|
this.search = new SearchNamespace(this);
|
|
153
151
|
this.entities = new EntityNamespace(this);
|
|
154
152
|
this.schema = new SchemaNamespace(this);
|
|
@@ -668,78 +666,7 @@ export class LbbClient {
|
|
|
668
666
|
query: { confirm: opts.confirm },
|
|
669
667
|
});
|
|
670
668
|
}
|
|
671
|
-
embeddingConfig() {
|
|
672
|
-
return this.request("GET", "/v1/graph/embedding");
|
|
673
|
-
}
|
|
674
|
-
/** List the embedding models available on this deployment. */
|
|
675
|
-
embeddingModels() {
|
|
676
|
-
return this.request("GET", "/v1/graph/embedding/models");
|
|
677
|
-
}
|
|
678
|
-
/**
|
|
679
|
-
* Choose the model used automatically for writes and vector queries.
|
|
680
|
-
* Provider credentials and native dimension discovery stay server-side.
|
|
681
|
-
*/
|
|
682
|
-
setEmbeddingModel(modelId, opts = {}) {
|
|
683
|
-
return this.setEmbeddingConfig({
|
|
684
|
-
model_id: modelId,
|
|
685
|
-
service: "open_router",
|
|
686
|
-
auto_embed_query: opts.autoEmbedQuery ?? true,
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
/** Advanced configuration escape hatch. Prefer `setEmbeddingModel`. */
|
|
690
|
-
setEmbeddingConfig(body) {
|
|
691
|
-
return this.request("POST", "/v1/graph/embedding", { body });
|
|
692
|
-
}
|
|
693
|
-
submitEmbeddingBackfill(opts = {}) {
|
|
694
|
-
return this.request("POST", "/v1/graph/embedding/backfill-jobs", {
|
|
695
|
-
body: {
|
|
696
|
-
batch_size: opts.batchSize,
|
|
697
|
-
limit: opts.limit,
|
|
698
|
-
full: opts.full ?? false,
|
|
699
|
-
},
|
|
700
|
-
idempotencyKey: opts.idempotencyKey ?? this.idempotencyKey("embedding-backfill"),
|
|
701
|
-
});
|
|
702
|
-
}
|
|
703
|
-
embeddingBackfillJob(jobId) {
|
|
704
|
-
return this.request("GET", "/v1/graph/embedding/backfill-jobs", {
|
|
705
|
-
query: { job_id: jobId },
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
cancelEmbeddingBackfill(jobId) {
|
|
709
|
-
return this.request("DELETE", "/v1/graph/embedding/backfill-jobs", {
|
|
710
|
-
query: { job_id: jobId },
|
|
711
|
-
});
|
|
712
|
-
}
|
|
713
|
-
async backfillEmbeddings(opts = {}) {
|
|
714
|
-
let status = await this.submitEmbeddingBackfill(opts);
|
|
715
|
-
const deadline = Date.now() + (opts.timeoutMs ?? 30 * 60_000);
|
|
716
|
-
while (status.status === "pending" || status.status === "running") {
|
|
717
|
-
if (Date.now() >= deadline)
|
|
718
|
-
throw new Error(`embedding backfill ${status.job_id} did not finish before timeout`);
|
|
719
|
-
await sleep(opts.pollIntervalMs ?? 2_000);
|
|
720
|
-
status = await this.embeddingBackfillJob(status.job_id);
|
|
721
|
-
}
|
|
722
|
-
if (status.status !== "succeeded" || status.result == null)
|
|
723
|
-
throw new Error(status.terminal_error ??
|
|
724
|
-
`embedding backfill ${status.job_id} ended ${status.status}`);
|
|
725
|
-
return status.result;
|
|
726
|
-
}
|
|
727
|
-
promoteEmbedding(opts) {
|
|
728
|
-
return this.request("POST", "/v1/graph/embedding/promote", {
|
|
729
|
-
query: { run_id: opts.runId, allow_regression: opts.allowRegression },
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
669
|
// --- models as runs (training-run registry + eval machinery) ---
|
|
733
|
-
/**
|
|
734
|
-
* The graph's grounding vocabulary as byte-sorted, deduped string sections —
|
|
735
|
-
* the canonical input for a decoder-side automaton (FST/trie) and the
|
|
736
|
-
* vocabulary half of an export bundle.
|
|
737
|
-
*/
|
|
738
|
-
vocabExport(opts = {}) {
|
|
739
|
-
return this.request("GET", "/v1/search/vocab", {
|
|
740
|
-
query: { sections: opts.sections?.join(","), limit: opts.limit },
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
670
|
/**
|
|
744
671
|
* Captured signals by flush-seq range, oldest first — the model-training
|
|
745
672
|
* feed. The `seq` on each signal is the temporal-split coordinate (train ≤ T,
|
|
@@ -887,49 +814,12 @@ export class LbbClient {
|
|
|
887
814
|
query: { run_id: opts.runId, allow_regression: opts.allowRegression },
|
|
888
815
|
});
|
|
889
816
|
}
|
|
890
|
-
// ---
|
|
891
|
-
/** Full semantic hybrid search from a request body (`POST /v1/graph/search`). */
|
|
892
|
-
graphSearch(body, opts) {
|
|
893
|
-
// Consistency for hybrid graph search lives on the nested `search` options.
|
|
894
|
-
const consistency = this.resolveConsistency(opts);
|
|
895
|
-
const search = consistency !== undefined || opts?.minIndexedSeq !== undefined
|
|
896
|
-
? this.mergeReadConsistency(body.search ?? {}, opts)
|
|
897
|
-
: body.search;
|
|
898
|
-
return this.request("POST", "/v1/graph/search", {
|
|
899
|
-
body: { ...body, search },
|
|
900
|
-
});
|
|
901
|
-
}
|
|
902
|
-
/** Reciprocal-rank-fusion across sub-queries. */
|
|
903
|
-
multiSearch(body) {
|
|
904
|
-
return this.request("POST", "/v1/search/multi", { body });
|
|
905
|
-
}
|
|
906
|
-
/**
|
|
907
|
-
* Grounded prefix completion from the index vocabulary + ontology. Optionally
|
|
908
|
-
* narrow relation completions by a type-signature `context` — a type
|
|
909
|
-
* pair that admits a single relation flags `signature_forced`.
|
|
910
|
-
*/
|
|
911
|
-
suggest(body) {
|
|
912
|
-
return this.request("POST", "/v1/search/suggest", { body });
|
|
913
|
-
}
|
|
914
|
-
/** Snap free text to the nearest term in the pinned published vocabulary. */
|
|
915
|
-
resolveTerm(body) {
|
|
916
|
-
return this.request("POST", "/v1/search/resolve-term", { body });
|
|
917
|
-
}
|
|
918
|
-
/** Decode a relation from the graph's admissible published vocabulary. */
|
|
919
|
-
decode(body) {
|
|
920
|
-
return this.request("POST", "/v1/decode", { body });
|
|
921
|
-
}
|
|
922
|
-
/** Report completion strategy fitness for the pinned published graph. */
|
|
923
|
-
groundability(opts = {}) {
|
|
924
|
-
return this.request("GET", "/v1/graph/groundability", {
|
|
925
|
-
query: opts.sample == null ? undefined : { sample: opts.sample },
|
|
926
|
-
});
|
|
927
|
-
}
|
|
817
|
+
// --- relevance feedback ---
|
|
928
818
|
/**
|
|
929
|
-
* Append relevance labels for a set of
|
|
819
|
+
* Append relevance labels for a set of ranked results — how little big brain
|
|
930
820
|
* gathers customer-specific qrels. Grade results (3 ideal/good, 1 partial,
|
|
931
|
-
* 0 bad), referencing the
|
|
932
|
-
*
|
|
821
|
+
* 0 bad), referencing the ranking's `search_id` so labels tie back to it.
|
|
822
|
+
* Stored apart from customer facts and exported via
|
|
933
823
|
* {@link searchFeedbackExport} as training/eval data for embedding fine-tuning.
|
|
934
824
|
*/
|
|
935
825
|
searchFeedback(body, opts = {}) {
|
|
@@ -942,18 +832,6 @@ export class LbbClient {
|
|
|
942
832
|
searchFeedbackExport() {
|
|
943
833
|
return this.request("GET", "/v1/search/feedback/export");
|
|
944
834
|
}
|
|
945
|
-
/** BM25 search. */
|
|
946
|
-
fullTextSearch(body, opts) {
|
|
947
|
-
return this.request("POST", "/v1/search/full-text", {
|
|
948
|
-
body: this.mergeReadConsistency(body, opts),
|
|
949
|
-
});
|
|
950
|
-
}
|
|
951
|
-
/** ANN/vector search. */
|
|
952
|
-
embeddingSearch(body, opts) {
|
|
953
|
-
return this.request("POST", "/v1/search/embedding", {
|
|
954
|
-
body: this.mergeReadConsistency(body, opts),
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
835
|
/**
|
|
958
836
|
* Ranked incoming/outgoing neighborhood for a graph entity.
|
|
959
837
|
*
|
|
@@ -1075,16 +953,6 @@ export class LbbClient {
|
|
|
1075
953
|
async sparqlRows(body, opts) {
|
|
1076
954
|
return parseSparqlResults(await this.sparqlText(body, opts));
|
|
1077
955
|
}
|
|
1078
|
-
/**
|
|
1079
|
-
* Basic-graph-pattern query with group-graph-pattern combinators
|
|
1080
|
-
* (UNION / OPTIONAL / MINUS / EXISTS / NOT EXISTS) folded over the base
|
|
1081
|
-
* patterns. The complement to {@link sparql}: this route carries the
|
|
1082
|
-
* combinators (but not FILTER/aggregation), so use it when a query needs an
|
|
1083
|
-
* optional/union/negated leg rather than a grouped aggregate.
|
|
1084
|
-
*/
|
|
1085
|
-
analytics(body) {
|
|
1086
|
-
return this.request("POST", "/v1/query/analytics", { body });
|
|
1087
|
-
}
|
|
1088
956
|
// --- ontology ---
|
|
1089
957
|
/**
|
|
1090
958
|
* The active ontology (entity types and relations) for the scoped graph.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { LbbCapabilityError, LbbClient, LbbError, parseSparqlResults, } from "./client.js";
|
|
2
|
-
export type { DurableImportLine, DurableImportSource, LbbClientOptions, CallOptions, RequestOptions,
|
|
2
|
+
export type { DurableImportLine, DurableImportSource, LbbClientOptions, CallOptions, RequestOptions, LbbRequestEvent, LbbResponseEvent, FetchLike, ReadConsistencyOptions, SearchConsistency, Schemas, SparqlResults, SparqlResultsJson, SparqlTerm, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, Snapshot, } from "./client.js";
|
|
3
3
|
export type { components, paths, operations } from "./schema.js";
|
package/dist/namespaces.d.ts
CHANGED
|
@@ -1,25 +1,9 @@
|
|
|
1
1
|
import type { LbbClient } from "./client.js";
|
|
2
2
|
import type { CallOptions } from "./transport.js";
|
|
3
3
|
import { type EntityAttributeFilterOptions, type ImportLine, type ReadConsistencyOptions, type RdfImportOptions, type Schemas } from "./types.js";
|
|
4
|
-
export interface HybridSearchOptions extends CallOptions {
|
|
5
|
-
topK?: number;
|
|
6
|
-
consistency?: string;
|
|
7
|
-
/** A5 read-your-writes floor (`min_indexed_seq`): the committed sequence a
|
|
8
|
-
* write returned; under eventual, an uncovered floor yields a retryable
|
|
9
|
-
* `read_your_writes_pending` 429. */
|
|
10
|
-
minIndexedSeq?: number;
|
|
11
|
-
lexical?: boolean;
|
|
12
|
-
bm25?: boolean;
|
|
13
|
-
vector?: boolean;
|
|
14
|
-
targets?: string[];
|
|
15
|
-
profile?: string;
|
|
16
|
-
/** Opt-in impression logging for later relevance feedback. */
|
|
17
|
-
logImpression?: boolean;
|
|
18
|
-
}
|
|
19
4
|
export declare class GraphNamespace {
|
|
20
5
|
private readonly client;
|
|
21
6
|
readonly facts: FactsNamespace;
|
|
22
|
-
readonly context: ContextNamespace;
|
|
23
7
|
readonly entities: EntityNamespace;
|
|
24
8
|
readonly ontology: OntologyNamespace;
|
|
25
9
|
readonly query: QueryNamespace;
|
|
@@ -34,32 +18,6 @@ export declare class GraphNamespace {
|
|
|
34
18
|
deleteBranch(opts: {
|
|
35
19
|
confirm: string;
|
|
36
20
|
} & CallOptions): Promise<Schemas["GraphBranchDeleteResponse"]>;
|
|
37
|
-
embeddingConfig(opts?: CallOptions): Promise<Schemas["ManagedEmbeddingConfigResponse"]>;
|
|
38
|
-
/** List the embedding models available on this deployment. */
|
|
39
|
-
embeddingModels(opts?: CallOptions): Promise<Schemas["ManagedEmbeddingModelsResponse"]>;
|
|
40
|
-
/** Choose the model used automatically for writes and vector queries. */
|
|
41
|
-
setEmbeddingModel(modelId: string, options?: CallOptions & {
|
|
42
|
-
autoEmbedQuery?: boolean;
|
|
43
|
-
}): Promise<Schemas["ManagedEmbeddingConfigResponse"]>;
|
|
44
|
-
/** Advanced configuration escape hatch. Prefer `setEmbeddingModel`. */
|
|
45
|
-
setEmbeddingConfig(body: Schemas["ManagedEmbeddingConfigRequest"], opts?: CallOptions): Promise<Schemas["ManagedEmbeddingConfigResponse"]>;
|
|
46
|
-
backfillEmbeddings(options?: CallOptions & {
|
|
47
|
-
batchSize?: number;
|
|
48
|
-
limit?: number;
|
|
49
|
-
full?: boolean;
|
|
50
|
-
pollIntervalMs?: number;
|
|
51
|
-
}): Promise<Schemas["ManagedEmbeddingBackfillResponse"]>;
|
|
52
|
-
submitEmbeddingBackfill(options?: CallOptions & {
|
|
53
|
-
batchSize?: number;
|
|
54
|
-
limit?: number;
|
|
55
|
-
full?: boolean;
|
|
56
|
-
}): Promise<Schemas["ManagedEmbeddingBackfillJobStatusResponse"]>;
|
|
57
|
-
embeddingBackfillJob(jobId: string): Promise<Schemas["ManagedEmbeddingBackfillJobStatusResponse"]>;
|
|
58
|
-
cancelEmbeddingBackfill(jobId: string): Promise<Schemas["ManagedEmbeddingBackfillJobStatusResponse"]>;
|
|
59
|
-
promoteEmbedding(options: CallOptions & {
|
|
60
|
-
runId: string;
|
|
61
|
-
allowRegression?: boolean;
|
|
62
|
-
}): Promise<Schemas["ManagedEmbeddingPromoteResponse"]>;
|
|
63
21
|
/** Retract edges/entities from the scoped graph. See {@link LbbClient.retract}. */
|
|
64
22
|
retract(body: Schemas["GraphRetractRequest"], opts?: CallOptions): Promise<Schemas["GraphRetractResponse"]>;
|
|
65
23
|
}
|
|
@@ -82,17 +40,16 @@ export declare class FactsNamespace {
|
|
|
82
40
|
*/
|
|
83
41
|
importRdf(rdf: string, opts?: CallOptions & RdfImportOptions): Promise<Schemas["GraphRdfImportResponse"]>;
|
|
84
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Relevance-label storage. The query surfaces this namespace once fronted were
|
|
45
|
+
* removed with their routes; SPARQL is the only query path now.
|
|
46
|
+
*/
|
|
85
47
|
export declare class SearchNamespace {
|
|
86
48
|
private readonly client;
|
|
87
49
|
constructor(client: LbbClient);
|
|
88
|
-
hybrid(query: string, opts?: HybridSearchOptions): Promise<Schemas["SemanticGraphSearchResponse"]>;
|
|
89
|
-
hybrid(body: Schemas["SemanticGraphSearchRequest"], opts?: CallOptions): Promise<Schemas["SemanticGraphSearchResponse"]>;
|
|
90
|
-
multi(body: Schemas["HybridMultiSearchRequest"], opts?: CallOptions): Promise<Schemas["HybridMultiSearchResponse"]>;
|
|
91
50
|
feedback(body: Schemas["SearchFeedbackRequest"], opts?: CallOptions): Promise<Schemas["SearchFeedbackResponse"]>;
|
|
92
51
|
feedbackExport(opts?: CallOptions): Promise<Schemas["SearchFeedbackExportResponse"]>;
|
|
93
52
|
feedbackSummary(opts?: CallOptions): Promise<Schemas["SearchFeedbackSummaryResponse"]>;
|
|
94
|
-
fullText(body: Schemas["FullTextSearchRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["FullTextSearchResponse"]>;
|
|
95
|
-
vector(body: Schemas["EmbeddingSearchRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["EmbeddingSearchResponse"]>;
|
|
96
53
|
}
|
|
97
54
|
export declare class EntityNamespace {
|
|
98
55
|
private readonly client;
|
|
@@ -124,17 +81,6 @@ export declare class EntityNamespace {
|
|
|
124
81
|
*/
|
|
125
82
|
filterByAttributes(opts: EntityAttributeFilterOptions): Promise<Schemas["SparqlSelectResponse"]>;
|
|
126
83
|
}
|
|
127
|
-
/** Grounding operations over one pinned published vocabulary. */
|
|
128
|
-
export declare class ContextNamespace {
|
|
129
|
-
private readonly client;
|
|
130
|
-
constructor(client: LbbClient);
|
|
131
|
-
suggest(body: Schemas["SearchSuggestRequest"], opts?: CallOptions): Promise<Schemas["SearchSuggestResponse"]>;
|
|
132
|
-
resolve(body: Schemas["ResolveTermRequest"], opts?: CallOptions): Promise<Schemas["ResolveTermResponse"]>;
|
|
133
|
-
decode(body: Schemas["DecodeRequest"], opts?: CallOptions): Promise<Schemas["DecodeResponse"]>;
|
|
134
|
-
groundability(options?: {
|
|
135
|
-
sample?: number;
|
|
136
|
-
} & CallOptions): Promise<Schemas["GroundabilityReport"]>;
|
|
137
|
-
}
|
|
138
84
|
/** Active ontology/SHACL bundle metadata and atomic publication. */
|
|
139
85
|
export declare class SchemaNamespace {
|
|
140
86
|
private readonly client;
|
|
@@ -158,12 +104,11 @@ export declare class OntologyNamespace {
|
|
|
158
104
|
evolve(body: Schemas["OntologyEvolveRequest"], opts?: CallOptions): Promise<Schemas["OntologyEvolveResponse"]>;
|
|
159
105
|
induce(body: Schemas["OntologyInduceRequest"], opts?: CallOptions): Promise<Schemas["OntologyInduceResponse"]>;
|
|
160
106
|
}
|
|
161
|
-
/** Structured
|
|
107
|
+
/** Structured and SPARQL-text query operations. */
|
|
162
108
|
export declare class QueryNamespace {
|
|
163
109
|
private readonly client;
|
|
164
110
|
constructor(client: LbbClient);
|
|
165
111
|
structured(body: Schemas["SparqlSelectRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["SparqlSelectResponse"]>;
|
|
166
112
|
sparql(body: Schemas["SparqlTextRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<import("./types.js").SparqlResults>;
|
|
167
113
|
sparqlRaw(body: Schemas["SparqlTextRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["SparqlTextResponse"]>;
|
|
168
|
-
analytics(body: Schemas["AnalyticQueryRequest"], opts?: CallOptions): Promise<Schemas["AnalyticQueryResponse"]>;
|
|
169
114
|
}
|