@roarkanalytics/sdk 3.6.0 → 3.7.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 (67) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/client.d.mts +7 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +7 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/call.d.mts +199 -1
  12. package/resources/call.d.mts.map +1 -1
  13. package/resources/call.d.ts +199 -1
  14. package/resources/call.d.ts.map +1 -1
  15. package/resources/call.js +30 -0
  16. package/resources/call.js.map +1 -1
  17. package/resources/call.mjs +30 -0
  18. package/resources/call.mjs.map +1 -1
  19. package/resources/config.d.mts +1 -1
  20. package/resources/config.d.mts.map +1 -1
  21. package/resources/config.d.ts +1 -1
  22. package/resources/config.d.ts.map +1 -1
  23. package/resources/customer-flow.d.mts +17 -2
  24. package/resources/customer-flow.d.mts.map +1 -1
  25. package/resources/customer-flow.d.ts +17 -2
  26. package/resources/customer-flow.d.ts.map +1 -1
  27. package/resources/index.d.mts +3 -2
  28. package/resources/index.d.mts.map +1 -1
  29. package/resources/index.d.ts +3 -2
  30. package/resources/index.d.ts.map +1 -1
  31. package/resources/index.js +3 -1
  32. package/resources/index.js.map +1 -1
  33. package/resources/index.mjs +1 -0
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/metric-variant.d.mts +357 -0
  36. package/resources/metric-variant.d.mts.map +1 -0
  37. package/resources/metric-variant.d.ts +357 -0
  38. package/resources/metric-variant.d.ts.map +1 -0
  39. package/resources/metric-variant.js +112 -0
  40. package/resources/metric-variant.js.map +1 -0
  41. package/resources/metric-variant.mjs +108 -0
  42. package/resources/metric-variant.mjs.map +1 -0
  43. package/resources/metric.d.mts +554 -1
  44. package/resources/metric.d.mts.map +1 -1
  45. package/resources/metric.d.ts +554 -1
  46. package/resources/metric.d.ts.map +1 -1
  47. package/resources/metric.js +22 -0
  48. package/resources/metric.js.map +1 -1
  49. package/resources/metric.mjs +22 -0
  50. package/resources/metric.mjs.map +1 -1
  51. package/resources/simulation-job.d.mts +90 -0
  52. package/resources/simulation-job.d.mts.map +1 -1
  53. package/resources/simulation-job.d.ts +90 -0
  54. package/resources/simulation-job.d.ts.map +1 -1
  55. package/src/client.ts +35 -0
  56. package/src/resources/call.ts +236 -0
  57. package/src/resources/config.ts +1 -0
  58. package/src/resources/customer-flow.ts +24 -2
  59. package/src/resources/index.ts +16 -0
  60. package/src/resources/metric-variant.ts +458 -0
  61. package/src/resources/metric.ts +864 -144
  62. package/src/resources/simulation-job.ts +104 -0
  63. package/src/version.ts +1 -1
  64. package/version.d.mts +1 -1
  65. package/version.d.ts +1 -1
  66. package/version.js +1 -1
  67. package/version.mjs +1 -1
@@ -0,0 +1,458 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+ import { path } from '../internal/utils/path';
7
+
8
+ export class MetricVariant extends APIResource {
9
+ /**
10
+ * Add a configuration of this metric for your organization, seeded from its
11
+ * Default. Edit it with PUT to change what it measures, then pin it where you want
12
+ * it used.
13
+ *
14
+ * Threshold metrics have no variants: their configuration comes from the metric
15
+ * they derive from. Metrics in a package that manages its own variants reject this
16
+ * too.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const metricVariant = await client.metricVariant.create(
21
+ * 'idOrSlug',
22
+ * { name: 'Strict' },
23
+ * );
24
+ * ```
25
+ */
26
+ create(
27
+ idOrSlug: string,
28
+ body: MetricVariantCreateParams,
29
+ options?: RequestOptions,
30
+ ): APIPromise<MetricVariantCreateResponse> {
31
+ return this._client.post(path`/v1/metric/definitions/${idOrSlug}/variants`, { body, ...options });
32
+ }
33
+
34
+ /**
35
+ * Rename a variant, change its configuration, or both. Every configuration change
36
+ * creates a new immutable version and advances `versionId`; the response carries
37
+ * the advanced value.
38
+ *
39
+ * **Editing one of Roark’s own variants forks it for your organization.** The
40
+ * response carries the new variant’s `id`, which will differ from the one in the
41
+ * path, and `isSystem` becomes false. Roark’s variant is untouched and other
42
+ * organizations keep it. DELETE your fork to go back to it.
43
+ *
44
+ * Which fields are editable depends on the metric: some Roark metrics lock their
45
+ * prompt or output configuration, and a locked field is rejected rather than
46
+ * ignored.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const metricVariant = await client.metricVariant.update(
51
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
52
+ * { idOrSlug: 'idOrSlug' },
53
+ * );
54
+ * ```
55
+ */
56
+ update(
57
+ variantID: string,
58
+ params: MetricVariantUpdateParams,
59
+ options?: RequestOptions,
60
+ ): APIPromise<MetricVariantUpdateResponse> {
61
+ const { idOrSlug, ...body } = params;
62
+ return this._client.put(path`/v1/metric/definitions/${idOrSlug}/variants/${variantID}`, {
63
+ body,
64
+ ...options,
65
+ });
66
+ }
67
+
68
+ /**
69
+ * Every configuration of this metric your organization can use: Roark’s own
70
+ * variants and any your organization has added or forked. `isDefault` marks the
71
+ * one the metric is scored with when nothing pins another; pass any variant’s `id`
72
+ * as `sourceVariantId` to pin it on a derived metric.
73
+ *
74
+ * Auto-managed variants (the ones a package materializes for you) are not listed:
75
+ * they are engine state, not configuration you author.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * const metricVariants =
80
+ * await client.metricVariant.list('idOrSlug');
81
+ * ```
82
+ */
83
+ list(idOrSlug: string, options?: RequestOptions): APIPromise<MetricVariantListResponse> {
84
+ return this._client.get(path`/v1/metric/definitions/${idOrSlug}/variants`, options);
85
+ }
86
+
87
+ /**
88
+ * Remove one of your organization’s variants. Anything pinned to it falls back to
89
+ * the Default, so deleting a fork of a Roark variant returns you to Roark’s
90
+ * configuration.
91
+ *
92
+ * Roark’s own variants cannot be deleted, and neither can a Default. Values
93
+ * already collected under the deleted variant are retained.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * const metricVariant = await client.metricVariant.delete(
98
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
99
+ * { idOrSlug: 'idOrSlug' },
100
+ * );
101
+ * ```
102
+ */
103
+ delete(
104
+ variantID: string,
105
+ params: MetricVariantDeleteParams,
106
+ options?: RequestOptions,
107
+ ): APIPromise<MetricVariantDeleteResponse> {
108
+ const { idOrSlug } = params;
109
+ return this._client.delete(path`/v1/metric/definitions/${idOrSlug}/variants/${variantID}`, options);
110
+ }
111
+
112
+ /**
113
+ * One configuration of this metric, by id.
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * const response = await client.metricVariant.getByID(
118
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
119
+ * { idOrSlug: 'idOrSlug' },
120
+ * );
121
+ * ```
122
+ */
123
+ getByID(
124
+ variantID: string,
125
+ params: MetricVariantGetByIDParams,
126
+ options?: RequestOptions,
127
+ ): APIPromise<MetricVariantGetByIDResponse> {
128
+ const { idOrSlug } = params;
129
+ return this._client.get(path`/v1/metric/definitions/${idOrSlug}/variants/${variantID}`, options);
130
+ }
131
+ }
132
+
133
+ export interface MetricVariantCreateResponse {
134
+ /**
135
+ * One named configuration of a metric.
136
+ */
137
+ data: MetricVariantCreateResponse.Data;
138
+ }
139
+
140
+ export namespace MetricVariantCreateResponse {
141
+ /**
142
+ * One named configuration of a metric.
143
+ */
144
+ export interface Data {
145
+ /**
146
+ * Unique identifier for the variant.
147
+ */
148
+ id: string;
149
+
150
+ /**
151
+ * When the variant was created.
152
+ */
153
+ createdAt: string;
154
+
155
+ /**
156
+ * Whether this is the variant a metric is scored with when nothing pins another.
157
+ */
158
+ isDefault: boolean;
159
+
160
+ /**
161
+ * True for Roark's own variant, shared by every organization. Editing one forks it
162
+ * for yours; the original is left alone.
163
+ */
164
+ isSystem: boolean;
165
+
166
+ /**
167
+ * The metric this variant configures.
168
+ */
169
+ metricDefinitionId: string;
170
+
171
+ /**
172
+ * Name of the variant. "Default" is the one a metric is scored with unless
173
+ * something pins another.
174
+ */
175
+ name: string;
176
+
177
+ /**
178
+ * When the variant was last changed.
179
+ */
180
+ updatedAt: string;
181
+
182
+ /**
183
+ * The variant's current version: an immutable snapshot of its configuration.
184
+ * Editing the variant advances this. Null only for a variant left without one,
185
+ * which cannot be scored until it is configured.
186
+ */
187
+ versionId: string | null;
188
+ }
189
+ }
190
+
191
+ export interface MetricVariantUpdateResponse {
192
+ /**
193
+ * One named configuration of a metric.
194
+ */
195
+ data: MetricVariantUpdateResponse.Data;
196
+ }
197
+
198
+ export namespace MetricVariantUpdateResponse {
199
+ /**
200
+ * One named configuration of a metric.
201
+ */
202
+ export interface Data {
203
+ /**
204
+ * Unique identifier for the variant.
205
+ */
206
+ id: string;
207
+
208
+ /**
209
+ * When the variant was created.
210
+ */
211
+ createdAt: string;
212
+
213
+ /**
214
+ * Whether this is the variant a metric is scored with when nothing pins another.
215
+ */
216
+ isDefault: boolean;
217
+
218
+ /**
219
+ * True for Roark's own variant, shared by every organization. Editing one forks it
220
+ * for yours; the original is left alone.
221
+ */
222
+ isSystem: boolean;
223
+
224
+ /**
225
+ * The metric this variant configures.
226
+ */
227
+ metricDefinitionId: string;
228
+
229
+ /**
230
+ * Name of the variant. "Default" is the one a metric is scored with unless
231
+ * something pins another.
232
+ */
233
+ name: string;
234
+
235
+ /**
236
+ * When the variant was last changed.
237
+ */
238
+ updatedAt: string;
239
+
240
+ /**
241
+ * The variant's current version: an immutable snapshot of its configuration.
242
+ * Editing the variant advances this. Null only for a variant left without one,
243
+ * which cannot be scored until it is configured.
244
+ */
245
+ versionId: string | null;
246
+ }
247
+ }
248
+
249
+ export interface MetricVariantListResponse {
250
+ data: Array<MetricVariantListResponse.Data>;
251
+ }
252
+
253
+ export namespace MetricVariantListResponse {
254
+ /**
255
+ * One named configuration of a metric.
256
+ */
257
+ export interface Data {
258
+ /**
259
+ * Unique identifier for the variant.
260
+ */
261
+ id: string;
262
+
263
+ /**
264
+ * When the variant was created.
265
+ */
266
+ createdAt: string;
267
+
268
+ /**
269
+ * Whether this is the variant a metric is scored with when nothing pins another.
270
+ */
271
+ isDefault: boolean;
272
+
273
+ /**
274
+ * True for Roark's own variant, shared by every organization. Editing one forks it
275
+ * for yours; the original is left alone.
276
+ */
277
+ isSystem: boolean;
278
+
279
+ /**
280
+ * The metric this variant configures.
281
+ */
282
+ metricDefinitionId: string;
283
+
284
+ /**
285
+ * Name of the variant. "Default" is the one a metric is scored with unless
286
+ * something pins another.
287
+ */
288
+ name: string;
289
+
290
+ /**
291
+ * When the variant was last changed.
292
+ */
293
+ updatedAt: string;
294
+
295
+ /**
296
+ * The variant's current version: an immutable snapshot of its configuration.
297
+ * Editing the variant advances this. Null only for a variant left without one,
298
+ * which cannot be scored until it is configured.
299
+ */
300
+ versionId: string | null;
301
+ }
302
+ }
303
+
304
+ export interface MetricVariantDeleteResponse {
305
+ data: MetricVariantDeleteResponse.Data;
306
+ }
307
+
308
+ export namespace MetricVariantDeleteResponse {
309
+ export interface Data {
310
+ id: string;
311
+
312
+ deleted: true;
313
+ }
314
+ }
315
+
316
+ export interface MetricVariantGetByIDResponse {
317
+ /**
318
+ * One named configuration of a metric.
319
+ */
320
+ data: MetricVariantGetByIDResponse.Data;
321
+ }
322
+
323
+ export namespace MetricVariantGetByIDResponse {
324
+ /**
325
+ * One named configuration of a metric.
326
+ */
327
+ export interface Data {
328
+ /**
329
+ * Unique identifier for the variant.
330
+ */
331
+ id: string;
332
+
333
+ /**
334
+ * When the variant was created.
335
+ */
336
+ createdAt: string;
337
+
338
+ /**
339
+ * Whether this is the variant a metric is scored with when nothing pins another.
340
+ */
341
+ isDefault: boolean;
342
+
343
+ /**
344
+ * True for Roark's own variant, shared by every organization. Editing one forks it
345
+ * for yours; the original is left alone.
346
+ */
347
+ isSystem: boolean;
348
+
349
+ /**
350
+ * The metric this variant configures.
351
+ */
352
+ metricDefinitionId: string;
353
+
354
+ /**
355
+ * Name of the variant. "Default" is the one a metric is scored with unless
356
+ * something pins another.
357
+ */
358
+ name: string;
359
+
360
+ /**
361
+ * When the variant was last changed.
362
+ */
363
+ updatedAt: string;
364
+
365
+ /**
366
+ * The variant's current version: an immutable snapshot of its configuration.
367
+ * Editing the variant advances this. Null only for a variant left without one,
368
+ * which cannot be scored until it is configured.
369
+ */
370
+ versionId: string | null;
371
+ }
372
+ }
373
+
374
+ export interface MetricVariantCreateParams {
375
+ /**
376
+ * Name for the new variant. Must be unique for this metric within your
377
+ * organization and cannot be `Default`.
378
+ */
379
+ name: string;
380
+ }
381
+
382
+ export interface MetricVariantUpdateParams {
383
+ /**
384
+ * Path param: Metric definition UUID or its stable slug.
385
+ */
386
+ idOrSlug: string;
387
+
388
+ /**
389
+ * Body param: What a `false` value means. Given to the judge as its polarity rule,
390
+ * so keep it accurate.
391
+ */
392
+ booleanFalseLabel?: string;
393
+
394
+ /**
395
+ * Body param: What a `true` value means. Given to the judge as its polarity rule,
396
+ * so keep it accurate.
397
+ */
398
+ booleanTrueLabel?: string;
399
+
400
+ /**
401
+ * Body param: Free-text audit note recorded on the new version.
402
+ */
403
+ changeReason?: string;
404
+
405
+ /**
406
+ * Body param: The rubric this variant applies. LLM judge metrics only.
407
+ */
408
+ llmPrompt?: string;
409
+
410
+ /**
411
+ * Body param: Maximum classifications returned. CLASSIFICATION output only.
412
+ */
413
+ maxClassifications?: number;
414
+
415
+ /**
416
+ * Body param: Rename the variant. Does not change its configuration, so
417
+ * `versionId` is unaffected. `Default` is reserved.
418
+ */
419
+ name?: string;
420
+
421
+ /**
422
+ * Body param: Scale maximum. SCALE output only.
423
+ */
424
+ scaleMax?: number;
425
+
426
+ /**
427
+ * Body param: Scale minimum. SCALE output only.
428
+ */
429
+ scaleMin?: number;
430
+ }
431
+
432
+ export interface MetricVariantDeleteParams {
433
+ /**
434
+ * Metric definition UUID or its stable slug.
435
+ */
436
+ idOrSlug: string;
437
+ }
438
+
439
+ export interface MetricVariantGetByIDParams {
440
+ /**
441
+ * Metric definition UUID or its stable slug.
442
+ */
443
+ idOrSlug: string;
444
+ }
445
+
446
+ export declare namespace MetricVariant {
447
+ export {
448
+ type MetricVariantCreateResponse as MetricVariantCreateResponse,
449
+ type MetricVariantUpdateResponse as MetricVariantUpdateResponse,
450
+ type MetricVariantListResponse as MetricVariantListResponse,
451
+ type MetricVariantDeleteResponse as MetricVariantDeleteResponse,
452
+ type MetricVariantGetByIDResponse as MetricVariantGetByIDResponse,
453
+ type MetricVariantCreateParams as MetricVariantCreateParams,
454
+ type MetricVariantUpdateParams as MetricVariantUpdateParams,
455
+ type MetricVariantDeleteParams as MetricVariantDeleteParams,
456
+ type MetricVariantGetByIDParams as MetricVariantGetByIDParams,
457
+ };
458
+ }