@roarkanalytics/sdk 3.5.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 +24 -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 +696 -1
  44. package/resources/metric.d.mts.map +1 -1
  45. package/resources/metric.d.ts +696 -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 +1008 -124
  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
@@ -3,6 +3,7 @@
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
5
  import { RequestOptions } from '../internal/request-options';
6
+ import { path } from '../internal/utils/path';
6
7
 
7
8
  export class Metric extends APIResource {
8
9
  /**
@@ -44,6 +45,32 @@ export class Metric extends APIResource {
44
45
  ): APIPromise<MetricListDefinitionsResponse> {
45
46
  return this._client.get('/v1/metric/definitions', { query, ...options });
46
47
  }
48
+
49
+ /**
50
+ * Update the editable subset of a custom metric definition, addressed by its UUID
51
+ * or its stable `slug`. Only the supplied fields are changed; omitted fields are
52
+ * left unchanged. Every update creates a new immutable version; the response
53
+ * carries the advanced `versionId`. Immutable fields (scope, outputType, calcType,
54
+ * …) are rejected, and which fields are editable depends on the metric (e.g.
55
+ * derived metrics only allow `name`). Roark's own metrics are rejected here: this
56
+ * endpoint edits the shared definition, which every workspace sees. To change one
57
+ * for your workspace alone, edit its variant with PUT
58
+ * /v1/metric/definitions/{idOrSlug}/variants/{variantId}, which forks it for you
59
+ * and leaves every other workspace on the original.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const response =
64
+ * await client.metric.updateDefinition('idOrSlug');
65
+ * ```
66
+ */
67
+ updateDefinition(
68
+ idOrSlug: string,
69
+ body: MetricUpdateDefinitionParams | null | undefined = {},
70
+ options?: RequestOptions,
71
+ ): APIPromise<MetricUpdateDefinitionResponse> {
72
+ return this._client.put(path`/v1/metric/definitions/${idOrSlug}`, { body, ...options });
73
+ }
47
74
  }
48
75
 
49
76
  export interface MetricCreateDefinitionResponse {
@@ -63,6 +90,18 @@ export namespace MetricCreateDefinitionResponse {
63
90
  */
64
91
  id: string;
65
92
 
93
+ /**
94
+ * For a BOOLEAN metric, what a `false` value means. Also given to the judge as its
95
+ * polarity rule.
96
+ */
97
+ booleanFalseLabel: string | null;
98
+
99
+ /**
100
+ * For a BOOLEAN metric, what a `true` value means. Also given to the judge as its
101
+ * polarity rule.
102
+ */
103
+ booleanTrueLabel: string | null;
104
+
66
105
  /**
67
106
  * Metric evaluated by an LLM against a prompt.
68
107
  */
@@ -73,6 +112,12 @@ export namespace MetricCreateDefinitionResponse {
73
112
  */
74
113
  description: string;
75
114
 
115
+ /**
116
+ * The rubric this judge applies, as stored. Read it back to confirm which criteria
117
+ * are live after a create or update.
118
+ */
119
+ llmPrompt: string | null;
120
+
76
121
  /**
77
122
  * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
78
123
  */
@@ -83,6 +128,15 @@ export namespace MetricCreateDefinitionResponse {
83
128
  */
84
129
  name: string;
85
130
 
131
+ /**
132
+ * True when this metric can only be scored from a live recording
133
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
134
+ * simulation run forces live enrichment: the run waits for your recording and, if
135
+ * none arrives, the metric produces no value. Check this before a run rather than
136
+ * discovering the wait afterwards.
137
+ */
138
+ requiresLiveConversation: boolean;
139
+
86
140
  /**
87
141
  * Whether metric is global or per-participant
88
142
  */
@@ -98,6 +152,13 @@ export namespace MetricCreateDefinitionResponse {
98
152
  */
99
153
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
100
154
 
155
+ /**
156
+ * Which kinds of conversation this metric can be scored on. `null` means both.
157
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
158
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
159
+ */
160
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
161
+
101
162
  /**
102
163
  * Type of value this metric produces
103
164
  */
@@ -170,6 +231,15 @@ export namespace MetricCreateDefinitionResponse {
170
231
  */
171
232
  name: string;
172
233
 
234
+ /**
235
+ * True when this metric can only be scored from a live recording
236
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
237
+ * simulation run forces live enrichment: the run waits for your recording and, if
238
+ * none arrives, the metric produces no value. Check this before a run rather than
239
+ * discovering the wait afterwards.
240
+ */
241
+ requiresLiveConversation: boolean;
242
+
173
243
  /**
174
244
  * Whether metric is global or per-participant
175
245
  */
@@ -185,6 +255,13 @@ export namespace MetricCreateDefinitionResponse {
185
255
  */
186
256
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
187
257
 
258
+ /**
259
+ * Which kinds of conversation this metric can be scored on. `null` means both.
260
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
261
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
262
+ */
263
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
264
+
188
265
  /**
189
266
  * Type of value this metric produces
190
267
  */
@@ -274,6 +351,15 @@ export namespace MetricCreateDefinitionResponse {
274
351
  */
275
352
  pattern: PatternMetricResponse.Pattern;
276
353
 
354
+ /**
355
+ * True when this metric can only be scored from a live recording
356
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
357
+ * simulation run forces live enrichment: the run waits for your recording and, if
358
+ * none arrives, the metric produces no value. Check this before a run rather than
359
+ * discovering the wait afterwards.
360
+ */
361
+ requiresLiveConversation: boolean;
362
+
277
363
  /**
278
364
  * Whether metric is global or per-participant
279
365
  */
@@ -289,6 +375,13 @@ export namespace MetricCreateDefinitionResponse {
289
375
  */
290
376
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
291
377
 
378
+ /**
379
+ * Which kinds of conversation this metric can be scored on. `null` means both.
380
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
381
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
382
+ */
383
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
384
+
292
385
  /**
293
386
  * Type of value this metric produces
294
387
  */
@@ -410,6 +503,18 @@ export namespace MetricListDefinitionsResponse {
410
503
  */
411
504
  id: string;
412
505
 
506
+ /**
507
+ * For a BOOLEAN metric, what a `false` value means. Also given to the judge as its
508
+ * polarity rule.
509
+ */
510
+ booleanFalseLabel: string | null;
511
+
512
+ /**
513
+ * For a BOOLEAN metric, what a `true` value means. Also given to the judge as its
514
+ * polarity rule.
515
+ */
516
+ booleanTrueLabel: string | null;
517
+
413
518
  /**
414
519
  * Metric evaluated by an LLM against a prompt.
415
520
  */
@@ -420,6 +525,12 @@ export namespace MetricListDefinitionsResponse {
420
525
  */
421
526
  description: string;
422
527
 
528
+ /**
529
+ * The rubric this judge applies, as stored. Read it back to confirm which criteria
530
+ * are live after a create or update.
531
+ */
532
+ llmPrompt: string | null;
533
+
423
534
  /**
424
535
  * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
425
536
  */
@@ -430,6 +541,15 @@ export namespace MetricListDefinitionsResponse {
430
541
  */
431
542
  name: string;
432
543
 
544
+ /**
545
+ * True when this metric can only be scored from a live recording
546
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
547
+ * simulation run forces live enrichment: the run waits for your recording and, if
548
+ * none arrives, the metric produces no value. Check this before a run rather than
549
+ * discovering the wait afterwards.
550
+ */
551
+ requiresLiveConversation: boolean;
552
+
433
553
  /**
434
554
  * Whether metric is global or per-participant
435
555
  */
@@ -445,6 +565,13 @@ export namespace MetricListDefinitionsResponse {
445
565
  */
446
566
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
447
567
 
568
+ /**
569
+ * Which kinds of conversation this metric can be scored on. `null` means both.
570
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
571
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
572
+ */
573
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
574
+
448
575
  /**
449
576
  * Type of value this metric produces
450
577
  */
@@ -512,6 +639,15 @@ export namespace MetricListDefinitionsResponse {
512
639
  */
513
640
  name: string;
514
641
 
642
+ /**
643
+ * True when this metric can only be scored from a live recording
644
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
645
+ * simulation run forces live enrichment: the run waits for your recording and, if
646
+ * none arrives, the metric produces no value. Check this before a run rather than
647
+ * discovering the wait afterwards.
648
+ */
649
+ requiresLiveConversation: boolean;
650
+
515
651
  /**
516
652
  * Whether metric is global or per-participant
517
653
  */
@@ -527,6 +663,13 @@ export namespace MetricListDefinitionsResponse {
527
663
  */
528
664
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
529
665
 
666
+ /**
667
+ * Which kinds of conversation this metric can be scored on. `null` means both.
668
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
669
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
670
+ */
671
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
672
+
530
673
  /**
531
674
  * Type of value this metric produces
532
675
  */
@@ -594,6 +737,15 @@ export namespace MetricListDefinitionsResponse {
594
737
  */
595
738
  name: string;
596
739
 
740
+ /**
741
+ * True when this metric can only be scored from a live recording
742
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
743
+ * simulation run forces live enrichment: the run waits for your recording and, if
744
+ * none arrives, the metric produces no value. Check this before a run rather than
745
+ * discovering the wait afterwards.
746
+ */
747
+ requiresLiveConversation: boolean;
748
+
597
749
  /**
598
750
  * Whether metric is global or per-participant
599
751
  */
@@ -609,6 +761,13 @@ export namespace MetricListDefinitionsResponse {
609
761
  */
610
762
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
611
763
 
764
+ /**
765
+ * Which kinds of conversation this metric can be scored on. `null` means both.
766
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
767
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
768
+ */
769
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
770
+
612
771
  /**
613
772
  * Type of value this metric produces
614
773
  */
@@ -711,6 +870,15 @@ export namespace MetricListDefinitionsResponse {
711
870
  */
712
871
  name: string;
713
872
 
873
+ /**
874
+ * True when this metric can only be scored from a live recording
875
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
876
+ * simulation run forces live enrichment: the run waits for your recording and, if
877
+ * none arrives, the metric produces no value. Check this before a run rather than
878
+ * discovering the wait afterwards.
879
+ */
880
+ requiresLiveConversation: boolean;
881
+
714
882
  /**
715
883
  * Whether metric is global or per-participant
716
884
  */
@@ -726,6 +894,13 @@ export namespace MetricListDefinitionsResponse {
726
894
  */
727
895
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
728
896
 
897
+ /**
898
+ * Which kinds of conversation this metric can be scored on. `null` means both.
899
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
900
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
901
+ */
902
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
903
+
729
904
  /**
730
905
  * Type of value this metric produces
731
906
  */
@@ -815,6 +990,15 @@ export namespace MetricListDefinitionsResponse {
815
990
  */
816
991
  pattern: PatternMetricResponse.Pattern;
817
992
 
993
+ /**
994
+ * True when this metric can only be scored from a live recording
995
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
996
+ * simulation run forces live enrichment: the run waits for your recording and, if
997
+ * none arrives, the metric produces no value. Check this before a run rather than
998
+ * discovering the wait afterwards.
999
+ */
1000
+ requiresLiveConversation: boolean;
1001
+
818
1002
  /**
819
1003
  * Whether metric is global or per-participant
820
1004
  */
@@ -830,6 +1014,13 @@ export namespace MetricListDefinitionsResponse {
830
1014
  */
831
1015
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
832
1016
 
1017
+ /**
1018
+ * Which kinds of conversation this metric can be scored on. `null` means both.
1019
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
1020
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
1021
+ */
1022
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
1023
+
833
1024
  /**
834
1025
  * Type of value this metric produces
835
1026
  */
@@ -937,222 +1128,759 @@ export namespace MetricListDefinitionsResponse {
937
1128
  }
938
1129
  }
939
1130
 
940
- export type MetricCreateDefinitionParams =
941
- | MetricCreateDefinitionParams.PromptMetricInput
942
- | MetricCreateDefinitionParams.FormulaMetricInput
943
- | MetricCreateDefinitionParams.PatternMetricInput;
1131
+ export interface MetricUpdateDefinitionResponse {
1132
+ /**
1133
+ * The updated metric definition. The variant is selected by `calculationType`.
1134
+ */
1135
+ data:
1136
+ | MetricUpdateDefinitionResponse.LlmJudgeMetricResponse
1137
+ | MetricUpdateDefinitionResponse.FormulaMetricResponse
1138
+ | MetricUpdateDefinitionResponse.PatternMetricResponse
1139
+ | MetricUpdateDefinitionResponse.ThresholdMetricResponse;
1140
+ }
944
1141
 
945
- export declare namespace MetricCreateDefinitionParams {
946
- export interface PromptMetricInput {
1142
+ export namespace MetricUpdateDefinitionResponse {
1143
+ export interface LlmJudgeMetricResponse {
947
1144
  /**
948
- * LLM-evaluated metric.
1145
+ * Unique identifier for the metric definition
949
1146
  */
950
- calculationType: 'LLM_JUDGE';
1147
+ id: string;
951
1148
 
952
1149
  /**
953
- * Name of the metric
1150
+ * For a BOOLEAN metric, what a `false` value means. Also given to the judge as its
1151
+ * polarity rule.
954
1152
  */
955
- name: string;
1153
+ booleanFalseLabel: string | null;
956
1154
 
957
1155
  /**
958
- * Type of value this metric produces
1156
+ * For a BOOLEAN metric, what a `true` value means. Also given to the judge as its
1157
+ * polarity rule.
959
1158
  */
960
- outputType: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
1159
+ booleanTrueLabel: string | null;
961
1160
 
962
1161
  /**
963
- * ID of the analysis package to add this metric to. Optional: when omitted, the
964
- * metric is added to a default "Custom Metrics" package for your project (created
965
- * automatically the first time).
1162
+ * Metric evaluated by an LLM against a prompt.
966
1163
  */
967
- analysisPackageId?: string;
1164
+ calculationType: 'LLM_JUDGE';
968
1165
 
969
1166
  /**
970
- * Label for the false case (only for BOOLEAN type)
1167
+ * Description of what the metric measures
971
1168
  */
972
- booleanFalseLabel?: string;
1169
+ description: string;
973
1170
 
974
1171
  /**
975
- * Label for the true case (only for BOOLEAN type)
1172
+ * The rubric this judge applies, as stored. Read it back to confirm which criteria
1173
+ * are live after a create or update.
976
1174
  */
977
- booleanTrueLabel?: string;
1175
+ llmPrompt: string | null;
978
1176
 
979
1177
  /**
980
- * Options for classification. Required for CLASSIFICATION type.
1178
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
981
1179
  */
982
- classificationOptions?: Array<PromptMetricInput.ClassificationOption>;
1180
+ metricId: string;
983
1181
 
984
1182
  /**
985
- * LLM prompt/criteria for evaluating this metric. Required for BOOLEAN, NUMERIC,
986
- * TEXT, and SCALE types.
1183
+ * Name of the metric
987
1184
  */
988
- llmPrompt?: string;
1185
+ name: string;
989
1186
 
990
1187
  /**
991
- * Maximum number of classifications that can be selected (only for CLASSIFICATION
992
- * type)
1188
+ * True when this metric can only be scored from a live recording
1189
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
1190
+ * simulation run forces live enrichment: the run waits for your recording and, if
1191
+ * none arrives, the metric produces no value. Check this before a run rather than
1192
+ * discovering the wait afterwards.
993
1193
  */
994
- maxClassifications?: number;
1194
+ requiresLiveConversation: boolean;
995
1195
 
996
1196
  /**
997
- * Alias of `slug` accepted for backwards compatibility. Use `slug` for new
998
- * integrations.
1197
+ * Whether metric is global or per-participant
999
1198
  */
1000
- metricId?: string;
1199
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
1001
1200
 
1002
1201
  /**
1003
- * Participant role to evaluate. Required when scope is PER_PARTICIPANT.
1202
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
1004
1203
  */
1005
- participantRole?: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER';
1204
+ slug: string;
1006
1205
 
1007
1206
  /**
1008
- * Labels for scale ranges (only for SCALE type)
1207
+ * Which levels this metric can produce values at
1009
1208
  */
1010
- scaleLabels?: Array<PromptMetricInput.ScaleLabel>;
1209
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
1011
1210
 
1012
1211
  /**
1013
- * Maximum value for scale. Required for SCALE type.
1212
+ * Which kinds of conversation this metric can be scored on. `null` means both.
1213
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
1214
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
1014
1215
  */
1015
- scaleMax?: number;
1216
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
1016
1217
 
1017
1218
  /**
1018
- * Minimum value for scale. Required for SCALE type.
1219
+ * Type of value this metric produces
1019
1220
  */
1020
- scaleMin?: number;
1221
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
1021
1222
 
1022
1223
  /**
1023
- * Whether metric is global or per-participant (default: GLOBAL)
1224
+ * The resolved variant this response reflects (org-scoped Default if the org has
1225
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
1226
+ * building a derived metric off this one to pin the exact config.
1024
1227
  */
1025
- scope?: 'GLOBAL' | 'PER_PARTICIPANT';
1228
+ variantId: string;
1026
1229
 
1027
1230
  /**
1028
- * Stable slug for the metric. Auto-generated from name if omitted.
1231
+ * The variant's current version. Immutable snapshot of the config — editing the
1232
+ * metric produces a new versionId. Use it to detect config changes.
1029
1233
  */
1030
- slug?: string;
1234
+ versionId: string;
1031
1235
 
1032
1236
  /**
1033
- * Which levels this metric can produce values at (default: ["CALL"])
1237
+ * Unit information if applicable
1034
1238
  */
1035
- supportedContexts?: Array<'CALL' | 'SEGMENT' | 'TURN'>;
1239
+ unit?: LlmJudgeMetricResponse.Unit;
1036
1240
  }
1037
1241
 
1038
- export namespace PromptMetricInput {
1242
+ export namespace LlmJudgeMetricResponse {
1039
1243
  /**
1040
- * Option for classification metrics.
1244
+ * Unit information if applicable
1041
1245
  */
1042
- export interface ClassificationOption {
1043
- description: string;
1044
-
1045
- displayOrder: number;
1046
-
1047
- label: string;
1048
- }
1049
-
1050
- export interface ScaleLabel {
1051
- /**
1052
- * Display order of this label
1053
- */
1054
- displayOrder: number;
1055
-
1056
- /**
1057
- * Label for this range
1058
- */
1059
- label: string;
1060
-
1061
- /**
1062
- * Maximum value for this label range
1063
- */
1064
- rangeMax: number;
1065
-
1066
- /**
1067
- * Minimum value for this label range
1068
- */
1069
- rangeMin: number;
1070
-
1246
+ export interface Unit {
1071
1247
  /**
1072
- * Hex color code for this label (e.g. "#FF0000")
1248
+ * Name of the unit
1073
1249
  */
1074
- colorHex?: string;
1250
+ name: string;
1075
1251
 
1076
1252
  /**
1077
- * Description of what this range means
1253
+ * Symbol for the unit
1078
1254
  */
1079
- description?: string;
1255
+ symbol: string | null;
1080
1256
  }
1081
1257
  }
1082
1258
 
1083
- export interface FormulaMetricInput {
1259
+ export interface FormulaMetricResponse {
1084
1260
  /**
1085
- * Metric computed by evaluating a mathematical expression over other metrics.
1261
+ * Unique identifier for the metric definition
1086
1262
  */
1087
- calculationType: 'FORMULA';
1263
+ id: string;
1088
1264
 
1089
1265
  /**
1090
- * Formula expression using `{{id:<uuid>}}` references to source metrics. Operators
1091
- * depend on output type: +, -, \*, / for NUMERIC; ==, !=, >=, <=, >, < for
1092
- * BOOLEAN.
1266
+ * Metric computed by evaluating an expression over other metrics.
1093
1267
  */
1094
- formula: string;
1268
+ calculationType: 'FORMULA';
1095
1269
 
1096
1270
  /**
1097
- * Name of the metric
1271
+ * Description of what the metric measures
1098
1272
  */
1099
- name: string;
1273
+ description: string;
1100
1274
 
1101
1275
  /**
1102
- * Output type of the formula. NUMERIC for arithmetic expressions, BOOLEAN for
1103
- * comparison expressions.
1276
+ * Formula configuration.
1104
1277
  */
1105
- outputType: 'NUMERIC' | 'BOOLEAN';
1278
+ formula: FormulaMetricResponse.Formula;
1106
1279
 
1107
1280
  /**
1108
- * Source metrics referenced by the formula. Minimum 2.
1281
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
1109
1282
  */
1110
- sources: Array<FormulaMetricInput.Source>;
1283
+ metricId: string;
1111
1284
 
1112
1285
  /**
1113
- * ID of the analysis package to add this metric to. Optional: when omitted, the
1114
- * metric is added to a default "Custom Metrics" package for your project (created
1115
- * automatically the first time).
1286
+ * Name of the metric
1116
1287
  */
1117
- analysisPackageId?: string;
1288
+ name: string;
1118
1289
 
1119
1290
  /**
1120
- * Alias of `slug` accepted for backwards compatibility. Use `slug` for new
1121
- * integrations.
1291
+ * True when this metric can only be scored from a live recording
1292
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
1293
+ * simulation run forces live enrichment: the run waits for your recording and, if
1294
+ * none arrives, the metric produces no value. Check this before a run rather than
1295
+ * discovering the wait afterwards.
1122
1296
  */
1123
- metricId?: string;
1297
+ requiresLiveConversation: boolean;
1124
1298
 
1125
1299
  /**
1126
- * Stable slug for the metric. Auto-generated from name if omitted.
1300
+ * Whether metric is global or per-participant
1127
1301
  */
1128
- slug?: string;
1129
- }
1130
-
1131
- export namespace FormulaMetricInput {
1132
- export interface Source {
1133
- /**
1134
- * ID of a metric referenced in the formula
1135
- */
1136
- sourceMetricDefinitionId: string;
1137
-
1138
- /**
1139
- * Variant of the source metric to use
1140
- */
1141
- sourceVariantId?: string;
1142
- }
1143
- }
1302
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
1144
1303
 
1145
- export interface PatternMetricInput {
1146
1304
  /**
1147
- * Metric detecting temporal patterns: a trigger condition followed by an outcome
1148
- * within a window.
1305
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
1149
1306
  */
1150
- calculationType: 'PATTERN';
1307
+ slug: string;
1151
1308
 
1152
1309
  /**
1153
- * Name of the metric
1310
+ * Which levels this metric can produce values at
1154
1311
  */
1155
- name: string;
1312
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
1313
+
1314
+ /**
1315
+ * Which kinds of conversation this metric can be scored on. `null` means both.
1316
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
1317
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
1318
+ */
1319
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
1320
+
1321
+ /**
1322
+ * Type of value this metric produces
1323
+ */
1324
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
1325
+
1326
+ /**
1327
+ * The resolved variant this response reflects (org-scoped Default if the org has
1328
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
1329
+ * building a derived metric off this one to pin the exact config.
1330
+ */
1331
+ variantId: string;
1332
+
1333
+ /**
1334
+ * The variant's current version. Immutable snapshot of the config — editing the
1335
+ * metric produces a new versionId. Use it to detect config changes.
1336
+ */
1337
+ versionId: string;
1338
+
1339
+ /**
1340
+ * Unit information if applicable
1341
+ */
1342
+ unit?: FormulaMetricResponse.Unit;
1343
+ }
1344
+
1345
+ export namespace FormulaMetricResponse {
1346
+ /**
1347
+ * Formula configuration.
1348
+ */
1349
+ export interface Formula {
1350
+ expression: string;
1351
+
1352
+ sources: Array<Formula.Source>;
1353
+ }
1354
+
1355
+ export namespace Formula {
1356
+ export interface Source {
1357
+ sourceMetricDefinitionId: string;
1358
+
1359
+ sourceVariantId: string | null;
1360
+ }
1361
+ }
1362
+
1363
+ /**
1364
+ * Unit information if applicable
1365
+ */
1366
+ export interface Unit {
1367
+ /**
1368
+ * Name of the unit
1369
+ */
1370
+ name: string;
1371
+
1372
+ /**
1373
+ * Symbol for the unit
1374
+ */
1375
+ symbol: string | null;
1376
+ }
1377
+ }
1378
+
1379
+ export interface PatternMetricResponse {
1380
+ /**
1381
+ * Unique identifier for the metric definition
1382
+ */
1383
+ id: string;
1384
+
1385
+ /**
1386
+ * Metric detecting a trigger condition followed by an outcome within a window.
1387
+ */
1388
+ calculationType: 'PATTERN';
1389
+
1390
+ /**
1391
+ * Description of what the metric measures
1392
+ */
1393
+ description: string;
1394
+
1395
+ /**
1396
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
1397
+ */
1398
+ metricId: string;
1399
+
1400
+ /**
1401
+ * Name of the metric
1402
+ */
1403
+ name: string;
1404
+
1405
+ /**
1406
+ * Pattern configuration.
1407
+ */
1408
+ pattern: PatternMetricResponse.Pattern;
1409
+
1410
+ /**
1411
+ * True when this metric can only be scored from a live recording
1412
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
1413
+ * simulation run forces live enrichment: the run waits for your recording and, if
1414
+ * none arrives, the metric produces no value. Check this before a run rather than
1415
+ * discovering the wait afterwards.
1416
+ */
1417
+ requiresLiveConversation: boolean;
1418
+
1419
+ /**
1420
+ * Whether metric is global or per-participant
1421
+ */
1422
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
1423
+
1424
+ /**
1425
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
1426
+ */
1427
+ slug: string;
1428
+
1429
+ /**
1430
+ * Which levels this metric can produce values at
1431
+ */
1432
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
1433
+
1434
+ /**
1435
+ * Which kinds of conversation this metric can be scored on. `null` means both.
1436
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
1437
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
1438
+ */
1439
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
1440
+
1441
+ /**
1442
+ * Type of value this metric produces
1443
+ */
1444
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
1445
+
1446
+ /**
1447
+ * The resolved variant this response reflects (org-scoped Default if the org has
1448
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
1449
+ * building a derived metric off this one to pin the exact config.
1450
+ */
1451
+ variantId: string;
1452
+
1453
+ /**
1454
+ * The variant's current version. Immutable snapshot of the config — editing the
1455
+ * metric produces a new versionId. Use it to detect config changes.
1456
+ */
1457
+ versionId: string;
1458
+
1459
+ /**
1460
+ * Unit information if applicable
1461
+ */
1462
+ unit?: PatternMetricResponse.Unit;
1463
+ }
1464
+
1465
+ export namespace PatternMetricResponse {
1466
+ /**
1467
+ * Pattern configuration.
1468
+ */
1469
+ export interface Pattern {
1470
+ operation: 'PATTERN_EXISTS' | 'PATTERN_COUNT' | 'OUTCOME_AGGREGATE';
1471
+
1472
+ outcome: Pattern.Outcome | null;
1473
+
1474
+ triggerCombinator: 'AND' | 'OR' | null;
1475
+
1476
+ triggers: Array<Pattern.Trigger>;
1477
+
1478
+ windowMode: string | null;
1479
+ }
1480
+
1481
+ export namespace Pattern {
1482
+ export interface Outcome {
1483
+ operator:
1484
+ | 'GREATER_THAN'
1485
+ | 'GREATER_THAN_OR_EQUALS'
1486
+ | 'LESS_THAN'
1487
+ | 'LESS_THAN_OR_EQUALS'
1488
+ | 'EQUALS'
1489
+ | 'NOT_EQUALS';
1490
+
1491
+ sourceMetricDefinitionId: string;
1492
+
1493
+ sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
1494
+
1495
+ sourceVariantId: string | null;
1496
+
1497
+ thresholdValue: string;
1498
+
1499
+ windowAfter: number | null;
1500
+
1501
+ windowBefore: number | null;
1502
+ }
1503
+
1504
+ export interface Trigger {
1505
+ operator:
1506
+ | 'GREATER_THAN'
1507
+ | 'GREATER_THAN_OR_EQUALS'
1508
+ | 'LESS_THAN'
1509
+ | 'LESS_THAN_OR_EQUALS'
1510
+ | 'EQUALS'
1511
+ | 'NOT_EQUALS';
1512
+
1513
+ sourceMetricDefinitionId: string;
1514
+
1515
+ sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
1516
+
1517
+ sourceVariantId: string | null;
1518
+
1519
+ thresholdValue: string;
1520
+ }
1521
+ }
1522
+
1523
+ /**
1524
+ * Unit information if applicable
1525
+ */
1526
+ export interface Unit {
1527
+ /**
1528
+ * Name of the unit
1529
+ */
1530
+ name: string;
1531
+
1532
+ /**
1533
+ * Symbol for the unit
1534
+ */
1535
+ symbol: string | null;
1536
+ }
1537
+ }
1538
+
1539
+ export interface ThresholdMetricResponse {
1540
+ /**
1541
+ * Unique identifier for the metric definition
1542
+ */
1543
+ id: string;
1544
+
1545
+ /**
1546
+ * Boolean metric derived by comparing a source metric against a threshold.
1547
+ */
1548
+ calculationType: 'THRESHOLD';
1549
+
1550
+ /**
1551
+ * Description of what the metric measures
1552
+ */
1553
+ description: string;
1554
+
1555
+ /**
1556
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
1557
+ */
1558
+ metricId: string;
1559
+
1560
+ /**
1561
+ * Name of the metric
1562
+ */
1563
+ name: string;
1564
+
1565
+ /**
1566
+ * True when this metric can only be scored from a live recording
1567
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
1568
+ * simulation run forces live enrichment: the run waits for your recording and, if
1569
+ * none arrives, the metric produces no value. Check this before a run rather than
1570
+ * discovering the wait afterwards.
1571
+ */
1572
+ requiresLiveConversation: boolean;
1573
+
1574
+ /**
1575
+ * Whether metric is global or per-participant
1576
+ */
1577
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
1578
+
1579
+ /**
1580
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
1581
+ */
1582
+ slug: string;
1583
+
1584
+ /**
1585
+ * Which levels this metric can produce values at
1586
+ */
1587
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
1588
+
1589
+ /**
1590
+ * Which kinds of conversation this metric can be scored on. `null` means both.
1591
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
1592
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
1593
+ */
1594
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
1595
+
1596
+ /**
1597
+ * Type of value this metric produces
1598
+ */
1599
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
1600
+
1601
+ /**
1602
+ * The resolved variant this response reflects (org-scoped Default if the org has
1603
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
1604
+ * building a derived metric off this one to pin the exact config.
1605
+ */
1606
+ variantId: string;
1607
+
1608
+ /**
1609
+ * The variant's current version. Immutable snapshot of the config — editing the
1610
+ * metric produces a new versionId. Use it to detect config changes.
1611
+ */
1612
+ versionId: string;
1613
+
1614
+ /**
1615
+ * Threshold configuration.
1616
+ */
1617
+ threshold?: ThresholdMetricResponse.Threshold;
1618
+
1619
+ /**
1620
+ * Unit information if applicable
1621
+ */
1622
+ unit?: ThresholdMetricResponse.Unit;
1623
+ }
1624
+
1625
+ export namespace ThresholdMetricResponse {
1626
+ /**
1627
+ * Threshold configuration.
1628
+ */
1629
+ export interface Threshold {
1630
+ aggregationMode: 'EACH' | 'COUNT' | 'AVERAGE' | 'MIN' | 'MAX' | 'MEDIAN' | 'P95' | 'P99' | 'SUM';
1631
+
1632
+ countThreshold: number | null;
1633
+
1634
+ operator:
1635
+ | 'GREATER_THAN'
1636
+ | 'GREATER_THAN_OR_EQUALS'
1637
+ | 'LESS_THAN'
1638
+ | 'LESS_THAN_OR_EQUALS'
1639
+ | 'EQUALS'
1640
+ | 'NOT_EQUALS';
1641
+
1642
+ sourceMetricDefinitionId: string;
1643
+
1644
+ sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
1645
+
1646
+ sourceVariantId: string | null;
1647
+
1648
+ thresholdValue: string;
1649
+ }
1650
+
1651
+ /**
1652
+ * Unit information if applicable
1653
+ */
1654
+ export interface Unit {
1655
+ /**
1656
+ * Name of the unit
1657
+ */
1658
+ name: string;
1659
+
1660
+ /**
1661
+ * Symbol for the unit
1662
+ */
1663
+ symbol: string | null;
1664
+ }
1665
+ }
1666
+ }
1667
+
1668
+ export type MetricCreateDefinitionParams =
1669
+ | MetricCreateDefinitionParams.PromptMetricInput
1670
+ | MetricCreateDefinitionParams.FormulaMetricInput
1671
+ | MetricCreateDefinitionParams.PatternMetricInput;
1672
+
1673
+ export declare namespace MetricCreateDefinitionParams {
1674
+ export interface PromptMetricInput {
1675
+ /**
1676
+ * LLM-evaluated metric.
1677
+ */
1678
+ calculationType: 'LLM_JUDGE';
1679
+
1680
+ /**
1681
+ * Name of the metric
1682
+ */
1683
+ name: string;
1684
+
1685
+ /**
1686
+ * Type of value this metric produces
1687
+ */
1688
+ outputType: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
1689
+
1690
+ /**
1691
+ * ID of the analysis package to add this metric to. Optional: when omitted, the
1692
+ * metric is added to a default "Custom Metrics" package for your project (created
1693
+ * automatically the first time).
1694
+ */
1695
+ analysisPackageId?: string;
1696
+
1697
+ /**
1698
+ * Label for the false case (only for BOOLEAN type)
1699
+ */
1700
+ booleanFalseLabel?: string;
1701
+
1702
+ /**
1703
+ * Label for the true case (only for BOOLEAN type)
1704
+ */
1705
+ booleanTrueLabel?: string;
1706
+
1707
+ /**
1708
+ * Options for classification. Required for CLASSIFICATION type.
1709
+ */
1710
+ classificationOptions?: Array<PromptMetricInput.ClassificationOption>;
1711
+
1712
+ /**
1713
+ * LLM prompt/criteria for evaluating this metric. Required for BOOLEAN, NUMERIC,
1714
+ * TEXT, and SCALE types.
1715
+ */
1716
+ llmPrompt?: string;
1717
+
1718
+ /**
1719
+ * Maximum number of classifications that can be selected (only for CLASSIFICATION
1720
+ * type)
1721
+ */
1722
+ maxClassifications?: number;
1723
+
1724
+ /**
1725
+ * Alias of `slug` accepted for backwards compatibility. Use `slug` for new
1726
+ * integrations.
1727
+ */
1728
+ metricId?: string;
1729
+
1730
+ /**
1731
+ * Participant role to evaluate. Required when scope is PER_PARTICIPANT.
1732
+ */
1733
+ participantRole?: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER';
1734
+
1735
+ /**
1736
+ * Labels for scale ranges (only for SCALE type)
1737
+ */
1738
+ scaleLabels?: Array<PromptMetricInput.ScaleLabel>;
1739
+
1740
+ /**
1741
+ * Maximum value for scale. Required for SCALE type.
1742
+ */
1743
+ scaleMax?: number;
1744
+
1745
+ /**
1746
+ * Minimum value for scale. Required for SCALE type.
1747
+ */
1748
+ scaleMin?: number;
1749
+
1750
+ /**
1751
+ * Whether metric is global or per-participant (default: GLOBAL)
1752
+ */
1753
+ scope?: 'GLOBAL' | 'PER_PARTICIPANT';
1754
+
1755
+ /**
1756
+ * Stable slug for the metric. Auto-generated from name if omitted.
1757
+ */
1758
+ slug?: string;
1759
+
1760
+ /**
1761
+ * Which levels this metric can produce values at (default: ["CALL"])
1762
+ */
1763
+ supportedContexts?: Array<'CALL' | 'SEGMENT' | 'TURN'>;
1764
+ }
1765
+
1766
+ export namespace PromptMetricInput {
1767
+ /**
1768
+ * Option for classification metrics.
1769
+ */
1770
+ export interface ClassificationOption {
1771
+ description: string;
1772
+
1773
+ displayOrder: number;
1774
+
1775
+ label: string;
1776
+ }
1777
+
1778
+ export interface ScaleLabel {
1779
+ /**
1780
+ * Display order of this label
1781
+ */
1782
+ displayOrder: number;
1783
+
1784
+ /**
1785
+ * Label for this range
1786
+ */
1787
+ label: string;
1788
+
1789
+ /**
1790
+ * Maximum value for this label range
1791
+ */
1792
+ rangeMax: number;
1793
+
1794
+ /**
1795
+ * Minimum value for this label range
1796
+ */
1797
+ rangeMin: number;
1798
+
1799
+ /**
1800
+ * Hex color code for this label (e.g. "#FF0000")
1801
+ */
1802
+ colorHex?: string;
1803
+
1804
+ /**
1805
+ * Description of what this range means
1806
+ */
1807
+ description?: string;
1808
+ }
1809
+ }
1810
+
1811
+ export interface FormulaMetricInput {
1812
+ /**
1813
+ * Metric computed by evaluating a mathematical expression over other metrics.
1814
+ */
1815
+ calculationType: 'FORMULA';
1816
+
1817
+ /**
1818
+ * Formula expression using `{{id:<uuid>}}` references to source metrics. Operators
1819
+ * depend on output type: +, -, \*, / for NUMERIC; ==, !=, >=, <=, >, < for
1820
+ * BOOLEAN.
1821
+ */
1822
+ formula: string;
1823
+
1824
+ /**
1825
+ * Name of the metric
1826
+ */
1827
+ name: string;
1828
+
1829
+ /**
1830
+ * Output type of the formula. NUMERIC for arithmetic expressions, BOOLEAN for
1831
+ * comparison expressions.
1832
+ */
1833
+ outputType: 'NUMERIC' | 'BOOLEAN';
1834
+
1835
+ /**
1836
+ * Source metrics referenced by the formula. Minimum 2.
1837
+ */
1838
+ sources: Array<FormulaMetricInput.Source>;
1839
+
1840
+ /**
1841
+ * ID of the analysis package to add this metric to. Optional: when omitted, the
1842
+ * metric is added to a default "Custom Metrics" package for your project (created
1843
+ * automatically the first time).
1844
+ */
1845
+ analysisPackageId?: string;
1846
+
1847
+ /**
1848
+ * Alias of `slug` accepted for backwards compatibility. Use `slug` for new
1849
+ * integrations.
1850
+ */
1851
+ metricId?: string;
1852
+
1853
+ /**
1854
+ * Stable slug for the metric. Auto-generated from name if omitted.
1855
+ */
1856
+ slug?: string;
1857
+ }
1858
+
1859
+ export namespace FormulaMetricInput {
1860
+ export interface Source {
1861
+ /**
1862
+ * ID of a metric referenced in the formula
1863
+ */
1864
+ sourceMetricDefinitionId: string;
1865
+
1866
+ /**
1867
+ * Variant of the source metric to use
1868
+ */
1869
+ sourceVariantId?: string;
1870
+ }
1871
+ }
1872
+
1873
+ export interface PatternMetricInput {
1874
+ /**
1875
+ * Metric detecting temporal patterns: a trigger condition followed by an outcome
1876
+ * within a window.
1877
+ */
1878
+ calculationType: 'PATTERN';
1879
+
1880
+ /**
1881
+ * Name of the metric
1882
+ */
1883
+ name: string;
1156
1884
 
1157
1885
  /**
1158
1886
  * Pattern operation. PATTERN_EXISTS produces a BOOLEAN; PATTERN_COUNT produces a
@@ -1266,11 +1994,167 @@ export interface MetricListDefinitionsParams {
1266
1994
  limit?: number;
1267
1995
  }
1268
1996
 
1997
+ export interface MetricUpdateDefinitionParams {
1998
+ analysisPackageId?: unknown;
1999
+
2000
+ /**
2001
+ * New label for the false case (BOOLEAN output only)
2002
+ */
2003
+ booleanFalseLabel?: string;
2004
+
2005
+ /**
2006
+ * New label for the true case (BOOLEAN output only)
2007
+ */
2008
+ booleanTrueLabel?: string;
2009
+
2010
+ calcType?: unknown;
2011
+
2012
+ /**
2013
+ * Optional free-text audit note recorded on the new version.
2014
+ */
2015
+ changeReason?: string;
2016
+
2017
+ /**
2018
+ * Replacement set of classification options (CLASSIFICATION output only)
2019
+ */
2020
+ classificationOptions?: Array<MetricUpdateDefinitionParams.ClassificationOption>;
2021
+
2022
+ /**
2023
+ * New formula expression (FORMULA only). Pass `sources` alongside if the
2024
+ * referenced metrics change.
2025
+ */
2026
+ formula?: string;
2027
+
2028
+ /**
2029
+ * New LLM prompt (only for LLM_JUDGE metrics whose prompt is editable)
2030
+ */
2031
+ llmPrompt?: string;
2032
+
2033
+ /**
2034
+ * New maximum number of classifications (CLASSIFICATION output only)
2035
+ */
2036
+ maxClassifications?: number;
2037
+
2038
+ metricId?: unknown;
2039
+
2040
+ /**
2041
+ * New name (only for metrics whose name is editable)
2042
+ */
2043
+ name?: string;
2044
+
2045
+ organizationId?: unknown;
2046
+
2047
+ outputType?: unknown;
2048
+
2049
+ participantRole?: unknown;
2050
+
2051
+ projectId?: unknown;
2052
+
2053
+ /**
2054
+ * Replacement set of scale-range labels (SCALE output only)
2055
+ */
2056
+ scaleLabels?: Array<MetricUpdateDefinitionParams.ScaleLabel>;
2057
+
2058
+ /**
2059
+ * New scale maximum (SCALE output only)
2060
+ */
2061
+ scaleMax?: number;
2062
+
2063
+ /**
2064
+ * New scale minimum (SCALE output only)
2065
+ */
2066
+ scaleMin?: number;
2067
+
2068
+ scope?: unknown;
2069
+
2070
+ slug?: unknown;
2071
+
2072
+ source?: unknown;
2073
+
2074
+ /**
2075
+ * Replacement formula sources, required when `formula` changes the referenced
2076
+ * metrics (FORMULA only).
2077
+ */
2078
+ sources?: Array<MetricUpdateDefinitionParams.Source>;
2079
+
2080
+ /**
2081
+ * Replacement set of supported contexts. Omit to leave unchanged.
2082
+ */
2083
+ supportedContexts?: Array<'CALL' | 'SEGMENT' | 'TURN'>;
2084
+
2085
+ supportsMultipleVariants?: unknown;
2086
+
2087
+ /**
2088
+ * Replacement set of scoped tool-definition ids (only for metrics whose tool
2089
+ * scoping is editable)
2090
+ */
2091
+ toolDefinitionIds?: Array<string>;
2092
+ }
2093
+
2094
+ export namespace MetricUpdateDefinitionParams {
2095
+ /**
2096
+ * Option for classification metrics.
2097
+ */
2098
+ export interface ClassificationOption {
2099
+ description: string;
2100
+
2101
+ displayOrder: number;
2102
+
2103
+ label: string;
2104
+ }
2105
+
2106
+ export interface ScaleLabel {
2107
+ /**
2108
+ * Display order of this label
2109
+ */
2110
+ displayOrder: number;
2111
+
2112
+ /**
2113
+ * Label for this range
2114
+ */
2115
+ label: string;
2116
+
2117
+ /**
2118
+ * Maximum value for this label range
2119
+ */
2120
+ rangeMax: number;
2121
+
2122
+ /**
2123
+ * Minimum value for this label range
2124
+ */
2125
+ rangeMin: number;
2126
+
2127
+ /**
2128
+ * Hex color code for this label (e.g. "#FF0000")
2129
+ */
2130
+ colorHex?: string;
2131
+
2132
+ /**
2133
+ * Description of what this range means
2134
+ */
2135
+ description?: string;
2136
+ }
2137
+
2138
+ export interface Source {
2139
+ /**
2140
+ * ID of a metric referenced in the formula
2141
+ */
2142
+ sourceMetricDefinitionId: string;
2143
+
2144
+ /**
2145
+ * Variant of the source metric to use
2146
+ */
2147
+ sourceVariantId?: string;
2148
+ }
2149
+ }
2150
+
1269
2151
  export declare namespace Metric {
1270
2152
  export {
1271
2153
  type MetricCreateDefinitionResponse as MetricCreateDefinitionResponse,
1272
2154
  type MetricListDefinitionsResponse as MetricListDefinitionsResponse,
2155
+ type MetricUpdateDefinitionResponse as MetricUpdateDefinitionResponse,
1273
2156
  type MetricCreateDefinitionParams as MetricCreateDefinitionParams,
1274
2157
  type MetricListDefinitionsParams as MetricListDefinitionsParams,
2158
+ type MetricUpdateDefinitionParams as MetricUpdateDefinitionParams,
1275
2159
  };
1276
2160
  }