bem-ai-sdk 0.26.0 → 0.27.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.
Files changed (174) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/client.d.mts +127 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +127 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +136 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +136 -3
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/buckets.d.mts +272 -0
  12. package/resources/buckets.d.mts.map +1 -0
  13. package/resources/buckets.d.ts +272 -0
  14. package/resources/buckets.d.ts.map +1 -0
  15. package/resources/buckets.js +93 -0
  16. package/resources/buckets.js.map +1 -0
  17. package/resources/buckets.mjs +89 -0
  18. package/resources/buckets.mjs.map +1 -0
  19. package/resources/entities/entities.d.mts +516 -0
  20. package/resources/entities/entities.d.mts.map +1 -0
  21. package/resources/entities/entities.d.ts +516 -0
  22. package/resources/entities/entities.d.ts.map +1 -0
  23. package/resources/entities/entities.js +93 -0
  24. package/resources/entities/entities.js.map +1 -0
  25. package/resources/entities/entities.mjs +88 -0
  26. package/resources/entities/entities.mjs.map +1 -0
  27. package/resources/entities/index.d.mts +3 -0
  28. package/resources/entities/index.d.mts.map +1 -0
  29. package/resources/entities/index.d.ts +3 -0
  30. package/resources/entities/index.d.ts.map +1 -0
  31. package/resources/entities/index.js +9 -0
  32. package/resources/entities/index.js.map +1 -0
  33. package/resources/entities/index.mjs +4 -0
  34. package/resources/entities/index.mjs.map +1 -0
  35. package/resources/entities/synonyms.d.mts +109 -0
  36. package/resources/entities/synonyms.d.mts.map +1 -0
  37. package/resources/entities/synonyms.d.ts +109 -0
  38. package/resources/entities/synonyms.d.ts.map +1 -0
  39. package/resources/entities/synonyms.js +61 -0
  40. package/resources/entities/synonyms.js.map +1 -0
  41. package/resources/entities/synonyms.mjs +57 -0
  42. package/resources/entities/synonyms.mjs.map +1 -0
  43. package/resources/entities.d.mts +2 -0
  44. package/resources/entities.d.mts.map +1 -0
  45. package/resources/entities.d.ts +2 -0
  46. package/resources/entities.d.ts.map +1 -0
  47. package/resources/entities.js +6 -0
  48. package/resources/entities.js.map +1 -0
  49. package/resources/entities.mjs +3 -0
  50. package/resources/entities.mjs.map +1 -0
  51. package/resources/entity-types/entity-types.d.mts +302 -0
  52. package/resources/entity-types/entity-types.d.mts.map +1 -0
  53. package/resources/entity-types/entity-types.d.ts +302 -0
  54. package/resources/entity-types/entity-types.d.ts.map +1 -0
  55. package/resources/entity-types/entity-types.js +104 -0
  56. package/resources/entity-types/entity-types.js.map +1 -0
  57. package/resources/entity-types/entity-types.mjs +99 -0
  58. package/resources/entity-types/entity-types.mjs.map +1 -0
  59. package/resources/entity-types/index.d.mts +3 -0
  60. package/resources/entity-types/index.d.mts.map +1 -0
  61. package/resources/entity-types/index.d.ts +3 -0
  62. package/resources/entity-types/index.d.ts.map +1 -0
  63. package/resources/entity-types/index.js +9 -0
  64. package/resources/entity-types/index.js.map +1 -0
  65. package/resources/entity-types/index.mjs +4 -0
  66. package/resources/entity-types/index.mjs.map +1 -0
  67. package/resources/entity-types/reviewers.d.mts +136 -0
  68. package/resources/entity-types/reviewers.d.mts.map +1 -0
  69. package/resources/entity-types/reviewers.d.ts +136 -0
  70. package/resources/entity-types/reviewers.d.ts.map +1 -0
  71. package/resources/entity-types/reviewers.js +74 -0
  72. package/resources/entity-types/reviewers.js.map +1 -0
  73. package/resources/entity-types/reviewers.mjs +70 -0
  74. package/resources/entity-types/reviewers.mjs.map +1 -0
  75. package/resources/entity-types.d.mts +2 -0
  76. package/resources/entity-types.d.mts.map +1 -0
  77. package/resources/entity-types.d.ts +2 -0
  78. package/resources/entity-types.d.ts.map +1 -0
  79. package/resources/entity-types.js +6 -0
  80. package/resources/entity-types.js.map +1 -0
  81. package/resources/entity-types.mjs +3 -0
  82. package/resources/entity-types.mjs.map +1 -0
  83. package/resources/eval/eval.d.mts +4 -0
  84. package/resources/eval/eval.d.mts.map +1 -1
  85. package/resources/eval/eval.d.ts +4 -0
  86. package/resources/eval/eval.d.ts.map +1 -1
  87. package/resources/eval/eval.js +4 -0
  88. package/resources/eval/eval.js.map +1 -1
  89. package/resources/eval/eval.mjs +4 -0
  90. package/resources/eval/eval.mjs.map +1 -1
  91. package/resources/eval/index.d.mts +1 -0
  92. package/resources/eval/index.d.mts.map +1 -1
  93. package/resources/eval/index.d.ts +1 -0
  94. package/resources/eval/index.d.ts.map +1 -1
  95. package/resources/eval/index.js +3 -1
  96. package/resources/eval/index.js.map +1 -1
  97. package/resources/eval/index.mjs +1 -0
  98. package/resources/eval/index.mjs.map +1 -1
  99. package/resources/eval/score.d.mts +486 -0
  100. package/resources/eval/score.d.mts.map +1 -0
  101. package/resources/eval/score.d.ts +486 -0
  102. package/resources/eval/score.d.ts.map +1 -0
  103. package/resources/eval/score.js +126 -0
  104. package/resources/eval/score.js.map +1 -0
  105. package/resources/eval/score.mjs +122 -0
  106. package/resources/eval/score.mjs.map +1 -0
  107. package/resources/fs.d.mts +28 -0
  108. package/resources/fs.d.mts.map +1 -1
  109. package/resources/fs.d.ts +28 -0
  110. package/resources/fs.d.ts.map +1 -1
  111. package/resources/index.d.mts +6 -0
  112. package/resources/index.d.mts.map +1 -1
  113. package/resources/index.d.ts +6 -0
  114. package/resources/index.d.ts.map +1 -1
  115. package/resources/index.js +13 -1
  116. package/resources/index.js.map +1 -1
  117. package/resources/index.mjs +6 -0
  118. package/resources/index.mjs.map +1 -1
  119. package/resources/knowledge-graph.d.mts +125 -0
  120. package/resources/knowledge-graph.d.mts.map +1 -0
  121. package/resources/knowledge-graph.d.ts +125 -0
  122. package/resources/knowledge-graph.d.ts.map +1 -0
  123. package/resources/knowledge-graph.js +34 -0
  124. package/resources/knowledge-graph.js.map +1 -0
  125. package/resources/knowledge-graph.mjs +30 -0
  126. package/resources/knowledge-graph.mjs.map +1 -0
  127. package/resources/review-queue.d.mts +192 -0
  128. package/resources/review-queue.d.mts.map +1 -0
  129. package/resources/review-queue.d.ts +192 -0
  130. package/resources/review-queue.d.ts.map +1 -0
  131. package/resources/review-queue.js +49 -0
  132. package/resources/review-queue.js.map +1 -0
  133. package/resources/review-queue.mjs +45 -0
  134. package/resources/review-queue.mjs.map +1 -0
  135. package/resources/subscriptions.d.mts +14 -2
  136. package/resources/subscriptions.d.mts.map +1 -1
  137. package/resources/subscriptions.d.ts +14 -2
  138. package/resources/subscriptions.d.ts.map +1 -1
  139. package/resources/subscriptions.js +14 -2
  140. package/resources/subscriptions.js.map +1 -1
  141. package/resources/subscriptions.mjs +14 -2
  142. package/resources/subscriptions.mjs.map +1 -1
  143. package/resources/users.d.mts +62 -0
  144. package/resources/users.d.mts.map +1 -0
  145. package/resources/users.d.ts +62 -0
  146. package/resources/users.d.ts.map +1 -0
  147. package/resources/users.js +35 -0
  148. package/resources/users.js.map +1 -0
  149. package/resources/users.mjs +31 -0
  150. package/resources/users.mjs.map +1 -0
  151. package/src/client.ts +220 -3
  152. package/src/resources/buckets.ts +351 -0
  153. package/src/resources/entities/entities.ts +639 -0
  154. package/src/resources/entities/index.ts +20 -0
  155. package/src/resources/entities/synonyms.ts +140 -0
  156. package/src/resources/entities.ts +3 -0
  157. package/src/resources/entity-types/entity-types.ts +396 -0
  158. package/src/resources/entity-types/index.ts +19 -0
  159. package/src/resources/entity-types/reviewers.ts +175 -0
  160. package/src/resources/entity-types.ts +3 -0
  161. package/src/resources/eval/eval.ts +18 -0
  162. package/src/resources/eval/index.ts +7 -0
  163. package/src/resources/eval/score.ts +590 -0
  164. package/src/resources/fs.ts +30 -0
  165. package/src/resources/index.ts +40 -0
  166. package/src/resources/knowledge-graph.ts +153 -0
  167. package/src/resources/review-queue.ts +234 -0
  168. package/src/resources/subscriptions.ts +14 -2
  169. package/src/resources/users.ts +76 -0
  170. package/src/version.ts +1 -1
  171. package/version.d.mts +1 -1
  172. package/version.d.ts +1 -1
  173. package/version.js +1 -1
  174. package/version.mjs +1 -1
@@ -0,0 +1,590 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as OutputsAPI from '../outputs';
5
+ import { APIPromise } from '../../core/api-promise';
6
+ import { RequestOptions } from '../../internal/request-options';
7
+ import { path } from '../../internal/utils/path';
8
+
9
+ /**
10
+ * Monitor, evaluate, and iterate on the quality of every function in your
11
+ * environment. Function Accuracy bundles two complementary loops:
12
+ *
13
+ * ## Evaluations (`/v3/eval`)
14
+ *
15
+ * Trigger and retrieve per-transformation evaluations. Evaluations run
16
+ * asynchronously and score each transformation's output against the
17
+ * function's schema for confidence, per-field hallucination detection,
18
+ * and relevance. Supported for `extract`, `transform`, `analyze`, and
19
+ * `join` events.
20
+ *
21
+ * 1. **Trigger** — `POST /v3/eval` queues jobs for a batch of transformation IDs.
22
+ * 2. **Poll** — `GET /v3/eval/results` returns the current state of each
23
+ * requested ID, partitioned into `results`, `pending`, and `failed`.
24
+ * Accepts either `eventIDs` (preferred) or `transformationIDs` as a
25
+ * comma-separated query parameter, and always keys the response by
26
+ * event KSUID.
27
+ *
28
+ * Up to 100 IDs may be submitted per request.
29
+ *
30
+ * ## Metrics, review, regression (`/v3/functions/{metrics,review,regression,compare}`)
31
+ *
32
+ * Roll evaluation results and user corrections up into actionable
33
+ * function-level signal:
34
+ *
35
+ * - **`GET /v3/functions/metrics`** — aggregate accuracy, precision,
36
+ * recall, F1, and confusion-matrix counts per function.
37
+ * - **`POST /v3/functions/review`** — sample-size estimation,
38
+ * confidence-bucketed distribution, PR-AUC, and per-threshold
39
+ * confidence intervals (Wald or Wilson) for picking review cutoffs.
40
+ * - **`POST /v3/functions/regression`** — replay corrected historical
41
+ * inputs against a new function version, producing a labeled
42
+ * regression dataset.
43
+ * - **`POST /v3/functions/regression/corrections`** — propagate
44
+ * baseline corrections onto the regression dataset so it can be
45
+ * scored.
46
+ * - **`POST /v3/functions/compare`** — compute aggregate and
47
+ * field-level lift between any two versions, optionally scoped to
48
+ * the regression dataset.
49
+ *
50
+ * All five endpoints support `extract` end-to-end on both the vision
51
+ * and OCR paths, alongside the legacy `transform` / `analyze` / `join`
52
+ * types.
53
+ */
54
+ export class Score extends APIResource {
55
+ /**
56
+ * **Score a function against a list of (input, expected) pairs.**
57
+ *
58
+ * Submits a batch of `(input, expected)` pairs, runs the named function over each
59
+ * input, and returns per-pair + aggregate accuracy metrics comparing the
60
+ * function's actual output to the provided expected JSON.
61
+ *
62
+ * Scoring runs asynchronously. The response carries a `scoreRunID`; poll
63
+ * `GET /v3/eval/score/{scoreRunID}` until `status` is one of `completed`, `error`,
64
+ * or `cancelled`.
65
+ *
66
+ * `matchConfig` controls comparator behavior:
67
+ *
68
+ * - `numericTolerance`: relative tolerance for numeric fields (0 = exact)
69
+ * - `stringMatch`: `exact` (default) or `fuzzy` (Levenshtein ratio)
70
+ * - `arrayMatch`: `by-index` (default; only mode in P0)
71
+ * - `ignorePaths`: JSON Pointer paths to skip, supports `*` wildcards
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * const score = await client.eval.score.create({
76
+ * functionName: 'functionName',
77
+ * pairs: [
78
+ * {
79
+ * expected: {},
80
+ * input: {
81
+ * inputContent: 'inputContent',
82
+ * inputType: 'csv',
83
+ * },
84
+ * },
85
+ * ],
86
+ * });
87
+ * ```
88
+ */
89
+ create(body: ScoreCreateParams, options?: RequestOptions): APIPromise<ScoreCreateResponse> {
90
+ return this._client.post('/v3/eval/score', { body, ...options });
91
+ }
92
+
93
+ /**
94
+ * **Get the status and per-pair results of a score run.**
95
+ *
96
+ * Returns `aggregate` only once `status` reaches `completed`. `perPair` is
97
+ * populated incrementally — each pair's `fieldResults` appears as its underlying
98
+ * function call terminates.
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * const score = await client.eval.score.retrieve(
103
+ * 'scoreRunID',
104
+ * );
105
+ * ```
106
+ */
107
+ retrieve(scoreRunID: string, options?: RequestOptions): APIPromise<ScoreRetrieveResponse> {
108
+ return this._client.get(path`/v3/eval/score/${scoreRunID}`, options);
109
+ }
110
+
111
+ /**
112
+ * **Cancel an in-flight score run.**
113
+ *
114
+ * Transitions the run to `cancelled`. Function calls already in flight are allowed
115
+ * to finish (best-effort cancellation via the job queue); results from completed
116
+ * pairs may still appear in subsequent GETs.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * const response = await client.eval.score.cancel(
121
+ * 'scoreRunID',
122
+ * );
123
+ * ```
124
+ */
125
+ cancel(scoreRunID: string, options?: RequestOptions): APIPromise<ScoreCancelResponse> {
126
+ return this._client.post(path`/v3/eval/score/${scoreRunID}/cancel`, options);
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Returned by `POST /v3/eval/score`.
132
+ */
133
+ export interface ScoreCreateResponse {
134
+ /**
135
+ * Run identifier. Use with `GET /v3/eval/score/{scoreRunID}`.
136
+ */
137
+ scoreRunID: string;
138
+
139
+ /**
140
+ * Status values for an eval-score run.
141
+ */
142
+ status: 'pending' | 'initializing' | 'running' | 'completed' | 'error' | 'cancelled';
143
+ }
144
+
145
+ /**
146
+ * Full status payload returned by `GET /v3/eval/score/{scoreRunID}`.
147
+ */
148
+ export interface ScoreRetrieveResponse {
149
+ functionName: string;
150
+
151
+ functionVersionNum: number;
152
+
153
+ /**
154
+ * Comparator configuration. All fields optional; conservative defaults.
155
+ */
156
+ matchConfig: ScoreRetrieveResponse.MatchConfig;
157
+
158
+ /**
159
+ * Per-pair results. `fieldResults` appears once a pair has been compared.
160
+ */
161
+ perPair: Array<ScoreRetrieveResponse.PerPair>;
162
+
163
+ /**
164
+ * Counts across all pairs.
165
+ */
166
+ progress: ScoreRetrieveResponse.Progress;
167
+
168
+ scoreRunID: string;
169
+
170
+ /**
171
+ * Status values for an eval-score run.
172
+ */
173
+ status: 'pending' | 'initializing' | 'running' | 'completed' | 'error' | 'cancelled';
174
+
175
+ /**
176
+ * Aggregate accuracy metrics.
177
+ */
178
+ aggregate?: ScoreRetrieveResponse.Aggregate;
179
+ }
180
+
181
+ export namespace ScoreRetrieveResponse {
182
+ /**
183
+ * Comparator configuration. All fields optional; conservative defaults.
184
+ */
185
+ export interface MatchConfig {
186
+ /**
187
+ * P0 supports only `by-index`.
188
+ */
189
+ arrayMatch?: 'by-index';
190
+
191
+ /**
192
+ * Levenshtein-ratio threshold used when `stringMatch == "fuzzy"`. Range `[0, 1]`.
193
+ * Default `0.85`.
194
+ */
195
+ fuzzyThreshold?: number;
196
+
197
+ /**
198
+ * JSON Pointer paths to skip during comparison. The asterisk character matches
199
+ * arbitrary object keys / array indices.
200
+ *
201
+ * Example values: /metadata, /lineItems with asterisk segment, etc.
202
+ */
203
+ ignorePaths?: Array<string>;
204
+
205
+ /**
206
+ * Relative tolerance for numeric fields. `0` (default) means exact equality;
207
+ * `0.01` means ±1%.
208
+ */
209
+ numericTolerance?: number;
210
+
211
+ /**
212
+ * `exact` (default) or `fuzzy`.
213
+ */
214
+ stringMatch?: 'exact' | 'fuzzy';
215
+ }
216
+
217
+ /**
218
+ * Per-pair result.
219
+ */
220
+ export interface PerPair {
221
+ pairIndex: number;
222
+
223
+ /**
224
+ * Per-pair status.
225
+ */
226
+ status: 'pending' | 'running' | 'completed' | 'failed';
227
+
228
+ /**
229
+ * The function call that produced the actual output, if any.
230
+ */
231
+ callID?: string;
232
+
233
+ /**
234
+ * Error message if the underlying function call failed.
235
+ */
236
+ errorMessage?: string;
237
+
238
+ /**
239
+ * Per-leaf comparator output. Present only after the pair has been compared.
240
+ */
241
+ fieldResults?: Array<PerPair.FieldResult>;
242
+ }
243
+
244
+ export namespace PerPair {
245
+ /**
246
+ * One leaf in `expected ∪ actual`.
247
+ */
248
+ export interface FieldResult {
249
+ /**
250
+ * Classification:
251
+ *
252
+ * - `exact`: both present and deep-equal
253
+ * - `within_tolerance`: both numbers, within configured tolerance
254
+ * - `fuzzy_match`: both strings, Levenshtein ratio above threshold
255
+ * - `miss`: expected present, actual absent or different
256
+ * - `extra`: actual present, expected absent
257
+ */
258
+ match: 'exact' | 'within_tolerance' | 'fuzzy_match' | 'miss' | 'extra';
259
+
260
+ /**
261
+ * JSON Pointer to the leaf.
262
+ */
263
+ path: string;
264
+
265
+ actual?: unknown;
266
+
267
+ /**
268
+ * Populated for numeric comparisons; `actual - expected`.
269
+ */
270
+ delta?: number;
271
+
272
+ expected?: unknown;
273
+ }
274
+ }
275
+
276
+ /**
277
+ * Counts across all pairs.
278
+ */
279
+ export interface Progress {
280
+ completed: number;
281
+
282
+ failed: number;
283
+
284
+ total: number;
285
+ }
286
+
287
+ /**
288
+ * Aggregate accuracy metrics.
289
+ */
290
+ export interface Aggregate {
291
+ exactMatches: number;
292
+
293
+ extras: number;
294
+
295
+ f1: number;
296
+
297
+ fuzzyMatches: number;
298
+
299
+ misses: number;
300
+
301
+ precision: number;
302
+
303
+ recall: number;
304
+
305
+ totalFieldsActual: number;
306
+
307
+ totalFieldsExpected: number;
308
+
309
+ withinTolerance: number;
310
+ }
311
+ }
312
+
313
+ /**
314
+ * Full status payload returned by `GET /v3/eval/score/{scoreRunID}`.
315
+ */
316
+ export interface ScoreCancelResponse {
317
+ functionName: string;
318
+
319
+ functionVersionNum: number;
320
+
321
+ /**
322
+ * Comparator configuration. All fields optional; conservative defaults.
323
+ */
324
+ matchConfig: ScoreCancelResponse.MatchConfig;
325
+
326
+ /**
327
+ * Per-pair results. `fieldResults` appears once a pair has been compared.
328
+ */
329
+ perPair: Array<ScoreCancelResponse.PerPair>;
330
+
331
+ /**
332
+ * Counts across all pairs.
333
+ */
334
+ progress: ScoreCancelResponse.Progress;
335
+
336
+ scoreRunID: string;
337
+
338
+ /**
339
+ * Status values for an eval-score run.
340
+ */
341
+ status: 'pending' | 'initializing' | 'running' | 'completed' | 'error' | 'cancelled';
342
+
343
+ /**
344
+ * Aggregate accuracy metrics.
345
+ */
346
+ aggregate?: ScoreCancelResponse.Aggregate;
347
+ }
348
+
349
+ export namespace ScoreCancelResponse {
350
+ /**
351
+ * Comparator configuration. All fields optional; conservative defaults.
352
+ */
353
+ export interface MatchConfig {
354
+ /**
355
+ * P0 supports only `by-index`.
356
+ */
357
+ arrayMatch?: 'by-index';
358
+
359
+ /**
360
+ * Levenshtein-ratio threshold used when `stringMatch == "fuzzy"`. Range `[0, 1]`.
361
+ * Default `0.85`.
362
+ */
363
+ fuzzyThreshold?: number;
364
+
365
+ /**
366
+ * JSON Pointer paths to skip during comparison. The asterisk character matches
367
+ * arbitrary object keys / array indices.
368
+ *
369
+ * Example values: /metadata, /lineItems with asterisk segment, etc.
370
+ */
371
+ ignorePaths?: Array<string>;
372
+
373
+ /**
374
+ * Relative tolerance for numeric fields. `0` (default) means exact equality;
375
+ * `0.01` means ±1%.
376
+ */
377
+ numericTolerance?: number;
378
+
379
+ /**
380
+ * `exact` (default) or `fuzzy`.
381
+ */
382
+ stringMatch?: 'exact' | 'fuzzy';
383
+ }
384
+
385
+ /**
386
+ * Per-pair result.
387
+ */
388
+ export interface PerPair {
389
+ pairIndex: number;
390
+
391
+ /**
392
+ * Per-pair status.
393
+ */
394
+ status: 'pending' | 'running' | 'completed' | 'failed';
395
+
396
+ /**
397
+ * The function call that produced the actual output, if any.
398
+ */
399
+ callID?: string;
400
+
401
+ /**
402
+ * Error message if the underlying function call failed.
403
+ */
404
+ errorMessage?: string;
405
+
406
+ /**
407
+ * Per-leaf comparator output. Present only after the pair has been compared.
408
+ */
409
+ fieldResults?: Array<PerPair.FieldResult>;
410
+ }
411
+
412
+ export namespace PerPair {
413
+ /**
414
+ * One leaf in `expected ∪ actual`.
415
+ */
416
+ export interface FieldResult {
417
+ /**
418
+ * Classification:
419
+ *
420
+ * - `exact`: both present and deep-equal
421
+ * - `within_tolerance`: both numbers, within configured tolerance
422
+ * - `fuzzy_match`: both strings, Levenshtein ratio above threshold
423
+ * - `miss`: expected present, actual absent or different
424
+ * - `extra`: actual present, expected absent
425
+ */
426
+ match: 'exact' | 'within_tolerance' | 'fuzzy_match' | 'miss' | 'extra';
427
+
428
+ /**
429
+ * JSON Pointer to the leaf.
430
+ */
431
+ path: string;
432
+
433
+ actual?: unknown;
434
+
435
+ /**
436
+ * Populated for numeric comparisons; `actual - expected`.
437
+ */
438
+ delta?: number;
439
+
440
+ expected?: unknown;
441
+ }
442
+ }
443
+
444
+ /**
445
+ * Counts across all pairs.
446
+ */
447
+ export interface Progress {
448
+ completed: number;
449
+
450
+ failed: number;
451
+
452
+ total: number;
453
+ }
454
+
455
+ /**
456
+ * Aggregate accuracy metrics.
457
+ */
458
+ export interface Aggregate {
459
+ exactMatches: number;
460
+
461
+ extras: number;
462
+
463
+ f1: number;
464
+
465
+ fuzzyMatches: number;
466
+
467
+ misses: number;
468
+
469
+ precision: number;
470
+
471
+ recall: number;
472
+
473
+ totalFieldsActual: number;
474
+
475
+ totalFieldsExpected: number;
476
+
477
+ withinTolerance: number;
478
+ }
479
+ }
480
+
481
+ export interface ScoreCreateParams {
482
+ /**
483
+ * Name of the function to score. Must be of type extract, transform, or analyze.
484
+ */
485
+ functionName: string;
486
+
487
+ /**
488
+ * Up to 1000 pairs per request.
489
+ */
490
+ pairs: Array<ScoreCreateParams.Pair>;
491
+
492
+ /**
493
+ * Optional version number to score against. P0: only the function's current
494
+ * version is accepted; passing a different version returns 422.
495
+ */
496
+ functionVersionNum?: number;
497
+
498
+ /**
499
+ * Comparator configuration. All fields optional; conservative defaults.
500
+ */
501
+ matchConfig?: ScoreCreateParams.MatchConfig;
502
+ }
503
+
504
+ export namespace ScoreCreateParams {
505
+ /**
506
+ * One `(input, expected)` pair.
507
+ */
508
+ export interface Pair {
509
+ /**
510
+ * Expected output for this input, as a JSON value. The comparator walks
511
+ * `expected ∪ actual` and produces a per-leaf classification.
512
+ */
513
+ expected: unknown;
514
+
515
+ /**
516
+ * A single file input with base64-encoded content.
517
+ *
518
+ * When using the Bem CLI, use `@path/to/file` in the `inputContent` field to
519
+ * automatically read and base64-encode the file:
520
+ * `--input.single-file '{"inputContent": "@file.pdf", "inputType": "pdf"}' --wait`
521
+ */
522
+ input: Pair.Input;
523
+ }
524
+
525
+ export namespace Pair {
526
+ /**
527
+ * A single file input with base64-encoded content.
528
+ *
529
+ * When using the Bem CLI, use `@path/to/file` in the `inputContent` field to
530
+ * automatically read and base64-encode the file:
531
+ * `--input.single-file '{"inputContent": "@file.pdf", "inputType": "pdf"}' --wait`
532
+ */
533
+ export interface Input {
534
+ /**
535
+ * Base64-encoded file content. In the Bem CLI, use `@path/to/file` to embed file
536
+ * contents automatically.
537
+ */
538
+ inputContent: string;
539
+
540
+ /**
541
+ * The input type of the content you're sending for transformation.
542
+ */
543
+ inputType: OutputsAPI.InputType;
544
+ }
545
+ }
546
+
547
+ /**
548
+ * Comparator configuration. All fields optional; conservative defaults.
549
+ */
550
+ export interface MatchConfig {
551
+ /**
552
+ * P0 supports only `by-index`.
553
+ */
554
+ arrayMatch?: 'by-index';
555
+
556
+ /**
557
+ * Levenshtein-ratio threshold used when `stringMatch == "fuzzy"`. Range `[0, 1]`.
558
+ * Default `0.85`.
559
+ */
560
+ fuzzyThreshold?: number;
561
+
562
+ /**
563
+ * JSON Pointer paths to skip during comparison. The asterisk character matches
564
+ * arbitrary object keys / array indices.
565
+ *
566
+ * Example values: /metadata, /lineItems with asterisk segment, etc.
567
+ */
568
+ ignorePaths?: Array<string>;
569
+
570
+ /**
571
+ * Relative tolerance for numeric fields. `0` (default) means exact equality;
572
+ * `0.01` means ±1%.
573
+ */
574
+ numericTolerance?: number;
575
+
576
+ /**
577
+ * `exact` (default) or `fuzzy`.
578
+ */
579
+ stringMatch?: 'exact' | 'fuzzy';
580
+ }
581
+ }
582
+
583
+ export declare namespace Score {
584
+ export {
585
+ type ScoreCreateResponse as ScoreCreateResponse,
586
+ type ScoreRetrieveResponse as ScoreRetrieveResponse,
587
+ type ScoreCancelResponse as ScoreCancelResponse,
588
+ type ScoreCreateParams as ScoreCreateParams,
589
+ };
590
+ }
@@ -226,6 +226,13 @@ export interface FNavigateParams {
226
226
  */
227
227
  op: FsOp;
228
228
 
229
+ /**
230
+ * Request-scoping concerns that are orthogonal to the op itself. Carried on a
231
+ * `context` object so future scoping hints (e.g. as-of timestamps, read
232
+ * consistency) can slot in without reshaping the op-specific fields.
233
+ */
234
+ context?: FNavigateParams.Context;
235
+
229
236
  /**
230
237
  * When true, return only the hit count without snippet payload. Cheaper than
231
238
  * fetching matches when the agent only wants a yes/no.
@@ -296,6 +303,29 @@ export interface FNavigateParams {
296
303
  }
297
304
 
298
305
  export namespace FNavigateParams {
306
+ /**
307
+ * Request-scoping concerns that are orthogonal to the op itself. Carried on a
308
+ * `context` object so future scoping hints (e.g. as-of timestamps, read
309
+ * consistency) can slot in without reshaping the op-specific fields.
310
+ */
311
+ export interface Context {
312
+ /**
313
+ * Bucket KSUID (prefix `bkt_`) to scope the request to — a named partition of the
314
+ * knowledge graph within the caller's account+environment.
315
+ *
316
+ * **Optional.** Omitting it (or passing an empty value) leaves the request
317
+ * UNSCOPED: memory-level reads (`find` / `open` / `xref`) return entities across
318
+ * every bucket in the account+environment, so pre-bucket callers keep their
319
+ * original all-entities behavior unchanged. (Writes are different: a parse call
320
+ * with no bucket targets the account default bucket.) When a bucket IS supplied,
321
+ * memory-level ops return only entities in that bucket; doc-level ops
322
+ * (`ls`/`cat`/`head`/`stat`/`grep`) are unaffected either way — documents are not
323
+ * bucket-partitioned. A bucket that does not belong to the caller's
324
+ * account+environment is rejected.
325
+ */
326
+ bucket?: string;
327
+ }
328
+
299
329
  /**
300
330
  * Filter options for `op=ls` and `op=find`.
301
331
  */
@@ -1,5 +1,16 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ export {
4
+ Buckets,
5
+ type BucketCreateResponse,
6
+ type BucketRetrieveResponse,
7
+ type BucketUpdateResponse,
8
+ type BucketListResponse,
9
+ type BucketCreateParams,
10
+ type BucketUpdateParams,
11
+ type BucketListParams,
12
+ type BucketDeleteParams,
13
+ } from './buckets';
3
14
  export {
4
15
  Calls,
5
16
  type Call,
@@ -28,6 +39,28 @@ export {
28
39
  type ConnectorCreateParams,
29
40
  type ConnectorListParams,
30
41
  } from './connectors';
42
+ export {
43
+ Entities,
44
+ type EntityUpdateResponse,
45
+ type EntityBulkCreateResponse,
46
+ type EntityBulkValidateResponse,
47
+ type EntityRetrieveRelationsResponse,
48
+ type EntityRetrieveSeedStatusResponse,
49
+ type EntityUpdateParams,
50
+ type EntityBulkCreateParams,
51
+ type EntityBulkValidateParams,
52
+ type EntityRetrieveRelationsParams,
53
+ } from './entities/entities';
54
+ export {
55
+ EntityTypes,
56
+ type EntityTypeCreateResponse,
57
+ type EntityTypeRetrieveResponse,
58
+ type EntityTypeUpdateResponse,
59
+ type EntityTypeListResponse,
60
+ type EntityTypeCreateParams,
61
+ type EntityTypeUpdateParams,
62
+ type EntityTypeListParams,
63
+ } from './entity-types/entity-types';
31
64
  export {
32
65
  Errors,
33
66
  type ErrorEvent,
@@ -68,6 +101,11 @@ export {
68
101
  type FunctionsFunctionsPage,
69
102
  } from './functions/functions';
70
103
  export { InferSchema, type InferSchemaCreateResponse, type InferSchemaCreateParams } from './infer-schema';
104
+ export {
105
+ KnowledgeGraph,
106
+ type KnowledgeGraphRetrieveResponse,
107
+ type KnowledgeGraphRetrieveParams,
108
+ } from './knowledge-graph';
71
109
  export {
72
110
  Outputs,
73
111
  type AnyType,
@@ -77,6 +115,7 @@ export {
77
115
  type OutputListParams,
78
116
  type EventsOutputsPage,
79
117
  } from './outputs';
118
+ export { ReviewQueue, type ReviewQueueListResponse, type ReviewQueueListParams } from './review-queue';
80
119
  export {
81
120
  Subscriptions,
82
121
  type SubscriptionV3,
@@ -85,6 +124,7 @@ export {
85
124
  type SubscriptionUpdateParams,
86
125
  type SubscriptionListParams,
87
126
  } from './subscriptions';
127
+ export { Users, type UserListReviewerAssignmentsResponse } from './users';
88
128
  export {
89
129
  Views,
90
130
  type ViewCreateResponse,