bem-ai-sdk 0.28.0 → 0.29.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 (126) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +10 -10
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +10 -10
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/buckets.d.mts +9 -113
  10. package/resources/buckets.d.mts.map +1 -1
  11. package/resources/buckets.d.ts +9 -113
  12. package/resources/buckets.d.ts.map +1 -1
  13. package/resources/buckets.js +3 -3
  14. package/resources/buckets.js.map +1 -1
  15. package/resources/buckets.mjs +3 -3
  16. package/resources/buckets.mjs.map +1 -1
  17. package/resources/entities/entities.d.mts +52 -103
  18. package/resources/entities/entities.d.mts.map +1 -1
  19. package/resources/entities/entities.d.ts +52 -103
  20. package/resources/entities/entities.d.ts.map +1 -1
  21. package/resources/entities/entities.js.map +1 -1
  22. package/resources/entities/entities.mjs.map +1 -1
  23. package/resources/entities/index.d.mts +1 -1
  24. package/resources/entities/index.d.mts.map +1 -1
  25. package/resources/entities/index.d.ts +1 -1
  26. package/resources/entities/index.d.ts.map +1 -1
  27. package/resources/entities/index.js.map +1 -1
  28. package/resources/entities/index.mjs.map +1 -1
  29. package/resources/entity-types/entity-types.d.mts +8 -124
  30. package/resources/entity-types/entity-types.d.mts.map +1 -1
  31. package/resources/entity-types/entity-types.d.ts +8 -124
  32. package/resources/entity-types/entity-types.d.ts.map +1 -1
  33. package/resources/entity-types/entity-types.js.map +1 -1
  34. package/resources/entity-types/entity-types.mjs.map +1 -1
  35. package/resources/entity-types/index.d.mts +2 -2
  36. package/resources/entity-types/index.d.mts.map +1 -1
  37. package/resources/entity-types/index.d.ts +2 -2
  38. package/resources/entity-types/index.d.ts.map +1 -1
  39. package/resources/entity-types/index.js.map +1 -1
  40. package/resources/entity-types/index.mjs.map +1 -1
  41. package/resources/entity-types/reviewers.d.mts +10 -39
  42. package/resources/entity-types/reviewers.d.mts.map +1 -1
  43. package/resources/entity-types/reviewers.d.ts +10 -39
  44. package/resources/entity-types/reviewers.d.ts.map +1 -1
  45. package/resources/entity-types/reviewers.js +1 -1
  46. package/resources/entity-types/reviewers.js.map +1 -1
  47. package/resources/entity-types/reviewers.mjs +1 -1
  48. package/resources/entity-types/reviewers.mjs.map +1 -1
  49. package/resources/eval/eval.d.mts +2 -2
  50. package/resources/eval/eval.d.mts.map +1 -1
  51. package/resources/eval/eval.d.ts +2 -2
  52. package/resources/eval/eval.d.ts.map +1 -1
  53. package/resources/eval/eval.js.map +1 -1
  54. package/resources/eval/eval.mjs.map +1 -1
  55. package/resources/eval/index.d.mts +1 -1
  56. package/resources/eval/index.d.mts.map +1 -1
  57. package/resources/eval/index.d.ts +1 -1
  58. package/resources/eval/index.d.ts.map +1 -1
  59. package/resources/eval/index.js.map +1 -1
  60. package/resources/eval/index.mjs.map +1 -1
  61. package/resources/eval/score.d.mts +60 -219
  62. package/resources/eval/score.d.mts.map +1 -1
  63. package/resources/eval/score.d.ts +60 -219
  64. package/resources/eval/score.d.ts.map +1 -1
  65. package/resources/eval/score.js +2 -2
  66. package/resources/eval/score.js.map +1 -1
  67. package/resources/eval/score.mjs +2 -2
  68. package/resources/eval/score.mjs.map +1 -1
  69. package/resources/functions/functions.d.mts +364 -1095
  70. package/resources/functions/functions.d.mts.map +1 -1
  71. package/resources/functions/functions.d.ts +364 -1095
  72. package/resources/functions/functions.d.ts.map +1 -1
  73. package/resources/functions/functions.js.map +1 -1
  74. package/resources/functions/functions.mjs.map +1 -1
  75. package/resources/functions/index.d.mts +1 -1
  76. package/resources/functions/index.d.mts.map +1 -1
  77. package/resources/functions/index.d.ts +1 -1
  78. package/resources/functions/index.d.ts.map +1 -1
  79. package/resources/functions/index.js.map +1 -1
  80. package/resources/functions/index.mjs.map +1 -1
  81. package/resources/functions/versions.d.mts +2 -108
  82. package/resources/functions/versions.d.mts.map +1 -1
  83. package/resources/functions/versions.d.ts +2 -108
  84. package/resources/functions/versions.d.ts.map +1 -1
  85. package/resources/index.d.mts +5 -5
  86. package/resources/index.d.mts.map +1 -1
  87. package/resources/index.d.ts +5 -5
  88. package/resources/index.d.ts.map +1 -1
  89. package/resources/index.js.map +1 -1
  90. package/resources/index.mjs.map +1 -1
  91. package/resources/outputs.d.mts +1 -1
  92. package/resources/outputs.d.mts.map +1 -1
  93. package/resources/outputs.d.ts +1 -1
  94. package/resources/outputs.d.ts.map +1 -1
  95. package/resources/views.d.mts +97 -745
  96. package/resources/views.d.mts.map +1 -1
  97. package/resources/views.d.ts +97 -745
  98. package/resources/views.d.ts.map +1 -1
  99. package/resources/workflows/workflows.d.mts +2 -19
  100. package/resources/workflows/workflows.d.mts.map +1 -1
  101. package/resources/workflows/workflows.d.ts +2 -19
  102. package/resources/workflows/workflows.d.ts.map +1 -1
  103. package/resources/workflows/workflows.js.map +1 -1
  104. package/resources/workflows/workflows.mjs.map +1 -1
  105. package/src/client.ts +38 -18
  106. package/src/resources/buckets.ts +9 -137
  107. package/src/resources/entities/entities.ts +61 -118
  108. package/src/resources/entities/index.ts +2 -0
  109. package/src/resources/entity-types/entity-types.ts +8 -151
  110. package/src/resources/entity-types/index.ts +2 -4
  111. package/src/resources/entity-types/reviewers.ts +11 -49
  112. package/src/resources/eval/eval.ts +8 -4
  113. package/src/resources/eval/index.ts +4 -2
  114. package/src/resources/eval/score.ts +66 -263
  115. package/src/resources/functions/functions.ts +411 -1249
  116. package/src/resources/functions/index.ts +8 -0
  117. package/src/resources/functions/versions.ts +2 -118
  118. package/src/resources/index.ts +19 -9
  119. package/src/resources/outputs.ts +1 -0
  120. package/src/resources/views.ts +118 -936
  121. package/src/resources/workflows/workflows.ts +2 -21
  122. package/src/version.ts +1 -1
  123. package/version.d.mts +1 -1
  124. package/version.d.ts +1 -1
  125. package/version.js +1 -1
  126. package/version.mjs +1 -1
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
+ import * as ScoreAPI from './score';
4
5
  import * as OutputsAPI from '../outputs';
5
6
  import { APIPromise } from '../../core/api-promise';
6
7
  import { RequestOptions } from '../../internal/request-options';
@@ -99,12 +100,12 @@ export class Score extends APIResource {
99
100
  *
100
101
  * @example
101
102
  * ```ts
102
- * const score = await client.eval.score.retrieve(
103
+ * const evalScoreRun = await client.eval.score.retrieve(
103
104
  * 'scoreRunID',
104
105
  * );
105
106
  * ```
106
107
  */
107
- retrieve(scoreRunID: string, options?: RequestOptions): APIPromise<ScoreRetrieveResponse> {
108
+ retrieve(scoreRunID: string, options?: RequestOptions): APIPromise<EvalScoreRun> {
108
109
  return this._client.get(path`/v3/eval/score/${scoreRunID}`, options);
109
110
  }
110
111
 
@@ -117,35 +118,55 @@ export class Score extends APIResource {
117
118
  *
118
119
  * @example
119
120
  * ```ts
120
- * const response = await client.eval.score.cancel(
121
+ * const evalScoreRun = await client.eval.score.cancel(
121
122
  * 'scoreRunID',
122
123
  * );
123
124
  * ```
124
125
  */
125
- cancel(scoreRunID: string, options?: RequestOptions): APIPromise<ScoreCancelResponse> {
126
+ cancel(scoreRunID: string, options?: RequestOptions): APIPromise<EvalScoreRun> {
126
127
  return this._client.post(path`/v3/eval/score/${scoreRunID}/cancel`, options);
127
128
  }
128
129
  }
129
130
 
130
131
  /**
131
- * Returned by `POST /v3/eval/score`.
132
+ * Comparator configuration. All fields optional; conservative defaults.
132
133
  */
133
- export interface ScoreCreateResponse {
134
+ export interface EvalMatchConfig {
134
135
  /**
135
- * Run identifier. Use with `GET /v3/eval/score/{scoreRunID}`.
136
+ * P0 supports only `by-index`.
136
137
  */
137
- scoreRunID: string;
138
+ arrayMatch?: 'by-index';
138
139
 
139
140
  /**
140
- * Status values for an eval-score run.
141
+ * Levenshtein-ratio threshold used when `stringMatch == "fuzzy"`. Range `[0, 1]`.
142
+ * Default `0.85`.
143
+ */
144
+ fuzzyThreshold?: number;
145
+
146
+ /**
147
+ * JSON Pointer paths to skip during comparison. The asterisk character matches
148
+ * arbitrary object keys / array indices.
149
+ *
150
+ * Example values: /metadata, /lineItems with asterisk segment, etc.
151
+ */
152
+ ignorePaths?: Array<string>;
153
+
154
+ /**
155
+ * Relative tolerance for numeric fields. `0` (default) means exact equality;
156
+ * `0.01` means ±1%.
157
+ */
158
+ numericTolerance?: number;
159
+
160
+ /**
161
+ * `exact` (default) or `fuzzy`.
141
162
  */
142
- status: 'pending' | 'initializing' | 'running' | 'completed' | 'error' | 'cancelled';
163
+ stringMatch?: 'exact' | 'fuzzy';
143
164
  }
144
165
 
145
166
  /**
146
167
  * Full status payload returned by `GET /v3/eval/score/{scoreRunID}`.
147
168
  */
148
- export interface ScoreRetrieveResponse {
169
+ export interface EvalScoreRun {
149
170
  functionName: string;
150
171
 
151
172
  functionVersionNum: number;
@@ -153,67 +174,32 @@ export interface ScoreRetrieveResponse {
153
174
  /**
154
175
  * Comparator configuration. All fields optional; conservative defaults.
155
176
  */
156
- matchConfig: ScoreRetrieveResponse.MatchConfig;
177
+ matchConfig: EvalMatchConfig;
157
178
 
158
179
  /**
159
180
  * Per-pair results. `fieldResults` appears once a pair has been compared.
160
181
  */
161
- perPair: Array<ScoreRetrieveResponse.PerPair>;
182
+ perPair: Array<EvalScoreRun.PerPair>;
162
183
 
163
184
  /**
164
185
  * Counts across all pairs.
165
186
  */
166
- progress: ScoreRetrieveResponse.Progress;
187
+ progress: EvalScoreRun.Progress;
167
188
 
168
189
  scoreRunID: string;
169
190
 
170
191
  /**
171
192
  * Status values for an eval-score run.
172
193
  */
173
- status: 'pending' | 'initializing' | 'running' | 'completed' | 'error' | 'cancelled';
194
+ status: EvalScoreRunStatus;
174
195
 
175
196
  /**
176
197
  * Aggregate accuracy metrics.
177
198
  */
178
- aggregate?: ScoreRetrieveResponse.Aggregate;
199
+ aggregate?: EvalScoreRun.Aggregate;
179
200
  }
180
201
 
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
-
202
+ export namespace EvalScoreRun {
217
203
  /**
218
204
  * Per-pair result.
219
205
  */
@@ -311,171 +297,43 @@ export namespace ScoreRetrieveResponse {
311
297
  }
312
298
 
313
299
  /**
314
- * Full status payload returned by `GET /v3/eval/score/{scoreRunID}`.
300
+ * Status values for an eval-score run.
315
301
  */
316
- export interface ScoreCancelResponse {
317
- functionName: string;
318
-
319
- functionVersionNum: number;
302
+ export type EvalScoreRunStatus = 'pending' | 'initializing' | 'running' | 'completed' | 'error' | 'cancelled';
320
303
 
304
+ /**
305
+ * A single file input with base64-encoded content.
306
+ *
307
+ * When using the Bem CLI, use `@path/to/file` in the `inputContent` field to
308
+ * automatically read and base64-encode the file:
309
+ * `--input.single-file '{"inputContent": "@file.pdf", "inputType": "pdf"}' --wait`
310
+ */
311
+ export interface FileInput {
321
312
  /**
322
- * Comparator configuration. All fields optional; conservative defaults.
313
+ * Base64-encoded file content. In the Bem CLI, use `@path/to/file` to embed file
314
+ * contents automatically.
323
315
  */
324
- matchConfig: ScoreCancelResponse.MatchConfig;
316
+ inputContent: string;
325
317
 
326
318
  /**
327
- * Per-pair results. `fieldResults` appears once a pair has been compared.
319
+ * The input type of the content you're sending for transformation.
328
320
  */
329
- perPair: Array<ScoreCancelResponse.PerPair>;
321
+ inputType: OutputsAPI.InputType;
322
+ }
330
323
 
324
+ /**
325
+ * Returned by `POST /v3/eval/score`.
326
+ */
327
+ export interface ScoreCreateResponse {
331
328
  /**
332
- * Counts across all pairs.
329
+ * Run identifier. Use with `GET /v3/eval/score/{scoreRunID}`.
333
330
  */
334
- progress: ScoreCancelResponse.Progress;
335
-
336
331
  scoreRunID: string;
337
332
 
338
333
  /**
339
334
  * Status values for an eval-score run.
340
335
  */
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
- }
336
+ status: EvalScoreRunStatus;
479
337
  }
480
338
 
481
339
  export interface ScoreCreateParams {
@@ -498,7 +356,7 @@ export interface ScoreCreateParams {
498
356
  /**
499
357
  * Comparator configuration. All fields optional; conservative defaults.
500
358
  */
501
- matchConfig?: ScoreCreateParams.MatchConfig;
359
+ matchConfig?: EvalMatchConfig;
502
360
  }
503
361
 
504
362
  export namespace ScoreCreateParams {
@@ -519,72 +377,17 @@ export namespace ScoreCreateParams {
519
377
  * automatically read and base64-encode the file:
520
378
  * `--input.single-file '{"inputContent": "@file.pdf", "inputType": "pdf"}' --wait`
521
379
  */
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';
380
+ input: ScoreAPI.FileInput;
580
381
  }
581
382
  }
582
383
 
583
384
  export declare namespace Score {
584
385
  export {
386
+ type EvalMatchConfig as EvalMatchConfig,
387
+ type EvalScoreRun as EvalScoreRun,
388
+ type EvalScoreRunStatus as EvalScoreRunStatus,
389
+ type FileInput as FileInput,
585
390
  type ScoreCreateResponse as ScoreCreateResponse,
586
- type ScoreRetrieveResponse as ScoreRetrieveResponse,
587
- type ScoreCancelResponse as ScoreCancelResponse,
588
391
  type ScoreCreateParams as ScoreCreateParams,
589
392
  };
590
393
  }