@roarkanalytics/sdk 3.6.0 → 3.8.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.
- package/CHANGELOG.md +24 -0
- package/client.d.mts +7 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +7 -4
- package/client.d.ts.map +1 -1
- package/client.js +3 -0
- package/client.js.map +1 -1
- package/client.mjs +3 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/call.d.mts +199 -1
- package/resources/call.d.mts.map +1 -1
- package/resources/call.d.ts +199 -1
- package/resources/call.d.ts.map +1 -1
- package/resources/call.js +30 -0
- package/resources/call.js.map +1 -1
- package/resources/call.mjs +30 -0
- package/resources/call.mjs.map +1 -1
- package/resources/config.d.mts +1 -1
- package/resources/config.d.mts.map +1 -1
- package/resources/config.d.ts +1 -1
- package/resources/config.d.ts.map +1 -1
- package/resources/customer-flow.d.mts +17 -2
- package/resources/customer-flow.d.mts.map +1 -1
- package/resources/customer-flow.d.ts +17 -2
- package/resources/customer-flow.d.ts.map +1 -1
- package/resources/index.d.mts +3 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/metric-variant.d.mts +357 -0
- package/resources/metric-variant.d.mts.map +1 -0
- package/resources/metric-variant.d.ts +357 -0
- package/resources/metric-variant.d.ts.map +1 -0
- package/resources/metric-variant.js +112 -0
- package/resources/metric-variant.js.map +1 -0
- package/resources/metric-variant.mjs +108 -0
- package/resources/metric-variant.mjs.map +1 -0
- package/resources/metric.d.mts +662 -1
- package/resources/metric.d.mts.map +1 -1
- package/resources/metric.d.ts +662 -1
- package/resources/metric.d.ts.map +1 -1
- package/resources/metric.js +22 -0
- package/resources/metric.js.map +1 -1
- package/resources/metric.mjs +22 -0
- package/resources/metric.mjs.map +1 -1
- package/resources/simulation-job.d.mts +90 -0
- package/resources/simulation-job.d.mts.map +1 -1
- package/resources/simulation-job.d.ts +90 -0
- package/resources/simulation-job.d.ts.map +1 -1
- package/src/client.ts +35 -0
- package/src/resources/call.ts +236 -0
- package/src/resources/config.ts +1 -0
- package/src/resources/customer-flow.ts +24 -2
- package/src/resources/index.ts +16 -0
- package/src/resources/metric-variant.ts +458 -0
- package/src/resources/metric.ts +972 -132
- package/src/resources/simulation-job.ts +104 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/resources/metric.ts
CHANGED
|
@@ -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 {
|
|
@@ -132,6 +159,16 @@ export namespace MetricCreateDefinitionResponse {
|
|
|
132
159
|
*/
|
|
133
160
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
134
161
|
|
|
162
|
+
/**
|
|
163
|
+
* Whether you can create a variant of this metric with POST
|
|
164
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
165
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
166
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
167
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
168
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
169
|
+
*/
|
|
170
|
+
supportsVariants: boolean;
|
|
171
|
+
|
|
135
172
|
/**
|
|
136
173
|
* Type of value this metric produces
|
|
137
174
|
*/
|
|
@@ -235,6 +272,16 @@ export namespace MetricCreateDefinitionResponse {
|
|
|
235
272
|
*/
|
|
236
273
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
237
274
|
|
|
275
|
+
/**
|
|
276
|
+
* Whether you can create a variant of this metric with POST
|
|
277
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
278
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
279
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
280
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
281
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
282
|
+
*/
|
|
283
|
+
supportsVariants: boolean;
|
|
284
|
+
|
|
238
285
|
/**
|
|
239
286
|
* Type of value this metric produces
|
|
240
287
|
*/
|
|
@@ -355,6 +402,16 @@ export namespace MetricCreateDefinitionResponse {
|
|
|
355
402
|
*/
|
|
356
403
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
357
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Whether you can create a variant of this metric with POST
|
|
407
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
408
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
409
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
410
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
411
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
412
|
+
*/
|
|
413
|
+
supportsVariants: boolean;
|
|
414
|
+
|
|
358
415
|
/**
|
|
359
416
|
* Type of value this metric produces
|
|
360
417
|
*/
|
|
@@ -545,6 +602,16 @@ export namespace MetricListDefinitionsResponse {
|
|
|
545
602
|
*/
|
|
546
603
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
547
604
|
|
|
605
|
+
/**
|
|
606
|
+
* Whether you can create a variant of this metric with POST
|
|
607
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
608
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
609
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
610
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
611
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
612
|
+
*/
|
|
613
|
+
supportsVariants: boolean;
|
|
614
|
+
|
|
548
615
|
/**
|
|
549
616
|
* Type of value this metric produces
|
|
550
617
|
*/
|
|
@@ -643,6 +710,16 @@ export namespace MetricListDefinitionsResponse {
|
|
|
643
710
|
*/
|
|
644
711
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
645
712
|
|
|
713
|
+
/**
|
|
714
|
+
* Whether you can create a variant of this metric with POST
|
|
715
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
716
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
717
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
718
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
719
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
720
|
+
*/
|
|
721
|
+
supportsVariants: boolean;
|
|
722
|
+
|
|
646
723
|
/**
|
|
647
724
|
* Type of value this metric produces
|
|
648
725
|
*/
|
|
@@ -741,6 +818,16 @@ export namespace MetricListDefinitionsResponse {
|
|
|
741
818
|
*/
|
|
742
819
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
743
820
|
|
|
821
|
+
/**
|
|
822
|
+
* Whether you can create a variant of this metric with POST
|
|
823
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
824
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
825
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
826
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
827
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
828
|
+
*/
|
|
829
|
+
supportsVariants: boolean;
|
|
830
|
+
|
|
744
831
|
/**
|
|
745
832
|
* Type of value this metric produces
|
|
746
833
|
*/
|
|
@@ -874,6 +961,16 @@ export namespace MetricListDefinitionsResponse {
|
|
|
874
961
|
*/
|
|
875
962
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
876
963
|
|
|
964
|
+
/**
|
|
965
|
+
* Whether you can create a variant of this metric with POST
|
|
966
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
967
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
968
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
969
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
970
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
971
|
+
*/
|
|
972
|
+
supportsVariants: boolean;
|
|
973
|
+
|
|
877
974
|
/**
|
|
878
975
|
* Type of value this metric produces
|
|
879
976
|
*/
|
|
@@ -994,6 +1091,16 @@ export namespace MetricListDefinitionsResponse {
|
|
|
994
1091
|
*/
|
|
995
1092
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
996
1093
|
|
|
1094
|
+
/**
|
|
1095
|
+
* Whether you can create a variant of this metric with POST
|
|
1096
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
1097
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
1098
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
1099
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
1100
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
1101
|
+
*/
|
|
1102
|
+
supportsVariants: boolean;
|
|
1103
|
+
|
|
997
1104
|
/**
|
|
998
1105
|
* Type of value this metric produces
|
|
999
1106
|
*/
|
|
@@ -1101,238 +1208,815 @@ export namespace MetricListDefinitionsResponse {
|
|
|
1101
1208
|
}
|
|
1102
1209
|
}
|
|
1103
1210
|
|
|
1104
|
-
export
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1211
|
+
export interface MetricUpdateDefinitionResponse {
|
|
1212
|
+
/**
|
|
1213
|
+
* The updated metric definition. The variant is selected by `calculationType`.
|
|
1214
|
+
*/
|
|
1215
|
+
data:
|
|
1216
|
+
| MetricUpdateDefinitionResponse.LlmJudgeMetricResponse
|
|
1217
|
+
| MetricUpdateDefinitionResponse.FormulaMetricResponse
|
|
1218
|
+
| MetricUpdateDefinitionResponse.PatternMetricResponse
|
|
1219
|
+
| MetricUpdateDefinitionResponse.ThresholdMetricResponse;
|
|
1220
|
+
}
|
|
1108
1221
|
|
|
1109
|
-
export
|
|
1110
|
-
export interface
|
|
1222
|
+
export namespace MetricUpdateDefinitionResponse {
|
|
1223
|
+
export interface LlmJudgeMetricResponse {
|
|
1111
1224
|
/**
|
|
1112
|
-
*
|
|
1225
|
+
* Unique identifier for the metric definition
|
|
1113
1226
|
*/
|
|
1114
|
-
|
|
1227
|
+
id: string;
|
|
1115
1228
|
|
|
1116
1229
|
/**
|
|
1117
|
-
*
|
|
1230
|
+
* For a BOOLEAN metric, what a `false` value means. Also given to the judge as its
|
|
1231
|
+
* polarity rule.
|
|
1118
1232
|
*/
|
|
1119
|
-
|
|
1233
|
+
booleanFalseLabel: string | null;
|
|
1120
1234
|
|
|
1121
1235
|
/**
|
|
1122
|
-
*
|
|
1236
|
+
* For a BOOLEAN metric, what a `true` value means. Also given to the judge as its
|
|
1237
|
+
* polarity rule.
|
|
1123
1238
|
*/
|
|
1124
|
-
|
|
1239
|
+
booleanTrueLabel: string | null;
|
|
1125
1240
|
|
|
1126
1241
|
/**
|
|
1127
|
-
*
|
|
1128
|
-
* metric is added to a default "Custom Metrics" package for your project (created
|
|
1129
|
-
* automatically the first time).
|
|
1242
|
+
* Metric evaluated by an LLM against a prompt.
|
|
1130
1243
|
*/
|
|
1131
|
-
|
|
1244
|
+
calculationType: 'LLM_JUDGE';
|
|
1132
1245
|
|
|
1133
1246
|
/**
|
|
1134
|
-
*
|
|
1247
|
+
* Description of what the metric measures
|
|
1135
1248
|
*/
|
|
1136
|
-
|
|
1249
|
+
description: string;
|
|
1137
1250
|
|
|
1138
1251
|
/**
|
|
1139
|
-
*
|
|
1252
|
+
* The rubric this judge applies, as stored. Read it back to confirm which criteria
|
|
1253
|
+
* are live after a create or update.
|
|
1140
1254
|
*/
|
|
1141
|
-
|
|
1255
|
+
llmPrompt: string | null;
|
|
1142
1256
|
|
|
1143
1257
|
/**
|
|
1144
|
-
*
|
|
1258
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
1145
1259
|
*/
|
|
1146
|
-
|
|
1260
|
+
metricId: string;
|
|
1147
1261
|
|
|
1148
1262
|
/**
|
|
1149
|
-
*
|
|
1150
|
-
* TEXT, and SCALE types.
|
|
1263
|
+
* Name of the metric
|
|
1151
1264
|
*/
|
|
1152
|
-
|
|
1265
|
+
name: string;
|
|
1153
1266
|
|
|
1154
1267
|
/**
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
1268
|
+
* True when this metric can only be scored from a live recording
|
|
1269
|
+
* (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
|
|
1270
|
+
* simulation run forces live enrichment: the run waits for your recording and, if
|
|
1271
|
+
* none arrives, the metric produces no value. Check this before a run rather than
|
|
1272
|
+
* discovering the wait afterwards.
|
|
1157
1273
|
*/
|
|
1158
|
-
|
|
1274
|
+
requiresLiveConversation: boolean;
|
|
1159
1275
|
|
|
1160
1276
|
/**
|
|
1161
|
-
*
|
|
1162
|
-
* integrations.
|
|
1277
|
+
* Whether metric is global or per-participant
|
|
1163
1278
|
*/
|
|
1164
|
-
|
|
1279
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
1165
1280
|
|
|
1166
1281
|
/**
|
|
1167
|
-
*
|
|
1282
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
1168
1283
|
*/
|
|
1169
|
-
|
|
1284
|
+
slug: string;
|
|
1170
1285
|
|
|
1171
1286
|
/**
|
|
1172
|
-
*
|
|
1287
|
+
* Which levels this metric can produce values at
|
|
1173
1288
|
*/
|
|
1174
|
-
|
|
1289
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
1175
1290
|
|
|
1176
1291
|
/**
|
|
1177
|
-
*
|
|
1292
|
+
* Which kinds of conversation this metric can be scored on. `null` means both.
|
|
1293
|
+
* `["LIVE"]` marks a metric that can only be scored from your own recording of a
|
|
1294
|
+
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
1178
1295
|
*/
|
|
1179
|
-
|
|
1296
|
+
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
1180
1297
|
|
|
1181
1298
|
/**
|
|
1182
|
-
*
|
|
1299
|
+
* Whether you can create a variant of this metric with POST
|
|
1300
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
1301
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
1302
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
1303
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
1304
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
1183
1305
|
*/
|
|
1184
|
-
|
|
1306
|
+
supportsVariants: boolean;
|
|
1185
1307
|
|
|
1186
1308
|
/**
|
|
1187
|
-
*
|
|
1309
|
+
* Type of value this metric produces
|
|
1188
1310
|
*/
|
|
1189
|
-
|
|
1311
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
1190
1312
|
|
|
1191
1313
|
/**
|
|
1192
|
-
*
|
|
1314
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
1315
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
1316
|
+
* building a derived metric off this one to pin the exact config.
|
|
1193
1317
|
*/
|
|
1194
|
-
|
|
1318
|
+
variantId: string;
|
|
1195
1319
|
|
|
1196
1320
|
/**
|
|
1197
|
-
*
|
|
1321
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
1322
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
1198
1323
|
*/
|
|
1199
|
-
|
|
1200
|
-
}
|
|
1324
|
+
versionId: string;
|
|
1201
1325
|
|
|
1202
|
-
export namespace PromptMetricInput {
|
|
1203
1326
|
/**
|
|
1204
|
-
*
|
|
1327
|
+
* Unit information if applicable
|
|
1205
1328
|
*/
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
displayOrder: number;
|
|
1210
|
-
|
|
1211
|
-
label: string;
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
export interface ScaleLabel {
|
|
1215
|
-
/**
|
|
1216
|
-
* Display order of this label
|
|
1217
|
-
*/
|
|
1218
|
-
displayOrder: number;
|
|
1219
|
-
|
|
1220
|
-
/**
|
|
1221
|
-
* Label for this range
|
|
1222
|
-
*/
|
|
1223
|
-
label: string;
|
|
1224
|
-
|
|
1225
|
-
/**
|
|
1226
|
-
* Maximum value for this label range
|
|
1227
|
-
*/
|
|
1228
|
-
rangeMax: number;
|
|
1229
|
-
|
|
1230
|
-
/**
|
|
1231
|
-
* Minimum value for this label range
|
|
1232
|
-
*/
|
|
1233
|
-
rangeMin: number;
|
|
1329
|
+
unit?: LlmJudgeMetricResponse.Unit;
|
|
1330
|
+
}
|
|
1234
1331
|
|
|
1332
|
+
export namespace LlmJudgeMetricResponse {
|
|
1333
|
+
/**
|
|
1334
|
+
* Unit information if applicable
|
|
1335
|
+
*/
|
|
1336
|
+
export interface Unit {
|
|
1235
1337
|
/**
|
|
1236
|
-
*
|
|
1338
|
+
* Name of the unit
|
|
1237
1339
|
*/
|
|
1238
|
-
|
|
1340
|
+
name: string;
|
|
1239
1341
|
|
|
1240
1342
|
/**
|
|
1241
|
-
*
|
|
1343
|
+
* Symbol for the unit
|
|
1242
1344
|
*/
|
|
1243
|
-
|
|
1345
|
+
symbol: string | null;
|
|
1244
1346
|
}
|
|
1245
1347
|
}
|
|
1246
1348
|
|
|
1247
|
-
export interface
|
|
1349
|
+
export interface FormulaMetricResponse {
|
|
1248
1350
|
/**
|
|
1249
|
-
*
|
|
1351
|
+
* Unique identifier for the metric definition
|
|
1250
1352
|
*/
|
|
1251
|
-
|
|
1353
|
+
id: string;
|
|
1252
1354
|
|
|
1253
1355
|
/**
|
|
1254
|
-
*
|
|
1255
|
-
* depend on output type: +, -, \*, / for NUMERIC; ==, !=, >=, <=, >, < for
|
|
1256
|
-
* BOOLEAN.
|
|
1356
|
+
* Metric computed by evaluating an expression over other metrics.
|
|
1257
1357
|
*/
|
|
1258
|
-
|
|
1358
|
+
calculationType: 'FORMULA';
|
|
1259
1359
|
|
|
1260
1360
|
/**
|
|
1261
|
-
*
|
|
1361
|
+
* Description of what the metric measures
|
|
1262
1362
|
*/
|
|
1263
|
-
|
|
1363
|
+
description: string;
|
|
1264
1364
|
|
|
1265
1365
|
/**
|
|
1266
|
-
*
|
|
1267
|
-
* comparison expressions.
|
|
1366
|
+
* Formula configuration.
|
|
1268
1367
|
*/
|
|
1269
|
-
|
|
1368
|
+
formula: FormulaMetricResponse.Formula;
|
|
1270
1369
|
|
|
1271
1370
|
/**
|
|
1272
|
-
*
|
|
1371
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
1273
1372
|
*/
|
|
1274
|
-
|
|
1373
|
+
metricId: string;
|
|
1275
1374
|
|
|
1276
1375
|
/**
|
|
1277
|
-
*
|
|
1278
|
-
* metric is added to a default "Custom Metrics" package for your project (created
|
|
1279
|
-
* automatically the first time).
|
|
1376
|
+
* Name of the metric
|
|
1280
1377
|
*/
|
|
1281
|
-
|
|
1378
|
+
name: string;
|
|
1282
1379
|
|
|
1283
1380
|
/**
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1381
|
+
* True when this metric can only be scored from a live recording
|
|
1382
|
+
* (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
|
|
1383
|
+
* simulation run forces live enrichment: the run waits for your recording and, if
|
|
1384
|
+
* none arrives, the metric produces no value. Check this before a run rather than
|
|
1385
|
+
* discovering the wait afterwards.
|
|
1286
1386
|
*/
|
|
1287
|
-
|
|
1387
|
+
requiresLiveConversation: boolean;
|
|
1288
1388
|
|
|
1289
1389
|
/**
|
|
1290
|
-
*
|
|
1390
|
+
* Whether metric is global or per-participant
|
|
1291
1391
|
*/
|
|
1292
|
-
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
export namespace FormulaMetricInput {
|
|
1296
|
-
export interface Source {
|
|
1297
|
-
/**
|
|
1298
|
-
* ID of a metric referenced in the formula
|
|
1299
|
-
*/
|
|
1300
|
-
sourceMetricDefinitionId: string;
|
|
1301
|
-
|
|
1302
|
-
/**
|
|
1303
|
-
* Variant of the source metric to use
|
|
1304
|
-
*/
|
|
1305
|
-
sourceVariantId?: string;
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1392
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
1308
1393
|
|
|
1309
|
-
export interface PatternMetricInput {
|
|
1310
1394
|
/**
|
|
1311
|
-
*
|
|
1312
|
-
* within a window.
|
|
1395
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
1313
1396
|
*/
|
|
1314
|
-
|
|
1397
|
+
slug: string;
|
|
1315
1398
|
|
|
1316
1399
|
/**
|
|
1317
|
-
*
|
|
1400
|
+
* Which levels this metric can produce values at
|
|
1318
1401
|
*/
|
|
1319
|
-
|
|
1402
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
1320
1403
|
|
|
1321
1404
|
/**
|
|
1322
|
-
*
|
|
1323
|
-
*
|
|
1405
|
+
* Which kinds of conversation this metric can be scored on. `null` means both.
|
|
1406
|
+
* `["LIVE"]` marks a metric that can only be scored from your own recording of a
|
|
1407
|
+
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
1324
1408
|
*/
|
|
1325
|
-
|
|
1409
|
+
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
1326
1410
|
|
|
1327
1411
|
/**
|
|
1328
|
-
*
|
|
1412
|
+
* Whether you can create a variant of this metric with POST
|
|
1413
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
1414
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
1415
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
1416
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
1417
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
1329
1418
|
*/
|
|
1330
|
-
|
|
1419
|
+
supportsVariants: boolean;
|
|
1331
1420
|
|
|
1332
1421
|
/**
|
|
1333
|
-
*
|
|
1334
|
-
|
|
1335
|
-
|
|
1422
|
+
* Type of value this metric produces
|
|
1423
|
+
*/
|
|
1424
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
1428
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
1429
|
+
* building a derived metric off this one to pin the exact config.
|
|
1430
|
+
*/
|
|
1431
|
+
variantId: string;
|
|
1432
|
+
|
|
1433
|
+
/**
|
|
1434
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
1435
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
1436
|
+
*/
|
|
1437
|
+
versionId: string;
|
|
1438
|
+
|
|
1439
|
+
/**
|
|
1440
|
+
* Unit information if applicable
|
|
1441
|
+
*/
|
|
1442
|
+
unit?: FormulaMetricResponse.Unit;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
export namespace FormulaMetricResponse {
|
|
1446
|
+
/**
|
|
1447
|
+
* Formula configuration.
|
|
1448
|
+
*/
|
|
1449
|
+
export interface Formula {
|
|
1450
|
+
expression: string;
|
|
1451
|
+
|
|
1452
|
+
sources: Array<Formula.Source>;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
export namespace Formula {
|
|
1456
|
+
export interface Source {
|
|
1457
|
+
sourceMetricDefinitionId: string;
|
|
1458
|
+
|
|
1459
|
+
sourceVariantId: string | null;
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
/**
|
|
1464
|
+
* Unit information if applicable
|
|
1465
|
+
*/
|
|
1466
|
+
export interface Unit {
|
|
1467
|
+
/**
|
|
1468
|
+
* Name of the unit
|
|
1469
|
+
*/
|
|
1470
|
+
name: string;
|
|
1471
|
+
|
|
1472
|
+
/**
|
|
1473
|
+
* Symbol for the unit
|
|
1474
|
+
*/
|
|
1475
|
+
symbol: string | null;
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
export interface PatternMetricResponse {
|
|
1480
|
+
/**
|
|
1481
|
+
* Unique identifier for the metric definition
|
|
1482
|
+
*/
|
|
1483
|
+
id: string;
|
|
1484
|
+
|
|
1485
|
+
/**
|
|
1486
|
+
* Metric detecting a trigger condition followed by an outcome within a window.
|
|
1487
|
+
*/
|
|
1488
|
+
calculationType: 'PATTERN';
|
|
1489
|
+
|
|
1490
|
+
/**
|
|
1491
|
+
* Description of what the metric measures
|
|
1492
|
+
*/
|
|
1493
|
+
description: string;
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
1497
|
+
*/
|
|
1498
|
+
metricId: string;
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* Name of the metric
|
|
1502
|
+
*/
|
|
1503
|
+
name: string;
|
|
1504
|
+
|
|
1505
|
+
/**
|
|
1506
|
+
* Pattern configuration.
|
|
1507
|
+
*/
|
|
1508
|
+
pattern: PatternMetricResponse.Pattern;
|
|
1509
|
+
|
|
1510
|
+
/**
|
|
1511
|
+
* True when this metric can only be scored from a live recording
|
|
1512
|
+
* (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
|
|
1513
|
+
* simulation run forces live enrichment: the run waits for your recording and, if
|
|
1514
|
+
* none arrives, the metric produces no value. Check this before a run rather than
|
|
1515
|
+
* discovering the wait afterwards.
|
|
1516
|
+
*/
|
|
1517
|
+
requiresLiveConversation: boolean;
|
|
1518
|
+
|
|
1519
|
+
/**
|
|
1520
|
+
* Whether metric is global or per-participant
|
|
1521
|
+
*/
|
|
1522
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
1523
|
+
|
|
1524
|
+
/**
|
|
1525
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
1526
|
+
*/
|
|
1527
|
+
slug: string;
|
|
1528
|
+
|
|
1529
|
+
/**
|
|
1530
|
+
* Which levels this metric can produce values at
|
|
1531
|
+
*/
|
|
1532
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
1533
|
+
|
|
1534
|
+
/**
|
|
1535
|
+
* Which kinds of conversation this metric can be scored on. `null` means both.
|
|
1536
|
+
* `["LIVE"]` marks a metric that can only be scored from your own recording of a
|
|
1537
|
+
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
1538
|
+
*/
|
|
1539
|
+
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
1540
|
+
|
|
1541
|
+
/**
|
|
1542
|
+
* Whether you can create a variant of this metric with POST
|
|
1543
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
1544
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
1545
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
1546
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
1547
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
1548
|
+
*/
|
|
1549
|
+
supportsVariants: boolean;
|
|
1550
|
+
|
|
1551
|
+
/**
|
|
1552
|
+
* Type of value this metric produces
|
|
1553
|
+
*/
|
|
1554
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
1558
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
1559
|
+
* building a derived metric off this one to pin the exact config.
|
|
1560
|
+
*/
|
|
1561
|
+
variantId: string;
|
|
1562
|
+
|
|
1563
|
+
/**
|
|
1564
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
1565
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
1566
|
+
*/
|
|
1567
|
+
versionId: string;
|
|
1568
|
+
|
|
1569
|
+
/**
|
|
1570
|
+
* Unit information if applicable
|
|
1571
|
+
*/
|
|
1572
|
+
unit?: PatternMetricResponse.Unit;
|
|
1573
|
+
}
|
|
1574
|
+
|
|
1575
|
+
export namespace PatternMetricResponse {
|
|
1576
|
+
/**
|
|
1577
|
+
* Pattern configuration.
|
|
1578
|
+
*/
|
|
1579
|
+
export interface Pattern {
|
|
1580
|
+
operation: 'PATTERN_EXISTS' | 'PATTERN_COUNT' | 'OUTCOME_AGGREGATE';
|
|
1581
|
+
|
|
1582
|
+
outcome: Pattern.Outcome | null;
|
|
1583
|
+
|
|
1584
|
+
triggerCombinator: 'AND' | 'OR' | null;
|
|
1585
|
+
|
|
1586
|
+
triggers: Array<Pattern.Trigger>;
|
|
1587
|
+
|
|
1588
|
+
windowMode: string | null;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
export namespace Pattern {
|
|
1592
|
+
export interface Outcome {
|
|
1593
|
+
operator:
|
|
1594
|
+
| 'GREATER_THAN'
|
|
1595
|
+
| 'GREATER_THAN_OR_EQUALS'
|
|
1596
|
+
| 'LESS_THAN'
|
|
1597
|
+
| 'LESS_THAN_OR_EQUALS'
|
|
1598
|
+
| 'EQUALS'
|
|
1599
|
+
| 'NOT_EQUALS';
|
|
1600
|
+
|
|
1601
|
+
sourceMetricDefinitionId: string;
|
|
1602
|
+
|
|
1603
|
+
sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
|
|
1604
|
+
|
|
1605
|
+
sourceVariantId: string | null;
|
|
1606
|
+
|
|
1607
|
+
thresholdValue: string;
|
|
1608
|
+
|
|
1609
|
+
windowAfter: number | null;
|
|
1610
|
+
|
|
1611
|
+
windowBefore: number | null;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
export interface Trigger {
|
|
1615
|
+
operator:
|
|
1616
|
+
| 'GREATER_THAN'
|
|
1617
|
+
| 'GREATER_THAN_OR_EQUALS'
|
|
1618
|
+
| 'LESS_THAN'
|
|
1619
|
+
| 'LESS_THAN_OR_EQUALS'
|
|
1620
|
+
| 'EQUALS'
|
|
1621
|
+
| 'NOT_EQUALS';
|
|
1622
|
+
|
|
1623
|
+
sourceMetricDefinitionId: string;
|
|
1624
|
+
|
|
1625
|
+
sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
|
|
1626
|
+
|
|
1627
|
+
sourceVariantId: string | null;
|
|
1628
|
+
|
|
1629
|
+
thresholdValue: string;
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
/**
|
|
1634
|
+
* Unit information if applicable
|
|
1635
|
+
*/
|
|
1636
|
+
export interface Unit {
|
|
1637
|
+
/**
|
|
1638
|
+
* Name of the unit
|
|
1639
|
+
*/
|
|
1640
|
+
name: string;
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* Symbol for the unit
|
|
1644
|
+
*/
|
|
1645
|
+
symbol: string | null;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1649
|
+
export interface ThresholdMetricResponse {
|
|
1650
|
+
/**
|
|
1651
|
+
* Unique identifier for the metric definition
|
|
1652
|
+
*/
|
|
1653
|
+
id: string;
|
|
1654
|
+
|
|
1655
|
+
/**
|
|
1656
|
+
* Boolean metric derived by comparing a source metric against a threshold.
|
|
1657
|
+
*/
|
|
1658
|
+
calculationType: 'THRESHOLD';
|
|
1659
|
+
|
|
1660
|
+
/**
|
|
1661
|
+
* Description of what the metric measures
|
|
1662
|
+
*/
|
|
1663
|
+
description: string;
|
|
1664
|
+
|
|
1665
|
+
/**
|
|
1666
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
1667
|
+
*/
|
|
1668
|
+
metricId: string;
|
|
1669
|
+
|
|
1670
|
+
/**
|
|
1671
|
+
* Name of the metric
|
|
1672
|
+
*/
|
|
1673
|
+
name: string;
|
|
1674
|
+
|
|
1675
|
+
/**
|
|
1676
|
+
* True when this metric can only be scored from a live recording
|
|
1677
|
+
* (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
|
|
1678
|
+
* simulation run forces live enrichment: the run waits for your recording and, if
|
|
1679
|
+
* none arrives, the metric produces no value. Check this before a run rather than
|
|
1680
|
+
* discovering the wait afterwards.
|
|
1681
|
+
*/
|
|
1682
|
+
requiresLiveConversation: boolean;
|
|
1683
|
+
|
|
1684
|
+
/**
|
|
1685
|
+
* Whether metric is global or per-participant
|
|
1686
|
+
*/
|
|
1687
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
1688
|
+
|
|
1689
|
+
/**
|
|
1690
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
1691
|
+
*/
|
|
1692
|
+
slug: string;
|
|
1693
|
+
|
|
1694
|
+
/**
|
|
1695
|
+
* Which levels this metric can produce values at
|
|
1696
|
+
*/
|
|
1697
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
1698
|
+
|
|
1699
|
+
/**
|
|
1700
|
+
* Which kinds of conversation this metric can be scored on. `null` means both.
|
|
1701
|
+
* `["LIVE"]` marks a metric that can only be scored from your own recording of a
|
|
1702
|
+
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
1703
|
+
*/
|
|
1704
|
+
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
1705
|
+
|
|
1706
|
+
/**
|
|
1707
|
+
* Whether you can create a variant of this metric with POST
|
|
1708
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
1709
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
1710
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
1711
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
1712
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
1713
|
+
*/
|
|
1714
|
+
supportsVariants: boolean;
|
|
1715
|
+
|
|
1716
|
+
/**
|
|
1717
|
+
* Type of value this metric produces
|
|
1718
|
+
*/
|
|
1719
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
1720
|
+
|
|
1721
|
+
/**
|
|
1722
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
1723
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
1724
|
+
* building a derived metric off this one to pin the exact config.
|
|
1725
|
+
*/
|
|
1726
|
+
variantId: string;
|
|
1727
|
+
|
|
1728
|
+
/**
|
|
1729
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
1730
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
1731
|
+
*/
|
|
1732
|
+
versionId: string;
|
|
1733
|
+
|
|
1734
|
+
/**
|
|
1735
|
+
* Threshold configuration.
|
|
1736
|
+
*/
|
|
1737
|
+
threshold?: ThresholdMetricResponse.Threshold;
|
|
1738
|
+
|
|
1739
|
+
/**
|
|
1740
|
+
* Unit information if applicable
|
|
1741
|
+
*/
|
|
1742
|
+
unit?: ThresholdMetricResponse.Unit;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
export namespace ThresholdMetricResponse {
|
|
1746
|
+
/**
|
|
1747
|
+
* Threshold configuration.
|
|
1748
|
+
*/
|
|
1749
|
+
export interface Threshold {
|
|
1750
|
+
aggregationMode: 'EACH' | 'COUNT' | 'AVERAGE' | 'MIN' | 'MAX' | 'MEDIAN' | 'P95' | 'P99' | 'SUM';
|
|
1751
|
+
|
|
1752
|
+
countThreshold: number | null;
|
|
1753
|
+
|
|
1754
|
+
operator:
|
|
1755
|
+
| 'GREATER_THAN'
|
|
1756
|
+
| 'GREATER_THAN_OR_EQUALS'
|
|
1757
|
+
| 'LESS_THAN'
|
|
1758
|
+
| 'LESS_THAN_OR_EQUALS'
|
|
1759
|
+
| 'EQUALS'
|
|
1760
|
+
| 'NOT_EQUALS';
|
|
1761
|
+
|
|
1762
|
+
sourceMetricDefinitionId: string;
|
|
1763
|
+
|
|
1764
|
+
sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
|
|
1765
|
+
|
|
1766
|
+
sourceVariantId: string | null;
|
|
1767
|
+
|
|
1768
|
+
thresholdValue: string;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
/**
|
|
1772
|
+
* Unit information if applicable
|
|
1773
|
+
*/
|
|
1774
|
+
export interface Unit {
|
|
1775
|
+
/**
|
|
1776
|
+
* Name of the unit
|
|
1777
|
+
*/
|
|
1778
|
+
name: string;
|
|
1779
|
+
|
|
1780
|
+
/**
|
|
1781
|
+
* Symbol for the unit
|
|
1782
|
+
*/
|
|
1783
|
+
symbol: string | null;
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
export type MetricCreateDefinitionParams =
|
|
1789
|
+
| MetricCreateDefinitionParams.PromptMetricInput
|
|
1790
|
+
| MetricCreateDefinitionParams.FormulaMetricInput
|
|
1791
|
+
| MetricCreateDefinitionParams.PatternMetricInput;
|
|
1792
|
+
|
|
1793
|
+
export declare namespace MetricCreateDefinitionParams {
|
|
1794
|
+
export interface PromptMetricInput {
|
|
1795
|
+
/**
|
|
1796
|
+
* LLM-evaluated metric.
|
|
1797
|
+
*/
|
|
1798
|
+
calculationType: 'LLM_JUDGE';
|
|
1799
|
+
|
|
1800
|
+
/**
|
|
1801
|
+
* Name of the metric
|
|
1802
|
+
*/
|
|
1803
|
+
name: string;
|
|
1804
|
+
|
|
1805
|
+
/**
|
|
1806
|
+
* Type of value this metric produces
|
|
1807
|
+
*/
|
|
1808
|
+
outputType: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
1809
|
+
|
|
1810
|
+
/**
|
|
1811
|
+
* ID of the analysis package to add this metric to. Optional: when omitted, the
|
|
1812
|
+
* metric is added to a default "Custom Metrics" package for your project (created
|
|
1813
|
+
* automatically the first time).
|
|
1814
|
+
*/
|
|
1815
|
+
analysisPackageId?: string;
|
|
1816
|
+
|
|
1817
|
+
/**
|
|
1818
|
+
* Label for the false case (only for BOOLEAN type)
|
|
1819
|
+
*/
|
|
1820
|
+
booleanFalseLabel?: string;
|
|
1821
|
+
|
|
1822
|
+
/**
|
|
1823
|
+
* Label for the true case (only for BOOLEAN type)
|
|
1824
|
+
*/
|
|
1825
|
+
booleanTrueLabel?: string;
|
|
1826
|
+
|
|
1827
|
+
/**
|
|
1828
|
+
* Options for classification. Required for CLASSIFICATION type.
|
|
1829
|
+
*/
|
|
1830
|
+
classificationOptions?: Array<PromptMetricInput.ClassificationOption>;
|
|
1831
|
+
|
|
1832
|
+
/**
|
|
1833
|
+
* LLM prompt/criteria for evaluating this metric. Required for BOOLEAN, NUMERIC,
|
|
1834
|
+
* TEXT, and SCALE types.
|
|
1835
|
+
*/
|
|
1836
|
+
llmPrompt?: string;
|
|
1837
|
+
|
|
1838
|
+
/**
|
|
1839
|
+
* Maximum number of classifications that can be selected (only for CLASSIFICATION
|
|
1840
|
+
* type)
|
|
1841
|
+
*/
|
|
1842
|
+
maxClassifications?: number;
|
|
1843
|
+
|
|
1844
|
+
/**
|
|
1845
|
+
* Alias of `slug` accepted for backwards compatibility. Use `slug` for new
|
|
1846
|
+
* integrations.
|
|
1847
|
+
*/
|
|
1848
|
+
metricId?: string;
|
|
1849
|
+
|
|
1850
|
+
/**
|
|
1851
|
+
* Participant role to evaluate. Required when scope is PER_PARTICIPANT.
|
|
1852
|
+
*/
|
|
1853
|
+
participantRole?: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER';
|
|
1854
|
+
|
|
1855
|
+
/**
|
|
1856
|
+
* Labels for scale ranges (only for SCALE type)
|
|
1857
|
+
*/
|
|
1858
|
+
scaleLabels?: Array<PromptMetricInput.ScaleLabel>;
|
|
1859
|
+
|
|
1860
|
+
/**
|
|
1861
|
+
* Maximum value for scale. Required for SCALE type.
|
|
1862
|
+
*/
|
|
1863
|
+
scaleMax?: number;
|
|
1864
|
+
|
|
1865
|
+
/**
|
|
1866
|
+
* Minimum value for scale. Required for SCALE type.
|
|
1867
|
+
*/
|
|
1868
|
+
scaleMin?: number;
|
|
1869
|
+
|
|
1870
|
+
/**
|
|
1871
|
+
* Whether metric is global or per-participant (default: GLOBAL)
|
|
1872
|
+
*/
|
|
1873
|
+
scope?: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* Stable slug for the metric. Auto-generated from name if omitted.
|
|
1877
|
+
*/
|
|
1878
|
+
slug?: string;
|
|
1879
|
+
|
|
1880
|
+
/**
|
|
1881
|
+
* Which levels this metric can produce values at (default: ["CALL"])
|
|
1882
|
+
*/
|
|
1883
|
+
supportedContexts?: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
export namespace PromptMetricInput {
|
|
1887
|
+
/**
|
|
1888
|
+
* Option for classification metrics.
|
|
1889
|
+
*/
|
|
1890
|
+
export interface ClassificationOption {
|
|
1891
|
+
description: string;
|
|
1892
|
+
|
|
1893
|
+
displayOrder: number;
|
|
1894
|
+
|
|
1895
|
+
label: string;
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
export interface ScaleLabel {
|
|
1899
|
+
/**
|
|
1900
|
+
* Display order of this label
|
|
1901
|
+
*/
|
|
1902
|
+
displayOrder: number;
|
|
1903
|
+
|
|
1904
|
+
/**
|
|
1905
|
+
* Label for this range
|
|
1906
|
+
*/
|
|
1907
|
+
label: string;
|
|
1908
|
+
|
|
1909
|
+
/**
|
|
1910
|
+
* Maximum value for this label range
|
|
1911
|
+
*/
|
|
1912
|
+
rangeMax: number;
|
|
1913
|
+
|
|
1914
|
+
/**
|
|
1915
|
+
* Minimum value for this label range
|
|
1916
|
+
*/
|
|
1917
|
+
rangeMin: number;
|
|
1918
|
+
|
|
1919
|
+
/**
|
|
1920
|
+
* Hex color code for this label (e.g. "#FF0000")
|
|
1921
|
+
*/
|
|
1922
|
+
colorHex?: string;
|
|
1923
|
+
|
|
1924
|
+
/**
|
|
1925
|
+
* Description of what this range means
|
|
1926
|
+
*/
|
|
1927
|
+
description?: string;
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
export interface FormulaMetricInput {
|
|
1932
|
+
/**
|
|
1933
|
+
* Metric computed by evaluating a mathematical expression over other metrics.
|
|
1934
|
+
*/
|
|
1935
|
+
calculationType: 'FORMULA';
|
|
1936
|
+
|
|
1937
|
+
/**
|
|
1938
|
+
* Formula expression using `{{id:<uuid>}}` references to source metrics. Operators
|
|
1939
|
+
* depend on output type: +, -, \*, / for NUMERIC; ==, !=, >=, <=, >, < for
|
|
1940
|
+
* BOOLEAN.
|
|
1941
|
+
*/
|
|
1942
|
+
formula: string;
|
|
1943
|
+
|
|
1944
|
+
/**
|
|
1945
|
+
* Name of the metric
|
|
1946
|
+
*/
|
|
1947
|
+
name: string;
|
|
1948
|
+
|
|
1949
|
+
/**
|
|
1950
|
+
* Output type of the formula. NUMERIC for arithmetic expressions, BOOLEAN for
|
|
1951
|
+
* comparison expressions.
|
|
1952
|
+
*/
|
|
1953
|
+
outputType: 'NUMERIC' | 'BOOLEAN';
|
|
1954
|
+
|
|
1955
|
+
/**
|
|
1956
|
+
* Source metrics referenced by the formula. Minimum 2.
|
|
1957
|
+
*/
|
|
1958
|
+
sources: Array<FormulaMetricInput.Source>;
|
|
1959
|
+
|
|
1960
|
+
/**
|
|
1961
|
+
* ID of the analysis package to add this metric to. Optional: when omitted, the
|
|
1962
|
+
* metric is added to a default "Custom Metrics" package for your project (created
|
|
1963
|
+
* automatically the first time).
|
|
1964
|
+
*/
|
|
1965
|
+
analysisPackageId?: string;
|
|
1966
|
+
|
|
1967
|
+
/**
|
|
1968
|
+
* Alias of `slug` accepted for backwards compatibility. Use `slug` for new
|
|
1969
|
+
* integrations.
|
|
1970
|
+
*/
|
|
1971
|
+
metricId?: string;
|
|
1972
|
+
|
|
1973
|
+
/**
|
|
1974
|
+
* Stable slug for the metric. Auto-generated from name if omitted.
|
|
1975
|
+
*/
|
|
1976
|
+
slug?: string;
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
export namespace FormulaMetricInput {
|
|
1980
|
+
export interface Source {
|
|
1981
|
+
/**
|
|
1982
|
+
* ID of a metric referenced in the formula
|
|
1983
|
+
*/
|
|
1984
|
+
sourceMetricDefinitionId: string;
|
|
1985
|
+
|
|
1986
|
+
/**
|
|
1987
|
+
* Variant of the source metric to use
|
|
1988
|
+
*/
|
|
1989
|
+
sourceVariantId?: string;
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
export interface PatternMetricInput {
|
|
1994
|
+
/**
|
|
1995
|
+
* Metric detecting temporal patterns: a trigger condition followed by an outcome
|
|
1996
|
+
* within a window.
|
|
1997
|
+
*/
|
|
1998
|
+
calculationType: 'PATTERN';
|
|
1999
|
+
|
|
2000
|
+
/**
|
|
2001
|
+
* Name of the metric
|
|
2002
|
+
*/
|
|
2003
|
+
name: string;
|
|
2004
|
+
|
|
2005
|
+
/**
|
|
2006
|
+
* Pattern operation. PATTERN_EXISTS produces a BOOLEAN; PATTERN_COUNT produces a
|
|
2007
|
+
* NUMERIC count; OUTCOME_AGGREGATE aggregates a numeric outcome.
|
|
2008
|
+
*/
|
|
2009
|
+
operation: 'PATTERN_EXISTS' | 'PATTERN_COUNT' | 'OUTCOME_AGGREGATE';
|
|
2010
|
+
|
|
2011
|
+
/**
|
|
2012
|
+
* Outcome condition evaluated within the window relative to the trigger.
|
|
2013
|
+
*/
|
|
2014
|
+
outcome: PatternMetricInput.Outcome;
|
|
2015
|
+
|
|
2016
|
+
/**
|
|
2017
|
+
* ID of the analysis package to add this metric to. Optional: when omitted, the
|
|
2018
|
+
* metric is added to a default "Custom Metrics" package for your project (created
|
|
2019
|
+
* automatically the first time).
|
|
1336
2020
|
*/
|
|
1337
2021
|
analysisPackageId?: string;
|
|
1338
2022
|
|
|
@@ -1430,11 +2114,167 @@ export interface MetricListDefinitionsParams {
|
|
|
1430
2114
|
limit?: number;
|
|
1431
2115
|
}
|
|
1432
2116
|
|
|
2117
|
+
export interface MetricUpdateDefinitionParams {
|
|
2118
|
+
analysisPackageId?: unknown;
|
|
2119
|
+
|
|
2120
|
+
/**
|
|
2121
|
+
* New label for the false case (BOOLEAN output only)
|
|
2122
|
+
*/
|
|
2123
|
+
booleanFalseLabel?: string;
|
|
2124
|
+
|
|
2125
|
+
/**
|
|
2126
|
+
* New label for the true case (BOOLEAN output only)
|
|
2127
|
+
*/
|
|
2128
|
+
booleanTrueLabel?: string;
|
|
2129
|
+
|
|
2130
|
+
calcType?: unknown;
|
|
2131
|
+
|
|
2132
|
+
/**
|
|
2133
|
+
* Optional free-text audit note recorded on the new version.
|
|
2134
|
+
*/
|
|
2135
|
+
changeReason?: string;
|
|
2136
|
+
|
|
2137
|
+
/**
|
|
2138
|
+
* Replacement set of classification options (CLASSIFICATION output only)
|
|
2139
|
+
*/
|
|
2140
|
+
classificationOptions?: Array<MetricUpdateDefinitionParams.ClassificationOption>;
|
|
2141
|
+
|
|
2142
|
+
/**
|
|
2143
|
+
* New formula expression (FORMULA only). Pass `sources` alongside if the
|
|
2144
|
+
* referenced metrics change.
|
|
2145
|
+
*/
|
|
2146
|
+
formula?: string;
|
|
2147
|
+
|
|
2148
|
+
/**
|
|
2149
|
+
* New LLM prompt (only for LLM_JUDGE metrics whose prompt is editable)
|
|
2150
|
+
*/
|
|
2151
|
+
llmPrompt?: string;
|
|
2152
|
+
|
|
2153
|
+
/**
|
|
2154
|
+
* New maximum number of classifications (CLASSIFICATION output only)
|
|
2155
|
+
*/
|
|
2156
|
+
maxClassifications?: number;
|
|
2157
|
+
|
|
2158
|
+
metricId?: unknown;
|
|
2159
|
+
|
|
2160
|
+
/**
|
|
2161
|
+
* New name (only for metrics whose name is editable)
|
|
2162
|
+
*/
|
|
2163
|
+
name?: string;
|
|
2164
|
+
|
|
2165
|
+
organizationId?: unknown;
|
|
2166
|
+
|
|
2167
|
+
outputType?: unknown;
|
|
2168
|
+
|
|
2169
|
+
participantRole?: unknown;
|
|
2170
|
+
|
|
2171
|
+
projectId?: unknown;
|
|
2172
|
+
|
|
2173
|
+
/**
|
|
2174
|
+
* Replacement set of scale-range labels (SCALE output only)
|
|
2175
|
+
*/
|
|
2176
|
+
scaleLabels?: Array<MetricUpdateDefinitionParams.ScaleLabel>;
|
|
2177
|
+
|
|
2178
|
+
/**
|
|
2179
|
+
* New scale maximum (SCALE output only)
|
|
2180
|
+
*/
|
|
2181
|
+
scaleMax?: number;
|
|
2182
|
+
|
|
2183
|
+
/**
|
|
2184
|
+
* New scale minimum (SCALE output only)
|
|
2185
|
+
*/
|
|
2186
|
+
scaleMin?: number;
|
|
2187
|
+
|
|
2188
|
+
scope?: unknown;
|
|
2189
|
+
|
|
2190
|
+
slug?: unknown;
|
|
2191
|
+
|
|
2192
|
+
source?: unknown;
|
|
2193
|
+
|
|
2194
|
+
/**
|
|
2195
|
+
* Replacement formula sources, required when `formula` changes the referenced
|
|
2196
|
+
* metrics (FORMULA only).
|
|
2197
|
+
*/
|
|
2198
|
+
sources?: Array<MetricUpdateDefinitionParams.Source>;
|
|
2199
|
+
|
|
2200
|
+
/**
|
|
2201
|
+
* Replacement set of supported contexts. Omit to leave unchanged.
|
|
2202
|
+
*/
|
|
2203
|
+
supportedContexts?: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
2204
|
+
|
|
2205
|
+
supportsMultipleVariants?: unknown;
|
|
2206
|
+
|
|
2207
|
+
/**
|
|
2208
|
+
* Replacement set of scoped tool-definition ids (only for metrics whose tool
|
|
2209
|
+
* scoping is editable)
|
|
2210
|
+
*/
|
|
2211
|
+
toolDefinitionIds?: Array<string>;
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
export namespace MetricUpdateDefinitionParams {
|
|
2215
|
+
/**
|
|
2216
|
+
* Option for classification metrics.
|
|
2217
|
+
*/
|
|
2218
|
+
export interface ClassificationOption {
|
|
2219
|
+
description: string;
|
|
2220
|
+
|
|
2221
|
+
displayOrder: number;
|
|
2222
|
+
|
|
2223
|
+
label: string;
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
export interface ScaleLabel {
|
|
2227
|
+
/**
|
|
2228
|
+
* Display order of this label
|
|
2229
|
+
*/
|
|
2230
|
+
displayOrder: number;
|
|
2231
|
+
|
|
2232
|
+
/**
|
|
2233
|
+
* Label for this range
|
|
2234
|
+
*/
|
|
2235
|
+
label: string;
|
|
2236
|
+
|
|
2237
|
+
/**
|
|
2238
|
+
* Maximum value for this label range
|
|
2239
|
+
*/
|
|
2240
|
+
rangeMax: number;
|
|
2241
|
+
|
|
2242
|
+
/**
|
|
2243
|
+
* Minimum value for this label range
|
|
2244
|
+
*/
|
|
2245
|
+
rangeMin: number;
|
|
2246
|
+
|
|
2247
|
+
/**
|
|
2248
|
+
* Hex color code for this label (e.g. "#FF0000")
|
|
2249
|
+
*/
|
|
2250
|
+
colorHex?: string;
|
|
2251
|
+
|
|
2252
|
+
/**
|
|
2253
|
+
* Description of what this range means
|
|
2254
|
+
*/
|
|
2255
|
+
description?: string;
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
export interface Source {
|
|
2259
|
+
/**
|
|
2260
|
+
* ID of a metric referenced in the formula
|
|
2261
|
+
*/
|
|
2262
|
+
sourceMetricDefinitionId: string;
|
|
2263
|
+
|
|
2264
|
+
/**
|
|
2265
|
+
* Variant of the source metric to use
|
|
2266
|
+
*/
|
|
2267
|
+
sourceVariantId?: string;
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
|
|
1433
2271
|
export declare namespace Metric {
|
|
1434
2272
|
export {
|
|
1435
2273
|
type MetricCreateDefinitionResponse as MetricCreateDefinitionResponse,
|
|
1436
2274
|
type MetricListDefinitionsResponse as MetricListDefinitionsResponse,
|
|
2275
|
+
type MetricUpdateDefinitionResponse as MetricUpdateDefinitionResponse,
|
|
1437
2276
|
type MetricCreateDefinitionParams as MetricCreateDefinitionParams,
|
|
1438
2277
|
type MetricListDefinitionsParams as MetricListDefinitionsParams,
|
|
2278
|
+
type MetricUpdateDefinitionParams as MetricUpdateDefinitionParams,
|
|
1439
2279
|
};
|
|
1440
2280
|
}
|