@roarkanalytics/sdk 2.24.0 → 2.25.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 +8 -0
  2. package/client.d.mts +8 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +8 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +7 -1
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/index.d.mts +3 -1
  12. package/resources/index.d.mts.map +1 -1
  13. package/resources/index.d.ts +3 -1
  14. package/resources/index.d.ts.map +1 -1
  15. package/resources/index.js +5 -1
  16. package/resources/index.js.map +1 -1
  17. package/resources/index.mjs +3 -1
  18. package/resources/index.mjs.map +1 -1
  19. package/resources/metric-collection-job.d.mts +237 -0
  20. package/resources/metric-collection-job.d.mts.map +1 -0
  21. package/resources/metric-collection-job.d.ts +237 -0
  22. package/resources/metric-collection-job.d.ts.map +1 -0
  23. package/resources/metric-collection-job.js +29 -0
  24. package/resources/metric-collection-job.js.map +1 -0
  25. package/resources/metric-collection-job.mjs +25 -0
  26. package/resources/metric-collection-job.mjs.map +1 -0
  27. package/resources/metric-policy.d.mts +502 -0
  28. package/resources/metric-policy.d.mts.map +1 -0
  29. package/resources/metric-policy.d.ts +502 -0
  30. package/resources/metric-policy.d.ts.map +1 -0
  31. package/resources/metric-policy.js +76 -0
  32. package/resources/metric-policy.js.map +1 -0
  33. package/resources/metric-policy.mjs +72 -0
  34. package/resources/metric-policy.mjs.map +1 -0
  35. package/resources/metric.d.mts +187 -1
  36. package/resources/metric.d.mts.map +1 -1
  37. package/resources/metric.d.ts +187 -1
  38. package/resources/metric.d.ts.map +1 -1
  39. package/resources/metric.js +21 -0
  40. package/resources/metric.js.map +1 -1
  41. package/resources/metric.mjs +21 -0
  42. package/resources/metric.mjs.map +1 -1
  43. package/resources/simulation-job.d.mts +2 -2
  44. package/resources/simulation-job.d.mts.map +1 -1
  45. package/resources/simulation-job.d.ts +2 -2
  46. package/resources/simulation-job.d.ts.map +1 -1
  47. package/resources/simulation-persona.d.mts +6 -6
  48. package/resources/simulation-persona.d.mts.map +1 -1
  49. package/resources/simulation-persona.d.ts +6 -6
  50. package/resources/simulation-persona.d.ts.map +1 -1
  51. package/resources/simulation-run-plan-job.d.mts +1 -1
  52. package/resources/simulation-run-plan-job.d.mts.map +1 -1
  53. package/resources/simulation-run-plan-job.d.ts +1 -1
  54. package/resources/simulation-run-plan-job.d.ts.map +1 -1
  55. package/src/client.ts +56 -2
  56. package/src/resources/index.ts +25 -1
  57. package/src/resources/metric-collection-job.ts +307 -0
  58. package/src/resources/metric-policy.ts +679 -0
  59. package/src/resources/metric.ts +232 -1
  60. package/src/resources/simulation-job.ts +2 -2
  61. package/src/resources/simulation-persona.ts +6 -6
  62. package/src/resources/simulation-run-plan-job.ts +1 -1
  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
@@ -5,16 +5,112 @@ import { APIPromise } from '../core/api-promise';
5
5
  import { RequestOptions } from '../internal/request-options';
6
6
 
7
7
  export class Metric extends APIResource {
8
+ /**
9
+ * Create a new custom metric definition. The metric will be added to the specified
10
+ * analysis package and can be used for evaluating calls.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const response = await client.metric.createDefinition({
15
+ * analysisPackageId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
16
+ * name: 'Customer Satisfaction',
17
+ * outputType: 'BOOLEAN',
18
+ * });
19
+ * ```
20
+ */
21
+ createDefinition(
22
+ body: MetricCreateDefinitionParams,
23
+ options?: RequestOptions,
24
+ ): APIPromise<MetricCreateDefinitionResponse> {
25
+ return this._client.post('/v1/metric/definitions', { body, ...options });
26
+ }
27
+
8
28
  /**
9
29
  * Fetch all metric definitions available in the project, including both
10
30
  * system-generated and custom metrics. Only returns metrics from enabled analysis
11
31
  * packages.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const response = await client.metric.listDefinitions();
36
+ * ```
12
37
  */
13
38
  listDefinitions(options?: RequestOptions): APIPromise<MetricListDefinitionsResponse> {
14
39
  return this._client.get('/v1/metric/definitions', options);
15
40
  }
16
41
  }
17
42
 
43
+ export interface MetricCreateDefinitionResponse {
44
+ /**
45
+ * Metric definition data
46
+ */
47
+ data: MetricCreateDefinitionResponse.Data;
48
+ }
49
+
50
+ export namespace MetricCreateDefinitionResponse {
51
+ /**
52
+ * Metric definition data
53
+ */
54
+ export interface Data {
55
+ /**
56
+ * Unique identifier for the metric definition
57
+ */
58
+ id: string;
59
+
60
+ /**
61
+ * Description of what the metric measures
62
+ */
63
+ description: string;
64
+
65
+ /**
66
+ * Stable metric identifier (e.g. "call_reason", "customer_satisfaction")
67
+ */
68
+ metricId: string;
69
+
70
+ /**
71
+ * Name of the metric
72
+ */
73
+ name: string;
74
+
75
+ /**
76
+ * Whether metric is global or per-participant
77
+ */
78
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
79
+
80
+ /**
81
+ * Which levels this metric can produce values at
82
+ */
83
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
84
+
85
+ /**
86
+ * Type of value this metric produces
87
+ */
88
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
89
+
90
+ /**
91
+ * Unit information if applicable
92
+ */
93
+ unit?: Data.Unit;
94
+ }
95
+
96
+ export namespace Data {
97
+ /**
98
+ * Unit information if applicable
99
+ */
100
+ export interface Unit {
101
+ /**
102
+ * Name of the unit
103
+ */
104
+ name: string;
105
+
106
+ /**
107
+ * Symbol for the unit
108
+ */
109
+ symbol: string | null;
110
+ }
111
+ }
112
+ }
113
+
18
114
  export interface MetricListDefinitionsResponse {
19
115
  /**
20
116
  * Metrics response payload
@@ -86,6 +182,141 @@ export namespace MetricListDefinitionsResponse {
86
182
  }
87
183
  }
88
184
 
185
+ export interface MetricCreateDefinitionParams {
186
+ /**
187
+ * ID of the analysis package to add this metric to
188
+ */
189
+ analysisPackageId: string;
190
+
191
+ /**
192
+ * Name of the metric
193
+ */
194
+ name: string;
195
+
196
+ /**
197
+ * Type of value this metric produces
198
+ */
199
+ outputType: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
200
+
201
+ /**
202
+ * Label for the false/negative case (only for BOOLEAN type)
203
+ */
204
+ booleanFalseLabel?: string;
205
+
206
+ /**
207
+ * Label for the true/positive case (only for BOOLEAN type)
208
+ */
209
+ booleanTrueLabel?: string;
210
+
211
+ /**
212
+ * Options for classification. Required for CLASSIFICATION type.
213
+ */
214
+ classificationOptions?: Array<MetricCreateDefinitionParams.ClassificationOption>;
215
+
216
+ /**
217
+ * LLM prompt/criteria for evaluating this metric. Used to instruct the model on
218
+ * how to score. Required for BOOLEAN, NUMERIC, TEXT, and SCALE types.
219
+ */
220
+ llmPrompt?: string;
221
+
222
+ /**
223
+ * Maximum number of classifications that can be selected (only for CLASSIFICATION
224
+ * type)
225
+ */
226
+ maxClassifications?: number;
227
+
228
+ /**
229
+ * Unique identifier for the metric (e.g. "customer_satisfaction"). Auto-generated
230
+ * from name if not provided.
231
+ */
232
+ metricId?: string;
233
+
234
+ /**
235
+ * Participant role to evaluate. Required when scope is PER_PARTICIPANT.
236
+ */
237
+ participantRole?: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER';
238
+
239
+ /**
240
+ * Labels for scale ranges (only for SCALE type)
241
+ */
242
+ scaleLabels?: Array<MetricCreateDefinitionParams.ScaleLabel>;
243
+
244
+ /**
245
+ * Maximum value for scale. Required for SCALE type.
246
+ */
247
+ scaleMax?: number;
248
+
249
+ /**
250
+ * Minimum value for scale. Required for SCALE type.
251
+ */
252
+ scaleMin?: number;
253
+
254
+ /**
255
+ * Whether metric is global or per-participant (default: GLOBAL)
256
+ */
257
+ scope?: 'GLOBAL' | 'PER_PARTICIPANT';
258
+
259
+ /**
260
+ * Which levels this metric can produce values at (default: ["CALL"])
261
+ */
262
+ supportedContexts?: Array<'CALL' | 'SEGMENT' | 'TURN'>;
263
+ }
264
+
265
+ export namespace MetricCreateDefinitionParams {
266
+ export interface ClassificationOption {
267
+ /**
268
+ * Description of what this option means
269
+ */
270
+ description: string;
271
+
272
+ /**
273
+ * Display order of this option
274
+ */
275
+ displayOrder: number;
276
+
277
+ /**
278
+ * Label for this classification option
279
+ */
280
+ label: string;
281
+ }
282
+
283
+ export interface ScaleLabel {
284
+ /**
285
+ * Display order of this label
286
+ */
287
+ displayOrder: number;
288
+
289
+ /**
290
+ * Label for this range
291
+ */
292
+ label: string;
293
+
294
+ /**
295
+ * Maximum value for this label range
296
+ */
297
+ rangeMax: number;
298
+
299
+ /**
300
+ * Minimum value for this label range
301
+ */
302
+ rangeMin: number;
303
+
304
+ /**
305
+ * Hex color code for this label (e.g. "#FF0000")
306
+ */
307
+ colorHex?: string;
308
+
309
+ /**
310
+ * Description of what this range means
311
+ */
312
+ description?: string;
313
+ }
314
+ }
315
+
89
316
  export declare namespace Metric {
90
- export { type MetricListDefinitionsResponse as MetricListDefinitionsResponse };
317
+ export {
318
+ type MetricCreateDefinitionResponse as MetricCreateDefinitionResponse,
319
+ type MetricListDefinitionsResponse as MetricListDefinitionsResponse,
320
+ type MetricCreateDefinitionParams as MetricCreateDefinitionParams,
321
+ };
91
322
  }
@@ -191,7 +191,7 @@ export namespace SimulationJobGetByIDResponse {
191
191
  /**
192
192
  * Gender of the persona
193
193
  */
194
- gender: 'MALE' | 'FEMALE' | 'NEUTRAL';
194
+ gender: 'MALE' | 'FEMALE';
195
195
 
196
196
  /**
197
197
  * Whether the persona uses filler words like "um" and "uh"
@@ -428,7 +428,7 @@ export namespace SimulationJobLookupResponse {
428
428
  /**
429
429
  * Gender of the persona
430
430
  */
431
- gender: 'MALE' | 'FEMALE' | 'NEUTRAL';
431
+ gender: 'MALE' | 'FEMALE';
432
432
 
433
433
  /**
434
434
  * Whether the persona uses filler words like "um" and "uh"
@@ -138,7 +138,7 @@ export namespace SimulationPersonaCreateResponse {
138
138
  /**
139
139
  * Gender of the persona
140
140
  */
141
- gender: 'MALE' | 'FEMALE' | 'NEUTRAL';
141
+ gender: 'MALE' | 'FEMALE';
142
142
 
143
143
  /**
144
144
  * Whether the persona uses filler words like "um" and "uh"
@@ -271,7 +271,7 @@ export namespace SimulationPersonaUpdateResponse {
271
271
  /**
272
272
  * Gender of the persona
273
273
  */
274
- gender: 'MALE' | 'FEMALE' | 'NEUTRAL';
274
+ gender: 'MALE' | 'FEMALE';
275
275
 
276
276
  /**
277
277
  * Whether the persona uses filler words like "um" and "uh"
@@ -406,7 +406,7 @@ export namespace SimulationPersonaListResponse {
406
406
  /**
407
407
  * Gender of the persona
408
408
  */
409
- gender: 'MALE' | 'FEMALE' | 'NEUTRAL';
409
+ gender: 'MALE' | 'FEMALE';
410
410
 
411
411
  /**
412
412
  * Whether the persona uses filler words like "um" and "uh"
@@ -556,7 +556,7 @@ export namespace SimulationPersonaGetByIDResponse {
556
556
  /**
557
557
  * Gender of the persona
558
558
  */
559
- gender: 'MALE' | 'FEMALE' | 'NEUTRAL';
559
+ gender: 'MALE' | 'FEMALE';
560
560
 
561
561
  /**
562
562
  * Whether the persona uses filler words like "um" and "uh"
@@ -651,7 +651,7 @@ export interface SimulationPersonaCreateParams {
651
651
  /**
652
652
  * Gender of the persona
653
653
  */
654
- gender: 'MALE' | 'FEMALE' | 'NEUTRAL';
654
+ gender: 'MALE' | 'FEMALE';
655
655
 
656
656
  /**
657
657
  * Primary language ISO 639-1 code for the persona
@@ -796,7 +796,7 @@ export interface SimulationPersonaUpdateParams {
796
796
  /**
797
797
  * Gender of the persona
798
798
  */
799
- gender?: 'MALE' | 'FEMALE' | 'NEUTRAL';
799
+ gender?: 'MALE' | 'FEMALE';
800
800
 
801
801
  /**
802
802
  * Whether the persona uses filler words like "um" and "uh"
@@ -348,7 +348,7 @@ export namespace SimulationRunPlanJobGetByIDResponse {
348
348
  /**
349
349
  * Gender of the persona
350
350
  */
351
- gender: 'MALE' | 'FEMALE' | 'NEUTRAL';
351
+ gender: 'MALE' | 'FEMALE';
352
352
 
353
353
  /**
354
354
  * Whether the persona uses filler words like "um" and "uh"
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.24.0'; // x-release-please-version
1
+ export const VERSION = '2.25.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.24.0";
1
+ export declare const VERSION = "2.25.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.24.0";
1
+ export declare const VERSION = "2.25.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '2.24.0'; // x-release-please-version
4
+ exports.VERSION = '2.25.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.24.0'; // x-release-please-version
1
+ export const VERSION = '2.25.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map