@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/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;
|
|
@@ -408,7 +261,7 @@ export class OntologyNamespace {
|
|
|
408
261
|
});
|
|
409
262
|
}
|
|
410
263
|
}
|
|
411
|
-
/** Structured
|
|
264
|
+
/** Structured and SPARQL-text query operations. */
|
|
412
265
|
export class QueryNamespace {
|
|
413
266
|
client;
|
|
414
267
|
constructor(client) {
|
|
@@ -445,11 +298,4 @@ export class QueryNamespace {
|
|
|
445
298
|
},
|
|
446
299
|
});
|
|
447
300
|
}
|
|
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
301
|
}
|