@littlebigbrain/client 0.10.0 → 0.11.1
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 +22 -29
- package/dist/client.d.ts +29 -81
- package/dist/client.js +63 -146
- package/dist/index.d.ts +1 -1
- package/dist/namespaces.d.ts +9 -60
- package/dist/namespaces.js +11 -161
- package/dist/schema.d.ts +511 -4891
- package/dist/types.d.ts +0 -3
- package/package.json +9 -1
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;
|
|
@@ -154,16 +100,19 @@ export declare class OntologyNamespace {
|
|
|
154
100
|
conformance(opts?: CallOptions & Pick<ReadConsistencyOptions, "consistency">): Promise<Schemas["SchemaAuditReport"]>;
|
|
155
101
|
search(body: Schemas["OntologySearchRequest"], opts?: CallOptions): Promise<Schemas["OntologySearchResponse"]>;
|
|
156
102
|
resolve(body: Schemas["OntologyResolveRequest"], opts?: CallOptions): Promise<Schemas["OntologyResolveResponse"]>;
|
|
103
|
+
/**
|
|
104
|
+
* Put the scoped graph on an imported ontology, creating the graph when it
|
|
105
|
+
* does not exist yet. Safe to repeat. See {@link LbbClient.ontologyDefine}.
|
|
106
|
+
*/
|
|
157
107
|
define(body: Schemas["OntologyDefineRequest"], opts?: CallOptions): Promise<Schemas["OntologyDefineResponse"]>;
|
|
158
108
|
evolve(body: Schemas["OntologyEvolveRequest"], opts?: CallOptions): Promise<Schemas["OntologyEvolveResponse"]>;
|
|
159
109
|
induce(body: Schemas["OntologyInduceRequest"], opts?: CallOptions): Promise<Schemas["OntologyInduceResponse"]>;
|
|
160
110
|
}
|
|
161
|
-
/** Structured
|
|
111
|
+
/** Structured and SPARQL-text query operations. */
|
|
162
112
|
export declare class QueryNamespace {
|
|
163
113
|
private readonly client;
|
|
164
114
|
constructor(client: LbbClient);
|
|
165
115
|
structured(body: Schemas["SparqlSelectRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["SparqlSelectResponse"]>;
|
|
166
116
|
sparql(body: Schemas["SparqlTextRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<import("./types.js").SparqlResults>;
|
|
167
117
|
sparqlRaw(body: Schemas["SparqlTextRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["SparqlTextResponse"]>;
|
|
168
|
-
analytics(body: Schemas["AnalyticQueryRequest"], opts?: CallOptions): Promise<Schemas["AnalyticQueryResponse"]>;
|
|
169
118
|
}
|
package/dist/namespaces.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { attributeFilter, firstPatternVariable, parseSparqlResults, } from "./types.js";
|
|
2
|
+
// SPARQL is the only query surface. The search, embedding, decode,
|
|
3
|
+
// groundability, and analytics operations were removed with their routes.
|
|
2
4
|
/** A5: fold read-consistency options into a request body's `consistency` /
|
|
3
5
|
* `min_indexed_seq` fields; a per-call value wins over the client default. */
|
|
4
6
|
function withReadConsistency(client, body, opts) {
|
|
@@ -13,20 +15,9 @@ function withReadConsistency(client, body, opts) {
|
|
|
13
15
|
}
|
|
14
16
|
return merged;
|
|
15
17
|
}
|
|
16
|
-
function transportOptions(options) {
|
|
17
|
-
return {
|
|
18
|
-
idempotencyKey: options.idempotencyKey,
|
|
19
|
-
timeoutMs: options.timeoutMs,
|
|
20
|
-
maxRetries: options.maxRetries,
|
|
21
|
-
retry: options.retry,
|
|
22
|
-
signal: options.signal,
|
|
23
|
-
headers: options.headers,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
18
|
export class GraphNamespace {
|
|
27
19
|
client;
|
|
28
20
|
facts;
|
|
29
|
-
context;
|
|
30
21
|
entities;
|
|
31
22
|
ontology;
|
|
32
23
|
query;
|
|
@@ -35,7 +26,6 @@ export class GraphNamespace {
|
|
|
35
26
|
constructor(client) {
|
|
36
27
|
this.client = client;
|
|
37
28
|
this.facts = new FactsNamespace(client);
|
|
38
|
-
this.context = client.context;
|
|
39
29
|
this.entities = client.entities;
|
|
40
30
|
this.ontology = client.ontology;
|
|
41
31
|
this.query = client.query;
|
|
@@ -63,63 +53,6 @@ export class GraphNamespace {
|
|
|
63
53
|
query: { confirm },
|
|
64
54
|
});
|
|
65
55
|
}
|
|
66
|
-
embeddingConfig(opts = {}) {
|
|
67
|
-
return this.client.request("GET", "/v1/graph/embedding", opts);
|
|
68
|
-
}
|
|
69
|
-
/** List the embedding models available on this deployment. */
|
|
70
|
-
embeddingModels(opts = {}) {
|
|
71
|
-
return this.client.request("GET", "/v1/graph/embedding/models", opts);
|
|
72
|
-
}
|
|
73
|
-
/** Choose the model used automatically for writes and vector queries. */
|
|
74
|
-
setEmbeddingModel(modelId, options = {}) {
|
|
75
|
-
const { autoEmbedQuery, ...request } = options;
|
|
76
|
-
return this.client.request("POST", "/v1/graph/embedding", {
|
|
77
|
-
...request,
|
|
78
|
-
body: {
|
|
79
|
-
model_id: modelId,
|
|
80
|
-
service: "open_router",
|
|
81
|
-
auto_embed_query: autoEmbedQuery ?? true,
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
/** Advanced configuration escape hatch. Prefer `setEmbeddingModel`. */
|
|
86
|
-
setEmbeddingConfig(body, opts = {}) {
|
|
87
|
-
return this.client.request("POST", "/v1/graph/embedding", {
|
|
88
|
-
...opts,
|
|
89
|
-
body,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
backfillEmbeddings(options = {}) {
|
|
93
|
-
return this.client.backfillEmbeddings({
|
|
94
|
-
batchSize: options.batchSize,
|
|
95
|
-
limit: options.limit,
|
|
96
|
-
full: options.full,
|
|
97
|
-
idempotencyKey: options.idempotencyKey,
|
|
98
|
-
timeoutMs: options.timeoutMs,
|
|
99
|
-
pollIntervalMs: options.pollIntervalMs,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
submitEmbeddingBackfill(options = {}) {
|
|
103
|
-
return this.client.submitEmbeddingBackfill({
|
|
104
|
-
batchSize: options.batchSize,
|
|
105
|
-
limit: options.limit,
|
|
106
|
-
full: options.full,
|
|
107
|
-
idempotencyKey: options.idempotencyKey,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
embeddingBackfillJob(jobId) {
|
|
111
|
-
return this.client.embeddingBackfillJob(jobId);
|
|
112
|
-
}
|
|
113
|
-
cancelEmbeddingBackfill(jobId) {
|
|
114
|
-
return this.client.cancelEmbeddingBackfill(jobId);
|
|
115
|
-
}
|
|
116
|
-
promoteEmbedding(options) {
|
|
117
|
-
const { runId, allowRegression, ...request } = options;
|
|
118
|
-
return this.client.request("POST", "/v1/graph/embedding/promote", {
|
|
119
|
-
...request,
|
|
120
|
-
query: { run_id: runId, allow_regression: allowRegression },
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
56
|
/** Retract edges/entities from the scoped graph. See {@link LbbClient.retract}. */
|
|
124
57
|
retract(body, opts = {}) {
|
|
125
58
|
return this.client.request("POST", "/v1/graph/retract", {
|
|
@@ -188,46 +121,15 @@ export class FactsNamespace {
|
|
|
188
121
|
});
|
|
189
122
|
}
|
|
190
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Relevance-label storage. The query surfaces this namespace once fronted were
|
|
126
|
+
* removed with their routes; SPARQL is the only query path now.
|
|
127
|
+
*/
|
|
191
128
|
export class SearchNamespace {
|
|
192
129
|
client;
|
|
193
130
|
constructor(client) {
|
|
194
131
|
this.client = client;
|
|
195
132
|
}
|
|
196
|
-
hybrid(input, opts = {}) {
|
|
197
|
-
if (typeof input !== "string") {
|
|
198
|
-
const search = withReadConsistency(this.client, input.search ?? {}, {
|
|
199
|
-
consistency: opts.consistency,
|
|
200
|
-
minIndexedSeq: opts.minIndexedSeq,
|
|
201
|
-
});
|
|
202
|
-
return this.client.request("POST", "/v1/graph/search", {
|
|
203
|
-
...transportOptions(opts),
|
|
204
|
-
retry: opts.retry ?? true,
|
|
205
|
-
body: { ...input, search },
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
return this.client.request("GET", "/v1/search", {
|
|
209
|
-
...transportOptions(opts),
|
|
210
|
-
query: {
|
|
211
|
-
query: input,
|
|
212
|
-
top_k: opts.topK,
|
|
213
|
-
consistency: opts.consistency ?? this.client.defaultConsistency,
|
|
214
|
-
min_indexed_seq: opts.minIndexedSeq,
|
|
215
|
-
lexical: opts.lexical,
|
|
216
|
-
bm25: opts.bm25,
|
|
217
|
-
vector: opts.vector,
|
|
218
|
-
targets: opts.targets?.join(","),
|
|
219
|
-
profile: opts.profile,
|
|
220
|
-
log_impression: opts.logImpression,
|
|
221
|
-
},
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
multi(body, opts = {}) {
|
|
225
|
-
return this.client.request("POST", "/v1/search/multi", {
|
|
226
|
-
...opts,
|
|
227
|
-
retry: opts.retry ?? true,
|
|
228
|
-
body,
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
133
|
feedback(body, opts = {}) {
|
|
232
134
|
return this.client.request("POST", "/v1/search/feedback", {
|
|
233
135
|
...opts,
|
|
@@ -240,20 +142,6 @@ export class SearchNamespace {
|
|
|
240
142
|
feedbackSummary(opts = {}) {
|
|
241
143
|
return this.client.request("GET", "/v1/search/feedback/summary", opts);
|
|
242
144
|
}
|
|
243
|
-
fullText(body, opts = {}) {
|
|
244
|
-
return this.client.request("POST", "/v1/search/full-text", {
|
|
245
|
-
...opts,
|
|
246
|
-
retry: opts.retry ?? true,
|
|
247
|
-
body: withReadConsistency(this.client, body, opts),
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
vector(body, opts = {}) {
|
|
251
|
-
return this.client.request("POST", "/v1/search/embedding", {
|
|
252
|
-
...opts,
|
|
253
|
-
retry: opts.retry ?? true,
|
|
254
|
-
body: withReadConsistency(this.client, body, opts),
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
145
|
}
|
|
258
146
|
export class EntityNamespace {
|
|
259
147
|
client;
|
|
@@ -299,41 +187,6 @@ export class EntityNamespace {
|
|
|
299
187
|
});
|
|
300
188
|
}
|
|
301
189
|
}
|
|
302
|
-
/** Grounding operations over one pinned published vocabulary. */
|
|
303
|
-
export class ContextNamespace {
|
|
304
|
-
client;
|
|
305
|
-
constructor(client) {
|
|
306
|
-
this.client = client;
|
|
307
|
-
}
|
|
308
|
-
suggest(body, opts = {}) {
|
|
309
|
-
return this.client.request("POST", "/v1/search/suggest", {
|
|
310
|
-
...opts,
|
|
311
|
-
retry: opts.retry ?? true,
|
|
312
|
-
body,
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
resolve(body, opts = {}) {
|
|
316
|
-
return this.client.request("POST", "/v1/search/resolve-term", {
|
|
317
|
-
...opts,
|
|
318
|
-
retry: opts.retry ?? true,
|
|
319
|
-
body,
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
decode(body, opts = {}) {
|
|
323
|
-
return this.client.request("POST", "/v1/decode", {
|
|
324
|
-
...opts,
|
|
325
|
-
retry: opts.retry ?? true,
|
|
326
|
-
body,
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
groundability(options = {}) {
|
|
330
|
-
const { sample, ...request } = options;
|
|
331
|
-
return this.client.request("GET", "/v1/graph/groundability", {
|
|
332
|
-
...request,
|
|
333
|
-
query: sample === undefined ? undefined : { sample },
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
190
|
/** Active ontology/SHACL bundle metadata and atomic publication. */
|
|
338
191
|
export class SchemaNamespace {
|
|
339
192
|
client;
|
|
@@ -388,6 +241,10 @@ export class OntologyNamespace {
|
|
|
388
241
|
body,
|
|
389
242
|
});
|
|
390
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Put the scoped graph on an imported ontology, creating the graph when it
|
|
246
|
+
* does not exist yet. Safe to repeat. See {@link LbbClient.ontologyDefine}.
|
|
247
|
+
*/
|
|
391
248
|
define(body, opts = {}) {
|
|
392
249
|
return this.client.request("POST", "/v1/ontology/define", {
|
|
393
250
|
...opts,
|
|
@@ -408,7 +265,7 @@ export class OntologyNamespace {
|
|
|
408
265
|
});
|
|
409
266
|
}
|
|
410
267
|
}
|
|
411
|
-
/** Structured
|
|
268
|
+
/** Structured and SPARQL-text query operations. */
|
|
412
269
|
export class QueryNamespace {
|
|
413
270
|
client;
|
|
414
271
|
constructor(client) {
|
|
@@ -445,11 +302,4 @@ export class QueryNamespace {
|
|
|
445
302
|
},
|
|
446
303
|
});
|
|
447
304
|
}
|
|
448
|
-
analytics(body, opts = {}) {
|
|
449
|
-
return this.client.request("POST", "/v1/query/analytics", {
|
|
450
|
-
...opts,
|
|
451
|
-
retry: opts.retry ?? true,
|
|
452
|
-
body,
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
305
|
}
|