@roarkanalytics/sdk 3.6.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -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 +554 -1
- package/resources/metric.d.mts.map +1 -1
- package/resources/metric.d.ts +554 -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 +864 -144
- 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 {
|
|
@@ -1101,261 +1128,798 @@ export namespace MetricListDefinitionsResponse {
|
|
|
1101
1128
|
}
|
|
1102
1129
|
}
|
|
1103
1130
|
|
|
1104
|
-
export
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
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
|
+
}
|
|
1108
1141
|
|
|
1109
|
-
export
|
|
1110
|
-
export interface
|
|
1142
|
+
export namespace MetricUpdateDefinitionResponse {
|
|
1143
|
+
export interface LlmJudgeMetricResponse {
|
|
1111
1144
|
/**
|
|
1112
|
-
*
|
|
1145
|
+
* Unique identifier for the metric definition
|
|
1113
1146
|
*/
|
|
1114
|
-
|
|
1147
|
+
id: string;
|
|
1115
1148
|
|
|
1116
1149
|
/**
|
|
1117
|
-
*
|
|
1150
|
+
* For a BOOLEAN metric, what a `false` value means. Also given to the judge as its
|
|
1151
|
+
* polarity rule.
|
|
1118
1152
|
*/
|
|
1119
|
-
|
|
1153
|
+
booleanFalseLabel: string | null;
|
|
1120
1154
|
|
|
1121
1155
|
/**
|
|
1122
|
-
*
|
|
1156
|
+
* For a BOOLEAN metric, what a `true` value means. Also given to the judge as its
|
|
1157
|
+
* polarity rule.
|
|
1123
1158
|
*/
|
|
1124
|
-
|
|
1159
|
+
booleanTrueLabel: string | null;
|
|
1125
1160
|
|
|
1126
1161
|
/**
|
|
1127
|
-
*
|
|
1128
|
-
* metric is added to a default "Custom Metrics" package for your project (created
|
|
1129
|
-
* automatically the first time).
|
|
1162
|
+
* Metric evaluated by an LLM against a prompt.
|
|
1130
1163
|
*/
|
|
1131
|
-
|
|
1164
|
+
calculationType: 'LLM_JUDGE';
|
|
1132
1165
|
|
|
1133
1166
|
/**
|
|
1134
|
-
*
|
|
1167
|
+
* Description of what the metric measures
|
|
1135
1168
|
*/
|
|
1136
|
-
|
|
1169
|
+
description: string;
|
|
1137
1170
|
|
|
1138
1171
|
/**
|
|
1139
|
-
*
|
|
1172
|
+
* The rubric this judge applies, as stored. Read it back to confirm which criteria
|
|
1173
|
+
* are live after a create or update.
|
|
1140
1174
|
*/
|
|
1141
|
-
|
|
1175
|
+
llmPrompt: string | null;
|
|
1142
1176
|
|
|
1143
1177
|
/**
|
|
1144
|
-
*
|
|
1178
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
1145
1179
|
*/
|
|
1146
|
-
|
|
1180
|
+
metricId: string;
|
|
1147
1181
|
|
|
1148
1182
|
/**
|
|
1149
|
-
*
|
|
1150
|
-
* TEXT, and SCALE types.
|
|
1183
|
+
* Name of the metric
|
|
1151
1184
|
*/
|
|
1152
|
-
|
|
1185
|
+
name: string;
|
|
1153
1186
|
|
|
1154
1187
|
/**
|
|
1155
|
-
*
|
|
1156
|
-
*
|
|
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.
|
|
1157
1193
|
*/
|
|
1158
|
-
|
|
1194
|
+
requiresLiveConversation: boolean;
|
|
1159
1195
|
|
|
1160
1196
|
/**
|
|
1161
|
-
*
|
|
1162
|
-
* integrations.
|
|
1197
|
+
* Whether metric is global or per-participant
|
|
1163
1198
|
*/
|
|
1164
|
-
|
|
1199
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
1165
1200
|
|
|
1166
1201
|
/**
|
|
1167
|
-
*
|
|
1202
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
1168
1203
|
*/
|
|
1169
|
-
|
|
1204
|
+
slug: string;
|
|
1170
1205
|
|
|
1171
1206
|
/**
|
|
1172
|
-
*
|
|
1207
|
+
* Which levels this metric can produce values at
|
|
1173
1208
|
*/
|
|
1174
|
-
|
|
1209
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
1175
1210
|
|
|
1176
1211
|
/**
|
|
1177
|
-
*
|
|
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.
|
|
1178
1215
|
*/
|
|
1179
|
-
|
|
1216
|
+
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
1180
1217
|
|
|
1181
1218
|
/**
|
|
1182
|
-
*
|
|
1219
|
+
* Type of value this metric produces
|
|
1183
1220
|
*/
|
|
1184
|
-
|
|
1221
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
1185
1222
|
|
|
1186
1223
|
/**
|
|
1187
|
-
*
|
|
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.
|
|
1188
1227
|
*/
|
|
1189
|
-
|
|
1228
|
+
variantId: string;
|
|
1190
1229
|
|
|
1191
1230
|
/**
|
|
1192
|
-
*
|
|
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.
|
|
1193
1233
|
*/
|
|
1194
|
-
|
|
1234
|
+
versionId: string;
|
|
1195
1235
|
|
|
1196
1236
|
/**
|
|
1197
|
-
*
|
|
1237
|
+
* Unit information if applicable
|
|
1198
1238
|
*/
|
|
1199
|
-
|
|
1239
|
+
unit?: LlmJudgeMetricResponse.Unit;
|
|
1200
1240
|
}
|
|
1201
1241
|
|
|
1202
|
-
export namespace
|
|
1242
|
+
export namespace LlmJudgeMetricResponse {
|
|
1203
1243
|
/**
|
|
1204
|
-
*
|
|
1244
|
+
* Unit information if applicable
|
|
1205
1245
|
*/
|
|
1206
|
-
export interface
|
|
1207
|
-
description: string;
|
|
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;
|
|
1234
|
-
|
|
1246
|
+
export interface Unit {
|
|
1235
1247
|
/**
|
|
1236
|
-
*
|
|
1248
|
+
* Name of the unit
|
|
1237
1249
|
*/
|
|
1238
|
-
|
|
1250
|
+
name: string;
|
|
1239
1251
|
|
|
1240
1252
|
/**
|
|
1241
|
-
*
|
|
1253
|
+
* Symbol for the unit
|
|
1242
1254
|
*/
|
|
1243
|
-
|
|
1255
|
+
symbol: string | null;
|
|
1244
1256
|
}
|
|
1245
1257
|
}
|
|
1246
1258
|
|
|
1247
|
-
export interface
|
|
1259
|
+
export interface FormulaMetricResponse {
|
|
1248
1260
|
/**
|
|
1249
|
-
*
|
|
1261
|
+
* Unique identifier for the metric definition
|
|
1250
1262
|
*/
|
|
1251
|
-
|
|
1263
|
+
id: string;
|
|
1252
1264
|
|
|
1253
1265
|
/**
|
|
1254
|
-
*
|
|
1255
|
-
* depend on output type: +, -, \*, / for NUMERIC; ==, !=, >=, <=, >, < for
|
|
1256
|
-
* BOOLEAN.
|
|
1266
|
+
* Metric computed by evaluating an expression over other metrics.
|
|
1257
1267
|
*/
|
|
1258
|
-
|
|
1268
|
+
calculationType: 'FORMULA';
|
|
1259
1269
|
|
|
1260
1270
|
/**
|
|
1261
|
-
*
|
|
1271
|
+
* Description of what the metric measures
|
|
1262
1272
|
*/
|
|
1263
|
-
|
|
1273
|
+
description: string;
|
|
1264
1274
|
|
|
1265
1275
|
/**
|
|
1266
|
-
*
|
|
1267
|
-
* comparison expressions.
|
|
1276
|
+
* Formula configuration.
|
|
1268
1277
|
*/
|
|
1269
|
-
|
|
1278
|
+
formula: FormulaMetricResponse.Formula;
|
|
1270
1279
|
|
|
1271
1280
|
/**
|
|
1272
|
-
*
|
|
1281
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
1273
1282
|
*/
|
|
1274
|
-
|
|
1283
|
+
metricId: string;
|
|
1275
1284
|
|
|
1276
1285
|
/**
|
|
1277
|
-
*
|
|
1278
|
-
* metric is added to a default "Custom Metrics" package for your project (created
|
|
1279
|
-
* automatically the first time).
|
|
1286
|
+
* Name of the metric
|
|
1280
1287
|
*/
|
|
1281
|
-
|
|
1288
|
+
name: string;
|
|
1282
1289
|
|
|
1283
1290
|
/**
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
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.
|
|
1286
1296
|
*/
|
|
1287
|
-
|
|
1297
|
+
requiresLiveConversation: boolean;
|
|
1288
1298
|
|
|
1289
1299
|
/**
|
|
1290
|
-
*
|
|
1300
|
+
* Whether metric is global or per-participant
|
|
1291
1301
|
*/
|
|
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
|
-
}
|
|
1302
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
1308
1303
|
|
|
1309
|
-
export interface PatternMetricInput {
|
|
1310
1304
|
/**
|
|
1311
|
-
*
|
|
1312
|
-
* within a window.
|
|
1305
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
1313
1306
|
*/
|
|
1314
|
-
|
|
1307
|
+
slug: string;
|
|
1315
1308
|
|
|
1316
1309
|
/**
|
|
1317
|
-
*
|
|
1310
|
+
* Which levels this metric can produce values at
|
|
1318
1311
|
*/
|
|
1319
|
-
|
|
1312
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
1320
1313
|
|
|
1321
1314
|
/**
|
|
1322
|
-
*
|
|
1323
|
-
*
|
|
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.
|
|
1324
1318
|
*/
|
|
1325
|
-
|
|
1319
|
+
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
1326
1320
|
|
|
1327
1321
|
/**
|
|
1328
|
-
*
|
|
1322
|
+
* Type of value this metric produces
|
|
1329
1323
|
*/
|
|
1330
|
-
|
|
1324
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
1331
1325
|
|
|
1332
1326
|
/**
|
|
1333
|
-
*
|
|
1334
|
-
*
|
|
1335
|
-
*
|
|
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.
|
|
1336
1330
|
*/
|
|
1337
|
-
|
|
1331
|
+
variantId: string;
|
|
1338
1332
|
|
|
1339
1333
|
/**
|
|
1340
|
-
*
|
|
1341
|
-
*
|
|
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.
|
|
1342
1336
|
*/
|
|
1343
|
-
|
|
1337
|
+
versionId: string;
|
|
1344
1338
|
|
|
1345
1339
|
/**
|
|
1346
|
-
*
|
|
1340
|
+
* Unit information if applicable
|
|
1347
1341
|
*/
|
|
1348
|
-
|
|
1342
|
+
unit?: FormulaMetricResponse.Unit;
|
|
1343
|
+
}
|
|
1349
1344
|
|
|
1345
|
+
export namespace FormulaMetricResponse {
|
|
1350
1346
|
/**
|
|
1351
|
-
*
|
|
1347
|
+
* Formula configuration.
|
|
1352
1348
|
*/
|
|
1353
|
-
|
|
1349
|
+
export interface Formula {
|
|
1350
|
+
expression: string;
|
|
1354
1351
|
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
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;
|
|
1884
|
+
|
|
1885
|
+
/**
|
|
1886
|
+
* Pattern operation. PATTERN_EXISTS produces a BOOLEAN; PATTERN_COUNT produces a
|
|
1887
|
+
* NUMERIC count; OUTCOME_AGGREGATE aggregates a numeric outcome.
|
|
1888
|
+
*/
|
|
1889
|
+
operation: 'PATTERN_EXISTS' | 'PATTERN_COUNT' | 'OUTCOME_AGGREGATE';
|
|
1890
|
+
|
|
1891
|
+
/**
|
|
1892
|
+
* Outcome condition evaluated within the window relative to the trigger.
|
|
1893
|
+
*/
|
|
1894
|
+
outcome: PatternMetricInput.Outcome;
|
|
1895
|
+
|
|
1896
|
+
/**
|
|
1897
|
+
* ID of the analysis package to add this metric to. Optional: when omitted, the
|
|
1898
|
+
* metric is added to a default "Custom Metrics" package for your project (created
|
|
1899
|
+
* automatically the first time).
|
|
1900
|
+
*/
|
|
1901
|
+
analysisPackageId?: string;
|
|
1902
|
+
|
|
1903
|
+
/**
|
|
1904
|
+
* Alias of `slug` accepted for backwards compatibility. Use `slug` for new
|
|
1905
|
+
* integrations.
|
|
1906
|
+
*/
|
|
1907
|
+
metricId?: string;
|
|
1908
|
+
|
|
1909
|
+
/**
|
|
1910
|
+
* Stable slug for the metric. Auto-generated from name if omitted.
|
|
1911
|
+
*/
|
|
1912
|
+
slug?: string;
|
|
1913
|
+
|
|
1914
|
+
/**
|
|
1915
|
+
* Single trigger condition. Use either trigger or triggers + triggerCombinator.
|
|
1916
|
+
*/
|
|
1917
|
+
trigger?: PatternMetricInput.Trigger;
|
|
1918
|
+
|
|
1919
|
+
/**
|
|
1920
|
+
* How to combine multiple triggers. Required when triggers has more than 1 entry.
|
|
1921
|
+
*/
|
|
1922
|
+
triggerCombinator?: 'AND' | 'OR';
|
|
1359
1923
|
|
|
1360
1924
|
/**
|
|
1361
1925
|
* Multiple trigger conditions. Use with triggerCombinator.
|
|
@@ -1430,11 +1994,167 @@ export interface MetricListDefinitionsParams {
|
|
|
1430
1994
|
limit?: number;
|
|
1431
1995
|
}
|
|
1432
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
|
+
|
|
1433
2151
|
export declare namespace Metric {
|
|
1434
2152
|
export {
|
|
1435
2153
|
type MetricCreateDefinitionResponse as MetricCreateDefinitionResponse,
|
|
1436
2154
|
type MetricListDefinitionsResponse as MetricListDefinitionsResponse,
|
|
2155
|
+
type MetricUpdateDefinitionResponse as MetricUpdateDefinitionResponse,
|
|
1437
2156
|
type MetricCreateDefinitionParams as MetricCreateDefinitionParams,
|
|
1438
2157
|
type MetricListDefinitionsParams as MetricListDefinitionsParams,
|
|
2158
|
+
type MetricUpdateDefinitionParams as MetricUpdateDefinitionParams,
|
|
1439
2159
|
};
|
|
1440
2160
|
}
|