@littlebigbrain/client 0.13.0 → 0.13.2
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 +103 -88
- package/dist/client.d.ts +13 -4
- package/dist/client.js +16 -4
- package/dist/namespaces.d.ts +92 -8
- package/dist/namespaces.js +177 -3
- package/dist/schema.d.ts +4567 -215
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,129 +1,144 @@
|
|
|
1
1
|
# @littlebigbrain/client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript client for [little big brain](https://littlebigbrain.com), a search
|
|
4
|
+
platform for AI applications such as chatbots, search tools, and agents.
|
|
5
|
+
Load facts, query their relationships, and keep the data version behind an answer
|
|
6
|
+
so you can check it later.
|
|
7
|
+
|
|
8
|
+
The client has no runtime dependencies and includes generated request and response
|
|
9
|
+
types. It uses `fetch` and supports Node.js 18+, browsers, and edge workers.
|
|
10
|
+
Keep stack API keys on your server or local machine, outside browser bundles.
|
|
11
|
+
|
|
12
|
+
[Documentation](https://docs.littlebigbrain.com/sdks/typescript/) ·
|
|
13
|
+
[Quickstart](https://docs.littlebigbrain.com/start/quickstart/) ·
|
|
14
|
+
[Issues](https://github.com/littlebigbrains/lbb-typescript/issues)
|
|
15
|
+
|
|
16
|
+
## Install
|
|
4
17
|
|
|
5
18
|
```sh
|
|
6
19
|
npm install @littlebigbrain/client
|
|
7
20
|
```
|
|
8
21
|
|
|
9
|
-
##
|
|
22
|
+
## Load facts and run a query
|
|
23
|
+
|
|
24
|
+
Create a stack in the [console](https://cloud.littlebigbrain.com) and open
|
|
25
|
+
**Connect**. Copy its complete endpoint and a stack API key:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
export LBB_URL="https://<your-complete-stack-host>"
|
|
29
|
+
export LBB_API_KEY="<your-stack-api-key>"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This example creates a graph named `quickstart` on its first write. It stores
|
|
33
|
+
three facts: a service writes to a database, and each has a label. The data uses
|
|
34
|
+
Resource Description Framework (RDF), where each line names a subject, a
|
|
35
|
+
relationship, and a value or another record. SPARQL is the query language for
|
|
36
|
+
those facts.
|
|
37
|
+
|
|
38
|
+
Save as `quickstart.mts`, then run `npx tsx quickstart.mts`:
|
|
10
39
|
|
|
11
40
|
```ts
|
|
12
41
|
import { LbbClient } from "@littlebigbrain/client";
|
|
13
42
|
|
|
14
43
|
const lbb = new LbbClient({
|
|
15
|
-
baseUrl:
|
|
16
|
-
apiKey: process.env.LBB_API_KEY
|
|
44
|
+
baseUrl: process.env.LBB_URL!,
|
|
45
|
+
apiKey: process.env.LBB_API_KEY!,
|
|
46
|
+
graph: "quickstart",
|
|
17
47
|
});
|
|
18
|
-
const graph = lbb.graph("main");
|
|
19
|
-
|
|
20
|
-
// 1. Write a fact.
|
|
21
|
-
await graph.facts.create(
|
|
22
|
-
{
|
|
23
|
-
triplets: [
|
|
24
|
-
{
|
|
25
|
-
source: { type: "CONCEPT", name: "policy-42" },
|
|
26
|
-
relation: "RELATED_TO",
|
|
27
|
-
target: { type: "CONCEPT", name: "seven-year retention" },
|
|
28
|
-
evidence: "Customer records are retained for seven years.",
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
{ idempotencyKey: "policy-42-v1" },
|
|
33
|
-
);
|
|
34
48
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
49
|
+
const facts = `
|
|
50
|
+
<https://example.org/auth-service> <https://example.org/writesTo> <https://example.org/user-db> .
|
|
51
|
+
<https://example.org/auth-service> <http://www.w3.org/2000/01/rdf-schema#label> "Auth Service" .
|
|
52
|
+
<https://example.org/user-db> <http://www.w3.org/2000/01/rdf-schema#label> "User Database" .
|
|
53
|
+
`;
|
|
38
54
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
55
|
+
const imported = await lbb.graph("quickstart").facts.importRdf(facts, {
|
|
56
|
+
format: "ntriples",
|
|
57
|
+
idempotencyKey: "sdk-quickstart-v1",
|
|
42
58
|
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
await
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// …one record per line
|
|
58
|
-
],
|
|
59
|
-
{ idempotencyKey: "handbook-batch-1" },
|
|
59
|
+
const commitSeq = imported.committed_commit_seq;
|
|
60
|
+
if (commitSeq == null) throw new Error("The import did not return a commit sequence.");
|
|
61
|
+
|
|
62
|
+
const query = `
|
|
63
|
+
SELECT ?service ?database WHERE {
|
|
64
|
+
?s <https://example.org/writesTo> ?db .
|
|
65
|
+
?s <http://www.w3.org/2000/01/rdf-schema#label> ?service .
|
|
66
|
+
?db <http://www.w3.org/2000/01/rdf-schema#label> ?database .
|
|
67
|
+
} ORDER BY ?service ?database LIMIT 10
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
const { rows } = await lbb.sparqlRows(
|
|
71
|
+
{ query },
|
|
72
|
+
{ consistency: "strong", minIndexedSeq: commitSeq },
|
|
60
73
|
);
|
|
74
|
+
|
|
75
|
+
for (const row of rows) console.log(`${row.service} -> ${row.database}`);
|
|
61
76
|
```
|
|
62
77
|
|
|
63
|
-
|
|
78
|
+
On a fresh graph, this prints:
|
|
64
79
|
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
idempotencyKey: "hubspot:portal-42:run-2026-07-29",
|
|
68
|
-
});
|
|
69
|
-
const completed = await lbb.waitForImportJob(accepted.job_id);
|
|
70
|
-
console.log(completed.state, completed.committed_commit_seq);
|
|
80
|
+
```text
|
|
81
|
+
Auth Service -> User Database
|
|
71
82
|
```
|
|
72
83
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
The query follows the stored relationship between the service and database.
|
|
85
|
+
`consistency: "strong"` makes the new facts available to this read without
|
|
86
|
+
waiting for a background index job. Reads default to eventual consistency, so
|
|
87
|
+
omit this option only when an earlier version is acceptable.
|
|
88
|
+
|
|
89
|
+
The idempotency key makes repeating the same import safe. Use a new key if you
|
|
90
|
+
change the data.
|
|
78
91
|
|
|
79
|
-
|
|
80
|
-
intermediate reconciliation and triggers it on the last document. Call
|
|
81
|
-
`graph.waitForPublished(result.finalSequence)` only when the caller needs the
|
|
82
|
-
immutable base itself to cover the import; strong reads need no waiter.
|
|
92
|
+
## Read the same version again
|
|
83
93
|
|
|
84
|
-
|
|
94
|
+
Run the query at the commit returned by the import:
|
|
85
95
|
|
|
86
96
|
```ts
|
|
87
|
-
const
|
|
88
|
-
query
|
|
89
|
-
|
|
97
|
+
const replay = await lbb.sparqlRows({
|
|
98
|
+
query,
|
|
99
|
+
as_of_commit_seq: commitSeq,
|
|
90
100
|
});
|
|
101
|
+
console.log(replay.rows);
|
|
91
102
|
```
|
|
92
103
|
|
|
93
|
-
|
|
104
|
+
Save the query, its options, and the commit sequence with any answer you need to
|
|
105
|
+
check later. See [history and replay](https://docs.littlebigbrain.com/guides/time-travel-audit/)
|
|
106
|
+
for retention and evidence handling.
|
|
94
107
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
108
|
+
## Next steps
|
|
109
|
+
|
|
110
|
+
- [Search by meaning](https://docs.littlebigbrain.com/guides/search-by-meaning/): choose which facts to embed and find records from a text description.
|
|
111
|
+
- [Load your own RDF](https://docs.littlebigbrain.com/guides/load-rdf/): import Turtle, N-Triples, N-Quads, or TriG.
|
|
112
|
+
- [Work with JSON records](https://docs.littlebigbrain.com/guides/without-rdf/): define a schema and write records without writing RDF.
|
|
113
|
+
- [Validate writes](https://docs.littlebigbrain.com/guides/sparql-and-shacl/): define constraints with the Shapes Constraint Language (SHACL).
|
|
100
114
|
|
|
101
|
-
|
|
115
|
+
The RDF and JSON guides use different write workflows. Choose one when creating
|
|
116
|
+
a graph; a graph first written through RDF import does not accept
|
|
117
|
+
`facts.create` or JSON record imports.
|
|
102
118
|
|
|
103
|
-
|
|
104
|
-
`waitForPublished(...)` is an optional, deadline-bounded maintenance poller for
|
|
105
|
-
workflows that want the immutable RDF base itself to cover a commit. Strong
|
|
106
|
-
SPARQL does not need it: acknowledged commits are queryable immediately from
|
|
107
|
-
the branch head's base-plus-delta lineage.
|
|
119
|
+
## Errors and retries
|
|
108
120
|
|
|
109
|
-
|
|
121
|
+
Failed HTTP requests throw `LbbError`, with a status, error code, message, and
|
|
122
|
+
request ID. Use `rawRequest()` when you also need response headers or timing.
|
|
110
123
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
published-generation maintenance automatically. Every generated shape is
|
|
116
|
-
available as `Schemas["TypeName"]`. Retired request-time JSON SHACL DTOs are
|
|
117
|
-
intentionally absent: publish RDF shapes with `schema.publish`, then read
|
|
118
|
-
`ontology.conformance`.
|
|
124
|
+
Safe reads and writes with an idempotency key retry rate limits, retryable server
|
|
125
|
+
errors, and network failures. Retries respect `Retry-After` and use a 60-second
|
|
126
|
+
budget by default. See the [client reference](https://docs.littlebigbrain.com/sdks/typescript/)
|
|
127
|
+
for timeout and retry options.
|
|
119
128
|
|
|
120
|
-
|
|
129
|
+
## Development
|
|
121
130
|
|
|
122
|
-
|
|
131
|
+
From a clone of this repository:
|
|
123
132
|
|
|
124
133
|
```sh
|
|
125
|
-
npm
|
|
126
|
-
npm run generate # regenerate types from contracts/openapi.json
|
|
134
|
+
npm ci
|
|
127
135
|
npm run typecheck
|
|
128
136
|
npm test
|
|
129
137
|
```
|
|
138
|
+
|
|
139
|
+
The request and response types are generated from the API contract. See
|
|
140
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) for changes to generated types.
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
[Apache-2.0](LICENSE).
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DurableImportSource, ImportLine, LbbClientOptions, ListResponse, RawLbbResponse, ReadConsistencyOptions, RdfImportDocument, RdfImportManyResult, RdfImportOptions, Schemas, SearchConsistency, SparqlResults } from "./types.js";
|
|
2
2
|
import { type CallOptions, type RequestOptions } from "./transport.js";
|
|
3
|
-
import { EntityNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace } from "./namespaces.js";
|
|
3
|
+
import { EntityNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, EvalsNamespace, EmbeddingsNamespace } from "./namespaces.js";
|
|
4
4
|
export { parseSparqlResults } from "./types.js";
|
|
5
5
|
export type { AttributeFilter, AttributeFilterOp, AttributeFilterValue, EntityAttributeFilterOptions, EntityPropertiesLine, DurableImportLine, DurableImportSource, FetchLike, FlatProperties, ImportLine, LbbClientOptions, LbbRequestEvent, LbbResponseEvent, LbbRetryEvent, LbbErrorPayload, ListResponse, RawLbbResponse, ReadConsistencyOptions, RdfImportDocument, RdfImportManyResult, 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";
|
|
@@ -34,6 +34,8 @@ export declare class LbbClient {
|
|
|
34
34
|
readonly schema: SchemaNamespace;
|
|
35
35
|
readonly ontology: OntologyNamespace;
|
|
36
36
|
readonly query: QueryNamespace;
|
|
37
|
+
readonly evals: EvalsNamespace;
|
|
38
|
+
readonly embeddings: EmbeddingsNamespace;
|
|
37
39
|
constructor(options: LbbClientOptions);
|
|
38
40
|
graph(name: string, opts?: {
|
|
39
41
|
branch?: string;
|
|
@@ -361,14 +363,18 @@ export declare class LbbClient {
|
|
|
361
363
|
asOf?: string;
|
|
362
364
|
}): Promise<Schemas["EntityMetadataResponse"]>;
|
|
363
365
|
/**
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
366
|
+
* Read projected attributes and current relationships from one RDF snapshot.
|
|
367
|
+
* Inspect `unavailable_sections` before interpreting legacy provenance arrays.
|
|
368
|
+
* Use strong consistency for read-after-write, or a retained commit sequence.
|
|
367
369
|
*/
|
|
368
370
|
entityDetail(opts: {
|
|
369
371
|
id?: string;
|
|
370
372
|
type?: string;
|
|
371
373
|
name?: string;
|
|
374
|
+
key?: string;
|
|
375
|
+
consistency?: "strong" | "eventual";
|
|
376
|
+
edges?: number;
|
|
377
|
+
/** @deprecated Valid-time reads are unsupported; use asOfCommitSeq. */
|
|
372
378
|
asOf?: string;
|
|
373
379
|
asOfCommitSeq?: number;
|
|
374
380
|
}): Promise<Schemas["EntityDetailResponse"]>;
|
|
@@ -463,6 +469,9 @@ export declare class LbbClient {
|
|
|
463
469
|
}): Promise<Schemas["GraphMetadataResponse"]>;
|
|
464
470
|
/** Automatic publication lifecycle, available before the first generation exists. */
|
|
465
471
|
publicationStatus(): Promise<Schemas["PublicationStatusResponse"]>;
|
|
472
|
+
/** The managed models the platform uses per role (embedding, judge,
|
|
473
|
+
* rewriter): the operator's catalog, or the compiled defaults. */
|
|
474
|
+
managedModels(): Promise<Schemas["ManagedModelsResponse"]>;
|
|
466
475
|
/** Wait until background reconciliation folds `targetSeq` into the RDF base. */
|
|
467
476
|
waitForPublished(targetSeq: number, opts?: {
|
|
468
477
|
timeoutMs?: number;
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 { EntityNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
4
|
+
import { EntityNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, EvalsNamespace, EmbeddingsNamespace, } from "./namespaces.js";
|
|
5
5
|
export { parseSparqlResults } from "./types.js";
|
|
6
6
|
export { LbbCapabilityError, LbbError } from "./transport.js";
|
|
7
7
|
export { EntityNamespace, FactsNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
@@ -110,6 +110,8 @@ export class LbbClient {
|
|
|
110
110
|
schema;
|
|
111
111
|
ontology;
|
|
112
112
|
query;
|
|
113
|
+
evals;
|
|
114
|
+
embeddings;
|
|
113
115
|
constructor(options) {
|
|
114
116
|
const baseUrl = options.baseUrl?.trim();
|
|
115
117
|
if (!baseUrl) {
|
|
@@ -152,6 +154,8 @@ export class LbbClient {
|
|
|
152
154
|
this.schema = new SchemaNamespace(this);
|
|
153
155
|
this.ontology = new OntologyNamespace(this);
|
|
154
156
|
this.query = new QueryNamespace(this);
|
|
157
|
+
this.evals = new EvalsNamespace(this);
|
|
158
|
+
this.embeddings = new EmbeddingsNamespace(this);
|
|
155
159
|
}
|
|
156
160
|
graph(name, opts = {}) {
|
|
157
161
|
return new GraphNamespace(this.withScope({
|
|
@@ -900,9 +904,9 @@ export class LbbClient {
|
|
|
900
904
|
});
|
|
901
905
|
}
|
|
902
906
|
/**
|
|
903
|
-
*
|
|
904
|
-
*
|
|
905
|
-
*
|
|
907
|
+
* Read projected attributes and current relationships from one RDF snapshot.
|
|
908
|
+
* Inspect `unavailable_sections` before interpreting legacy provenance arrays.
|
|
909
|
+
* Use strong consistency for read-after-write, or a retained commit sequence.
|
|
906
910
|
*/
|
|
907
911
|
entityDetail(opts) {
|
|
908
912
|
return this.request("GET", "/v1/graph/entity", {
|
|
@@ -910,6 +914,9 @@ export class LbbClient {
|
|
|
910
914
|
id: opts.id,
|
|
911
915
|
type: opts.type,
|
|
912
916
|
name: opts.name,
|
|
917
|
+
key: opts.key,
|
|
918
|
+
consistency: opts.consistency,
|
|
919
|
+
edges: opts.edges,
|
|
913
920
|
as_of: opts.asOf,
|
|
914
921
|
as_of_commit_seq: opts.asOfCommitSeq,
|
|
915
922
|
},
|
|
@@ -1066,6 +1073,11 @@ export class LbbClient {
|
|
|
1066
1073
|
publicationStatus() {
|
|
1067
1074
|
return this.request("GET", "/v1/graph/publication-status");
|
|
1068
1075
|
}
|
|
1076
|
+
/** The managed models the platform uses per role (embedding, judge,
|
|
1077
|
+
* rewriter): the operator's catalog, or the compiled defaults. */
|
|
1078
|
+
managedModels() {
|
|
1079
|
+
return this.request("GET", "/v1/managed-models");
|
|
1080
|
+
}
|
|
1069
1081
|
/** Wait until background reconciliation folds `targetSeq` into the RDF base. */
|
|
1070
1082
|
async waitForPublished(targetSeq, opts = {}) {
|
|
1071
1083
|
if (!Number.isSafeInteger(targetSeq) || targetSeq < 0) {
|
package/dist/namespaces.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export declare class GraphNamespace {
|
|
|
9
9
|
readonly query: QueryNamespace;
|
|
10
10
|
readonly schema: SchemaNamespace;
|
|
11
11
|
readonly search: SearchNamespace;
|
|
12
|
+
readonly evals: EvalsNamespace;
|
|
13
|
+
readonly embeddings: EmbeddingsNamespace;
|
|
12
14
|
constructor(client: LbbClient);
|
|
13
15
|
branch(name: string): GraphNamespace;
|
|
14
16
|
/** Publication lifecycle for this graph/branch, including pre-first-publish state. */
|
|
@@ -51,7 +53,7 @@ export declare class FactsNamespace {
|
|
|
51
53
|
}
|
|
52
54
|
/**
|
|
53
55
|
* Relevance-label storage. The query surfaces this namespace once fronted were
|
|
54
|
-
* removed with their routes;
|
|
56
|
+
* removed with their routes; search by meaning is `embeddings.search`.
|
|
55
57
|
*/
|
|
56
58
|
export declare class SearchNamespace {
|
|
57
59
|
private readonly client;
|
|
@@ -77,11 +79,7 @@ export declare class EntityNamespace {
|
|
|
77
79
|
name?: string;
|
|
78
80
|
asOf?: string;
|
|
79
81
|
}): Promise<Schemas["EntityMetadataResponse"]>;
|
|
80
|
-
detail(opts:
|
|
81
|
-
id?: string;
|
|
82
|
-
type?: string;
|
|
83
|
-
name?: string;
|
|
84
|
-
}): Promise<Schemas["EntityDetailResponse"]>;
|
|
82
|
+
detail(opts: Parameters<LbbClient["entityDetail"]>[0]): Promise<Schemas["EntityDetailResponse"]>;
|
|
85
83
|
/**
|
|
86
84
|
* Filter entities already bound by relation patterns using typed attributes,
|
|
87
85
|
* without writing RDF property IRIs by hand. This is a convenience wrapper over
|
|
@@ -90,6 +88,88 @@ export declare class EntityNamespace {
|
|
|
90
88
|
*/
|
|
91
89
|
filterByAttributes(opts: EntityAttributeFilterOptions): Promise<Schemas["SparqlSelectResponse"]>;
|
|
92
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Search: embeddings declared on classes of the graph. The platform keeps the
|
|
93
|
+
* vectors in step with the published graph; a search checks every hit against
|
|
94
|
+
* one graph snapshot.
|
|
95
|
+
*/
|
|
96
|
+
export declare class EmbeddingsNamespace {
|
|
97
|
+
private readonly client;
|
|
98
|
+
constructor(client: LbbClient);
|
|
99
|
+
/** Every embedding of the branch with its status. */
|
|
100
|
+
list(opts?: CallOptions): Promise<Schemas["EmbeddingListResponse"]>;
|
|
101
|
+
/** One embedding: serving and building version, backfill, lag, recall. */
|
|
102
|
+
get(name: string, opts?: CallOptions): Promise<Schemas["EmbeddingStatus"]>;
|
|
103
|
+
/**
|
|
104
|
+
* Declare or change the embedding of a class. Without `from` the server
|
|
105
|
+
* picks the fields (the label, frequent text, the names of linked
|
|
106
|
+
* entities). A new recipe builds as a new version while the old one serves.
|
|
107
|
+
*/
|
|
108
|
+
declare(body: Schemas["EmbeddingDeclareRequest"], opts?: CallOptions): Promise<Schemas["EmbeddingStatus"]>;
|
|
109
|
+
/**
|
|
110
|
+
* What a declaration would embed: the fields, every candidate fact of the
|
|
111
|
+
* class with its coverage and examples, and sample texts. Calls no model.
|
|
112
|
+
*/
|
|
113
|
+
preview(body: Schemas["EmbeddingPreviewRequest"], opts?: CallOptions): Promise<Schemas["EmbeddingPreviewResponse"]>;
|
|
114
|
+
/**
|
|
115
|
+
* Move every embedding of the graph to another model (one model per
|
|
116
|
+
* graph). Each builds a new version; the graph switches at once when
|
|
117
|
+
* every embedding has it ready, so a search never mixes two models.
|
|
118
|
+
*/
|
|
119
|
+
setModel(body: Schemas["EmbeddingModelRequest"], opts?: CallOptions): Promise<Schemas["EmbeddingListResponse"]>;
|
|
120
|
+
/** Run one bounded step of the embed job now. */
|
|
121
|
+
refresh(name: string, opts?: CallOptions): Promise<Schemas["EmbeddingRefreshResponse"]>;
|
|
122
|
+
/** Remove an embedding. */
|
|
123
|
+
delete(name: string, opts?: CallOptions): Promise<unknown>;
|
|
124
|
+
/**
|
|
125
|
+
* Search by meaning over every searchable class of the graph (or one
|
|
126
|
+
* `embedding`). `filter` lists the conditions every hit must meet:
|
|
127
|
+
* `{ class: iri }` (or a list; subclasses too) and
|
|
128
|
+
* `{ via: "calls", to: "payment-service", direction?: "in" }` (`to` an IRI
|
|
129
|
+
* or a name). Every hit carries its class and is checked against one
|
|
130
|
+
* graph snapshot; `include: ["text"]` returns the embedded text of each
|
|
131
|
+
* hit; `explain: true` plans without running.
|
|
132
|
+
*/
|
|
133
|
+
search(body: Schemas["SearchRequest"], opts?: CallOptions): Promise<Schemas["SearchResponse"]>;
|
|
134
|
+
}
|
|
135
|
+
/** Managed evals: traces, labels (thumbs up or down), goldens, and runs. */
|
|
136
|
+
export declare class EvalsNamespace {
|
|
137
|
+
private readonly client;
|
|
138
|
+
constructor(client: LbbClient);
|
|
139
|
+
/** Settings, golden counts, unlabeled traces, the latest run, and the score by commit. */
|
|
140
|
+
summary(opts?: CallOptions): Promise<Schemas["EvalSummaryResponse"]>;
|
|
141
|
+
/** Recent traces, newest first. */
|
|
142
|
+
traces(options?: {
|
|
143
|
+
limit?: number;
|
|
144
|
+
unlabeled?: boolean;
|
|
145
|
+
} & CallOptions): Promise<Schemas["EvalTraceListResponse"]>;
|
|
146
|
+
/** One trace: the request, its query, its results (one item per hit or
|
|
147
|
+
* row), and their labels. */
|
|
148
|
+
trace(id: string, opts?: CallOptions): Promise<Schemas["EvalTrace"]>;
|
|
149
|
+
/** Thumbs up or down on results of a trace: one result as `item` +
|
|
150
|
+
* `valid`, or several in `items`. The labels become the golden's ground
|
|
151
|
+
* truth. */
|
|
152
|
+
label(traceId: string, body: Schemas["EvalLabelRequest"], opts?: CallOptions): Promise<Schemas["EvalLabelResponse"]>;
|
|
153
|
+
/** Let the managed judge label the results of one trace, or of a batch of
|
|
154
|
+
* traces with unlabeled results. */
|
|
155
|
+
judge(options?: {
|
|
156
|
+
traceId?: string;
|
|
157
|
+
limit?: number;
|
|
158
|
+
} & CallOptions): Promise<Schemas["EvalJudgeResponse"]>;
|
|
159
|
+
goldens(opts?: CallOptions): Promise<Schemas["GoldenSuite"]>;
|
|
160
|
+
/** Freeze a query: every result it returns now is relevant. */
|
|
161
|
+
createGolden(body: Schemas["GoldenCreateRequest"], opts?: CallOptions): Promise<Schemas["GoldenResponse"]>;
|
|
162
|
+
/** Accept the results a golden returns now as its reference. */
|
|
163
|
+
acceptGolden(id: string, opts?: CallOptions & Pick<ReadConsistencyOptions, "consistency">): Promise<Schemas["GoldenResponse"]>;
|
|
164
|
+
deleteGolden(id: string, opts?: CallOptions): Promise<Schemas["GoldenDeleteResponse"]>;
|
|
165
|
+
/** Replay every golden at the current commit. */
|
|
166
|
+
run(opts?: CallOptions & Pick<ReadConsistencyOptions, "consistency">): Promise<Schemas["EvalRunResponse"]>;
|
|
167
|
+
results(options?: {
|
|
168
|
+
limit?: number;
|
|
169
|
+
} & CallOptions): Promise<Schemas["EvalResultsListResponse"]>;
|
|
170
|
+
settings(opts?: CallOptions): Promise<Schemas["EvalSettings"]>;
|
|
171
|
+
setSettings(body: Schemas["EvalSettings"], opts?: CallOptions): Promise<Schemas["EvalSettings"]>;
|
|
172
|
+
}
|
|
93
173
|
/** Active ontology/SHACL bundle metadata and atomic publication. */
|
|
94
174
|
export declare class SchemaNamespace {
|
|
95
175
|
private readonly client;
|
|
@@ -97,7 +177,9 @@ export declare class SchemaNamespace {
|
|
|
97
177
|
/** Read active metadata without running request-time validation. */
|
|
98
178
|
view(opts?: CallOptions): Promise<Schemas["SchemaBundleView"]>;
|
|
99
179
|
/** Atomically publish a bundle; conformance is produced asynchronously. */
|
|
100
|
-
publish(body: Schemas["SchemaPublishRequest"], opts?: CallOptions
|
|
180
|
+
publish(body: Schemas["SchemaPublishRequest"], opts?: CallOptions & {
|
|
181
|
+
dryRun?: boolean;
|
|
182
|
+
}): Promise<Schemas["SchemaPublishResponse"]>;
|
|
101
183
|
}
|
|
102
184
|
/** Ontology discovery and lifecycle operations. */
|
|
103
185
|
export declare class OntologyNamespace {
|
|
@@ -114,7 +196,9 @@ export declare class OntologyNamespace {
|
|
|
114
196
|
* does not exist yet. Safe to repeat. See {@link LbbClient.ontologyDefine}.
|
|
115
197
|
*/
|
|
116
198
|
define(body: Schemas["OntologyDefineRequest"], opts?: CallOptions): Promise<Schemas["OntologyDefineResponse"]>;
|
|
117
|
-
evolve(body: Schemas["OntologyEvolveRequest"], opts?: CallOptions
|
|
199
|
+
evolve(body: Schemas["OntologyEvolveRequest"], opts?: CallOptions & {
|
|
200
|
+
dryRun?: boolean;
|
|
201
|
+
}): Promise<Schemas["OntologyEvolveResponse"]>;
|
|
118
202
|
induce(body: Schemas["OntologyInduceRequest"], opts?: CallOptions): Promise<Schemas["OntologyInduceResponse"]>;
|
|
119
203
|
}
|
|
120
204
|
/** Structured and SPARQL-text query operations. */
|