@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/resources/metric.d.ts
CHANGED
|
@@ -30,6 +30,25 @@ export declare class Metric extends APIResource {
|
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
listDefinitions(query?: MetricListDefinitionsParams | null | undefined, options?: RequestOptions): APIPromise<MetricListDefinitionsResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Update the editable subset of a custom metric definition, addressed by its UUID
|
|
35
|
+
* or its stable `slug`. Only the supplied fields are changed; omitted fields are
|
|
36
|
+
* left unchanged. Every update creates a new immutable version; the response
|
|
37
|
+
* carries the advanced `versionId`. Immutable fields (scope, outputType, calcType,
|
|
38
|
+
* …) are rejected, and which fields are editable depends on the metric (e.g.
|
|
39
|
+
* derived metrics only allow `name`). Roark's own metrics are rejected here: this
|
|
40
|
+
* endpoint edits the shared definition, which every workspace sees. To change one
|
|
41
|
+
* for your workspace alone, edit its variant with PUT
|
|
42
|
+
* /v1/metric/definitions/{idOrSlug}/variants/{variantId}, which forks it for you
|
|
43
|
+
* and leaves every other workspace on the original.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const response =
|
|
48
|
+
* await client.metric.updateDefinition('idOrSlug');
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
updateDefinition(idOrSlug: string, body?: MetricUpdateDefinitionParams | null | undefined, options?: RequestOptions): APIPromise<MetricUpdateDefinitionResponse>;
|
|
33
52
|
}
|
|
34
53
|
export interface MetricCreateDefinitionResponse {
|
|
35
54
|
/**
|
|
@@ -100,6 +119,15 @@ export declare namespace MetricCreateDefinitionResponse {
|
|
|
100
119
|
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
101
120
|
*/
|
|
102
121
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
122
|
+
/**
|
|
123
|
+
* Whether you can create a variant of this metric with POST
|
|
124
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
125
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
126
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
127
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
128
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
129
|
+
*/
|
|
130
|
+
supportsVariants: boolean;
|
|
103
131
|
/**
|
|
104
132
|
* Type of value this metric produces
|
|
105
133
|
*/
|
|
@@ -186,6 +214,15 @@ export declare namespace MetricCreateDefinitionResponse {
|
|
|
186
214
|
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
187
215
|
*/
|
|
188
216
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
217
|
+
/**
|
|
218
|
+
* Whether you can create a variant of this metric with POST
|
|
219
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
220
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
221
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
222
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
223
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
224
|
+
*/
|
|
225
|
+
supportsVariants: boolean;
|
|
189
226
|
/**
|
|
190
227
|
* Type of value this metric produces
|
|
191
228
|
*/
|
|
@@ -285,6 +322,15 @@ export declare namespace MetricCreateDefinitionResponse {
|
|
|
285
322
|
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
286
323
|
*/
|
|
287
324
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
325
|
+
/**
|
|
326
|
+
* Whether you can create a variant of this metric with POST
|
|
327
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
328
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
329
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
330
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
331
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
332
|
+
*/
|
|
333
|
+
supportsVariants: boolean;
|
|
288
334
|
/**
|
|
289
335
|
* Type of value this metric produces
|
|
290
336
|
*/
|
|
@@ -419,6 +465,15 @@ export declare namespace MetricListDefinitionsResponse {
|
|
|
419
465
|
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
420
466
|
*/
|
|
421
467
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
468
|
+
/**
|
|
469
|
+
* Whether you can create a variant of this metric with POST
|
|
470
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
471
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
472
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
473
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
474
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
475
|
+
*/
|
|
476
|
+
supportsVariants: boolean;
|
|
422
477
|
/**
|
|
423
478
|
* Type of value this metric produces
|
|
424
479
|
*/
|
|
@@ -501,6 +556,15 @@ export declare namespace MetricListDefinitionsResponse {
|
|
|
501
556
|
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
502
557
|
*/
|
|
503
558
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
559
|
+
/**
|
|
560
|
+
* Whether you can create a variant of this metric with POST
|
|
561
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
562
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
563
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
564
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
565
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
566
|
+
*/
|
|
567
|
+
supportsVariants: boolean;
|
|
504
568
|
/**
|
|
505
569
|
* Type of value this metric produces
|
|
506
570
|
*/
|
|
@@ -583,6 +647,15 @@ export declare namespace MetricListDefinitionsResponse {
|
|
|
583
647
|
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
584
648
|
*/
|
|
585
649
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
650
|
+
/**
|
|
651
|
+
* Whether you can create a variant of this metric with POST
|
|
652
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
653
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
654
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
655
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
656
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
657
|
+
*/
|
|
658
|
+
supportsVariants: boolean;
|
|
586
659
|
/**
|
|
587
660
|
* Type of value this metric produces
|
|
588
661
|
*/
|
|
@@ -685,6 +758,15 @@ export declare namespace MetricListDefinitionsResponse {
|
|
|
685
758
|
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
686
759
|
*/
|
|
687
760
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
761
|
+
/**
|
|
762
|
+
* Whether you can create a variant of this metric with POST
|
|
763
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
764
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
765
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
766
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
767
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
768
|
+
*/
|
|
769
|
+
supportsVariants: boolean;
|
|
688
770
|
/**
|
|
689
771
|
* Type of value this metric produces
|
|
690
772
|
*/
|
|
@@ -784,6 +866,15 @@ export declare namespace MetricListDefinitionsResponse {
|
|
|
784
866
|
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
785
867
|
*/
|
|
786
868
|
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
869
|
+
/**
|
|
870
|
+
* Whether you can create a variant of this metric with POST
|
|
871
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
872
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
873
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
874
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
875
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
876
|
+
*/
|
|
877
|
+
supportsVariants: boolean;
|
|
787
878
|
/**
|
|
788
879
|
* Type of value this metric produces
|
|
789
880
|
*/
|
|
@@ -853,6 +944,458 @@ export declare namespace MetricListDefinitionsResponse {
|
|
|
853
944
|
nextCursor: string | null;
|
|
854
945
|
}
|
|
855
946
|
}
|
|
947
|
+
export interface MetricUpdateDefinitionResponse {
|
|
948
|
+
/**
|
|
949
|
+
* The updated metric definition. The variant is selected by `calculationType`.
|
|
950
|
+
*/
|
|
951
|
+
data: MetricUpdateDefinitionResponse.LlmJudgeMetricResponse | MetricUpdateDefinitionResponse.FormulaMetricResponse | MetricUpdateDefinitionResponse.PatternMetricResponse | MetricUpdateDefinitionResponse.ThresholdMetricResponse;
|
|
952
|
+
}
|
|
953
|
+
export declare namespace MetricUpdateDefinitionResponse {
|
|
954
|
+
interface LlmJudgeMetricResponse {
|
|
955
|
+
/**
|
|
956
|
+
* Unique identifier for the metric definition
|
|
957
|
+
*/
|
|
958
|
+
id: string;
|
|
959
|
+
/**
|
|
960
|
+
* For a BOOLEAN metric, what a `false` value means. Also given to the judge as its
|
|
961
|
+
* polarity rule.
|
|
962
|
+
*/
|
|
963
|
+
booleanFalseLabel: string | null;
|
|
964
|
+
/**
|
|
965
|
+
* For a BOOLEAN metric, what a `true` value means. Also given to the judge as its
|
|
966
|
+
* polarity rule.
|
|
967
|
+
*/
|
|
968
|
+
booleanTrueLabel: string | null;
|
|
969
|
+
/**
|
|
970
|
+
* Metric evaluated by an LLM against a prompt.
|
|
971
|
+
*/
|
|
972
|
+
calculationType: 'LLM_JUDGE';
|
|
973
|
+
/**
|
|
974
|
+
* Description of what the metric measures
|
|
975
|
+
*/
|
|
976
|
+
description: string;
|
|
977
|
+
/**
|
|
978
|
+
* The rubric this judge applies, as stored. Read it back to confirm which criteria
|
|
979
|
+
* are live after a create or update.
|
|
980
|
+
*/
|
|
981
|
+
llmPrompt: string | null;
|
|
982
|
+
/**
|
|
983
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
984
|
+
*/
|
|
985
|
+
metricId: string;
|
|
986
|
+
/**
|
|
987
|
+
* Name of the metric
|
|
988
|
+
*/
|
|
989
|
+
name: string;
|
|
990
|
+
/**
|
|
991
|
+
* True when this metric can only be scored from a live recording
|
|
992
|
+
* (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
|
|
993
|
+
* simulation run forces live enrichment: the run waits for your recording and, if
|
|
994
|
+
* none arrives, the metric produces no value. Check this before a run rather than
|
|
995
|
+
* discovering the wait afterwards.
|
|
996
|
+
*/
|
|
997
|
+
requiresLiveConversation: boolean;
|
|
998
|
+
/**
|
|
999
|
+
* Whether metric is global or per-participant
|
|
1000
|
+
*/
|
|
1001
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
1002
|
+
/**
|
|
1003
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
1004
|
+
*/
|
|
1005
|
+
slug: string;
|
|
1006
|
+
/**
|
|
1007
|
+
* Which levels this metric can produce values at
|
|
1008
|
+
*/
|
|
1009
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
1010
|
+
/**
|
|
1011
|
+
* Which kinds of conversation this metric can be scored on. `null` means both.
|
|
1012
|
+
* `["LIVE"]` marks a metric that can only be scored from your own recording of a
|
|
1013
|
+
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
1014
|
+
*/
|
|
1015
|
+
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
1016
|
+
/**
|
|
1017
|
+
* Whether you can create a variant of this metric with POST
|
|
1018
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
1019
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
1020
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
1021
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
1022
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
1023
|
+
*/
|
|
1024
|
+
supportsVariants: boolean;
|
|
1025
|
+
/**
|
|
1026
|
+
* Type of value this metric produces
|
|
1027
|
+
*/
|
|
1028
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
1029
|
+
/**
|
|
1030
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
1031
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
1032
|
+
* building a derived metric off this one to pin the exact config.
|
|
1033
|
+
*/
|
|
1034
|
+
variantId: string;
|
|
1035
|
+
/**
|
|
1036
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
1037
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
1038
|
+
*/
|
|
1039
|
+
versionId: string;
|
|
1040
|
+
/**
|
|
1041
|
+
* Unit information if applicable
|
|
1042
|
+
*/
|
|
1043
|
+
unit?: LlmJudgeMetricResponse.Unit;
|
|
1044
|
+
}
|
|
1045
|
+
namespace LlmJudgeMetricResponse {
|
|
1046
|
+
/**
|
|
1047
|
+
* Unit information if applicable
|
|
1048
|
+
*/
|
|
1049
|
+
interface Unit {
|
|
1050
|
+
/**
|
|
1051
|
+
* Name of the unit
|
|
1052
|
+
*/
|
|
1053
|
+
name: string;
|
|
1054
|
+
/**
|
|
1055
|
+
* Symbol for the unit
|
|
1056
|
+
*/
|
|
1057
|
+
symbol: string | null;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
interface FormulaMetricResponse {
|
|
1061
|
+
/**
|
|
1062
|
+
* Unique identifier for the metric definition
|
|
1063
|
+
*/
|
|
1064
|
+
id: string;
|
|
1065
|
+
/**
|
|
1066
|
+
* Metric computed by evaluating an expression over other metrics.
|
|
1067
|
+
*/
|
|
1068
|
+
calculationType: 'FORMULA';
|
|
1069
|
+
/**
|
|
1070
|
+
* Description of what the metric measures
|
|
1071
|
+
*/
|
|
1072
|
+
description: string;
|
|
1073
|
+
/**
|
|
1074
|
+
* Formula configuration.
|
|
1075
|
+
*/
|
|
1076
|
+
formula: FormulaMetricResponse.Formula;
|
|
1077
|
+
/**
|
|
1078
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
1079
|
+
*/
|
|
1080
|
+
metricId: string;
|
|
1081
|
+
/**
|
|
1082
|
+
* Name of the metric
|
|
1083
|
+
*/
|
|
1084
|
+
name: string;
|
|
1085
|
+
/**
|
|
1086
|
+
* True when this metric can only be scored from a live recording
|
|
1087
|
+
* (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
|
|
1088
|
+
* simulation run forces live enrichment: the run waits for your recording and, if
|
|
1089
|
+
* none arrives, the metric produces no value. Check this before a run rather than
|
|
1090
|
+
* discovering the wait afterwards.
|
|
1091
|
+
*/
|
|
1092
|
+
requiresLiveConversation: boolean;
|
|
1093
|
+
/**
|
|
1094
|
+
* Whether metric is global or per-participant
|
|
1095
|
+
*/
|
|
1096
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
1097
|
+
/**
|
|
1098
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
1099
|
+
*/
|
|
1100
|
+
slug: string;
|
|
1101
|
+
/**
|
|
1102
|
+
* Which levels this metric can produce values at
|
|
1103
|
+
*/
|
|
1104
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
1105
|
+
/**
|
|
1106
|
+
* Which kinds of conversation this metric can be scored on. `null` means both.
|
|
1107
|
+
* `["LIVE"]` marks a metric that can only be scored from your own recording of a
|
|
1108
|
+
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
1109
|
+
*/
|
|
1110
|
+
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
1111
|
+
/**
|
|
1112
|
+
* Whether you can create a variant of this metric with POST
|
|
1113
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
1114
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
1115
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
1116
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
1117
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
1118
|
+
*/
|
|
1119
|
+
supportsVariants: boolean;
|
|
1120
|
+
/**
|
|
1121
|
+
* Type of value this metric produces
|
|
1122
|
+
*/
|
|
1123
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
1124
|
+
/**
|
|
1125
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
1126
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
1127
|
+
* building a derived metric off this one to pin the exact config.
|
|
1128
|
+
*/
|
|
1129
|
+
variantId: string;
|
|
1130
|
+
/**
|
|
1131
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
1132
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
1133
|
+
*/
|
|
1134
|
+
versionId: string;
|
|
1135
|
+
/**
|
|
1136
|
+
* Unit information if applicable
|
|
1137
|
+
*/
|
|
1138
|
+
unit?: FormulaMetricResponse.Unit;
|
|
1139
|
+
}
|
|
1140
|
+
namespace FormulaMetricResponse {
|
|
1141
|
+
/**
|
|
1142
|
+
* Formula configuration.
|
|
1143
|
+
*/
|
|
1144
|
+
interface Formula {
|
|
1145
|
+
expression: string;
|
|
1146
|
+
sources: Array<Formula.Source>;
|
|
1147
|
+
}
|
|
1148
|
+
namespace Formula {
|
|
1149
|
+
interface Source {
|
|
1150
|
+
sourceMetricDefinitionId: string;
|
|
1151
|
+
sourceVariantId: string | null;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Unit information if applicable
|
|
1156
|
+
*/
|
|
1157
|
+
interface Unit {
|
|
1158
|
+
/**
|
|
1159
|
+
* Name of the unit
|
|
1160
|
+
*/
|
|
1161
|
+
name: string;
|
|
1162
|
+
/**
|
|
1163
|
+
* Symbol for the unit
|
|
1164
|
+
*/
|
|
1165
|
+
symbol: string | null;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
interface PatternMetricResponse {
|
|
1169
|
+
/**
|
|
1170
|
+
* Unique identifier for the metric definition
|
|
1171
|
+
*/
|
|
1172
|
+
id: string;
|
|
1173
|
+
/**
|
|
1174
|
+
* Metric detecting a trigger condition followed by an outcome within a window.
|
|
1175
|
+
*/
|
|
1176
|
+
calculationType: 'PATTERN';
|
|
1177
|
+
/**
|
|
1178
|
+
* Description of what the metric measures
|
|
1179
|
+
*/
|
|
1180
|
+
description: string;
|
|
1181
|
+
/**
|
|
1182
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
1183
|
+
*/
|
|
1184
|
+
metricId: string;
|
|
1185
|
+
/**
|
|
1186
|
+
* Name of the metric
|
|
1187
|
+
*/
|
|
1188
|
+
name: string;
|
|
1189
|
+
/**
|
|
1190
|
+
* Pattern configuration.
|
|
1191
|
+
*/
|
|
1192
|
+
pattern: PatternMetricResponse.Pattern;
|
|
1193
|
+
/**
|
|
1194
|
+
* True when this metric can only be scored from a live recording
|
|
1195
|
+
* (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
|
|
1196
|
+
* simulation run forces live enrichment: the run waits for your recording and, if
|
|
1197
|
+
* none arrives, the metric produces no value. Check this before a run rather than
|
|
1198
|
+
* discovering the wait afterwards.
|
|
1199
|
+
*/
|
|
1200
|
+
requiresLiveConversation: boolean;
|
|
1201
|
+
/**
|
|
1202
|
+
* Whether metric is global or per-participant
|
|
1203
|
+
*/
|
|
1204
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
1205
|
+
/**
|
|
1206
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
1207
|
+
*/
|
|
1208
|
+
slug: string;
|
|
1209
|
+
/**
|
|
1210
|
+
* Which levels this metric can produce values at
|
|
1211
|
+
*/
|
|
1212
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
1213
|
+
/**
|
|
1214
|
+
* Which kinds of conversation this metric can be scored on. `null` means both.
|
|
1215
|
+
* `["LIVE"]` marks a metric that can only be scored from your own recording of a
|
|
1216
|
+
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
1217
|
+
*/
|
|
1218
|
+
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
1219
|
+
/**
|
|
1220
|
+
* Whether you can create a variant of this metric with POST
|
|
1221
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
1222
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
1223
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
1224
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
1225
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
1226
|
+
*/
|
|
1227
|
+
supportsVariants: boolean;
|
|
1228
|
+
/**
|
|
1229
|
+
* Type of value this metric produces
|
|
1230
|
+
*/
|
|
1231
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
1232
|
+
/**
|
|
1233
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
1234
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
1235
|
+
* building a derived metric off this one to pin the exact config.
|
|
1236
|
+
*/
|
|
1237
|
+
variantId: string;
|
|
1238
|
+
/**
|
|
1239
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
1240
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
1241
|
+
*/
|
|
1242
|
+
versionId: string;
|
|
1243
|
+
/**
|
|
1244
|
+
* Unit information if applicable
|
|
1245
|
+
*/
|
|
1246
|
+
unit?: PatternMetricResponse.Unit;
|
|
1247
|
+
}
|
|
1248
|
+
namespace PatternMetricResponse {
|
|
1249
|
+
/**
|
|
1250
|
+
* Pattern configuration.
|
|
1251
|
+
*/
|
|
1252
|
+
interface Pattern {
|
|
1253
|
+
operation: 'PATTERN_EXISTS' | 'PATTERN_COUNT' | 'OUTCOME_AGGREGATE';
|
|
1254
|
+
outcome: Pattern.Outcome | null;
|
|
1255
|
+
triggerCombinator: 'AND' | 'OR' | null;
|
|
1256
|
+
triggers: Array<Pattern.Trigger>;
|
|
1257
|
+
windowMode: string | null;
|
|
1258
|
+
}
|
|
1259
|
+
namespace Pattern {
|
|
1260
|
+
interface Outcome {
|
|
1261
|
+
operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
|
|
1262
|
+
sourceMetricDefinitionId: string;
|
|
1263
|
+
sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
|
|
1264
|
+
sourceVariantId: string | null;
|
|
1265
|
+
thresholdValue: string;
|
|
1266
|
+
windowAfter: number | null;
|
|
1267
|
+
windowBefore: number | null;
|
|
1268
|
+
}
|
|
1269
|
+
interface Trigger {
|
|
1270
|
+
operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
|
|
1271
|
+
sourceMetricDefinitionId: string;
|
|
1272
|
+
sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
|
|
1273
|
+
sourceVariantId: string | null;
|
|
1274
|
+
thresholdValue: string;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* Unit information if applicable
|
|
1279
|
+
*/
|
|
1280
|
+
interface Unit {
|
|
1281
|
+
/**
|
|
1282
|
+
* Name of the unit
|
|
1283
|
+
*/
|
|
1284
|
+
name: string;
|
|
1285
|
+
/**
|
|
1286
|
+
* Symbol for the unit
|
|
1287
|
+
*/
|
|
1288
|
+
symbol: string | null;
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
interface ThresholdMetricResponse {
|
|
1292
|
+
/**
|
|
1293
|
+
* Unique identifier for the metric definition
|
|
1294
|
+
*/
|
|
1295
|
+
id: string;
|
|
1296
|
+
/**
|
|
1297
|
+
* Boolean metric derived by comparing a source metric against a threshold.
|
|
1298
|
+
*/
|
|
1299
|
+
calculationType: 'THRESHOLD';
|
|
1300
|
+
/**
|
|
1301
|
+
* Description of what the metric measures
|
|
1302
|
+
*/
|
|
1303
|
+
description: string;
|
|
1304
|
+
/**
|
|
1305
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
1306
|
+
*/
|
|
1307
|
+
metricId: string;
|
|
1308
|
+
/**
|
|
1309
|
+
* Name of the metric
|
|
1310
|
+
*/
|
|
1311
|
+
name: string;
|
|
1312
|
+
/**
|
|
1313
|
+
* True when this metric can only be scored from a live recording
|
|
1314
|
+
* (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
|
|
1315
|
+
* simulation run forces live enrichment: the run waits for your recording and, if
|
|
1316
|
+
* none arrives, the metric produces no value. Check this before a run rather than
|
|
1317
|
+
* discovering the wait afterwards.
|
|
1318
|
+
*/
|
|
1319
|
+
requiresLiveConversation: boolean;
|
|
1320
|
+
/**
|
|
1321
|
+
* Whether metric is global or per-participant
|
|
1322
|
+
*/
|
|
1323
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
1324
|
+
/**
|
|
1325
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
1326
|
+
*/
|
|
1327
|
+
slug: string;
|
|
1328
|
+
/**
|
|
1329
|
+
* Which levels this metric can produce values at
|
|
1330
|
+
*/
|
|
1331
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
1332
|
+
/**
|
|
1333
|
+
* Which kinds of conversation this metric can be scored on. `null` means both.
|
|
1334
|
+
* `["LIVE"]` marks a metric that can only be scored from your own recording of a
|
|
1335
|
+
* real call, and `["SIMULATED"]` one that only applies to simulations.
|
|
1336
|
+
*/
|
|
1337
|
+
supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
|
|
1338
|
+
/**
|
|
1339
|
+
* Whether you can create a variant of this metric with POST
|
|
1340
|
+
* /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
|
|
1341
|
+
* configuration comes from the metric they derive from), for provider-computed
|
|
1342
|
+
* metrics whose calculation lives in the collector rather than an editable prompt,
|
|
1343
|
+
* and for metrics in a package that manages its own variants. Most of Roark’s own
|
|
1344
|
+
* metrics are false, so read this rather than discovering it from a 403.
|
|
1345
|
+
*/
|
|
1346
|
+
supportsVariants: boolean;
|
|
1347
|
+
/**
|
|
1348
|
+
* Type of value this metric produces
|
|
1349
|
+
*/
|
|
1350
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
1351
|
+
/**
|
|
1352
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
1353
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
1354
|
+
* building a derived metric off this one to pin the exact config.
|
|
1355
|
+
*/
|
|
1356
|
+
variantId: string;
|
|
1357
|
+
/**
|
|
1358
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
1359
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
1360
|
+
*/
|
|
1361
|
+
versionId: string;
|
|
1362
|
+
/**
|
|
1363
|
+
* Threshold configuration.
|
|
1364
|
+
*/
|
|
1365
|
+
threshold?: ThresholdMetricResponse.Threshold;
|
|
1366
|
+
/**
|
|
1367
|
+
* Unit information if applicable
|
|
1368
|
+
*/
|
|
1369
|
+
unit?: ThresholdMetricResponse.Unit;
|
|
1370
|
+
}
|
|
1371
|
+
namespace ThresholdMetricResponse {
|
|
1372
|
+
/**
|
|
1373
|
+
* Threshold configuration.
|
|
1374
|
+
*/
|
|
1375
|
+
interface Threshold {
|
|
1376
|
+
aggregationMode: 'EACH' | 'COUNT' | 'AVERAGE' | 'MIN' | 'MAX' | 'MEDIAN' | 'P95' | 'P99' | 'SUM';
|
|
1377
|
+
countThreshold: number | null;
|
|
1378
|
+
operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
|
|
1379
|
+
sourceMetricDefinitionId: string;
|
|
1380
|
+
sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
|
|
1381
|
+
sourceVariantId: string | null;
|
|
1382
|
+
thresholdValue: string;
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* Unit information if applicable
|
|
1386
|
+
*/
|
|
1387
|
+
interface Unit {
|
|
1388
|
+
/**
|
|
1389
|
+
* Name of the unit
|
|
1390
|
+
*/
|
|
1391
|
+
name: string;
|
|
1392
|
+
/**
|
|
1393
|
+
* Symbol for the unit
|
|
1394
|
+
*/
|
|
1395
|
+
symbol: string | null;
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
856
1399
|
export type MetricCreateDefinitionParams = MetricCreateDefinitionParams.PromptMetricInput | MetricCreateDefinitionParams.FormulaMetricInput | MetricCreateDefinitionParams.PatternMetricInput;
|
|
857
1400
|
export declare namespace MetricCreateDefinitionParams {
|
|
858
1401
|
interface PromptMetricInput {
|
|
@@ -1105,7 +1648,125 @@ export interface MetricListDefinitionsParams {
|
|
|
1105
1648
|
after?: string;
|
|
1106
1649
|
limit?: number;
|
|
1107
1650
|
}
|
|
1651
|
+
export interface MetricUpdateDefinitionParams {
|
|
1652
|
+
analysisPackageId?: unknown;
|
|
1653
|
+
/**
|
|
1654
|
+
* New label for the false case (BOOLEAN output only)
|
|
1655
|
+
*/
|
|
1656
|
+
booleanFalseLabel?: string;
|
|
1657
|
+
/**
|
|
1658
|
+
* New label for the true case (BOOLEAN output only)
|
|
1659
|
+
*/
|
|
1660
|
+
booleanTrueLabel?: string;
|
|
1661
|
+
calcType?: unknown;
|
|
1662
|
+
/**
|
|
1663
|
+
* Optional free-text audit note recorded on the new version.
|
|
1664
|
+
*/
|
|
1665
|
+
changeReason?: string;
|
|
1666
|
+
/**
|
|
1667
|
+
* Replacement set of classification options (CLASSIFICATION output only)
|
|
1668
|
+
*/
|
|
1669
|
+
classificationOptions?: Array<MetricUpdateDefinitionParams.ClassificationOption>;
|
|
1670
|
+
/**
|
|
1671
|
+
* New formula expression (FORMULA only). Pass `sources` alongside if the
|
|
1672
|
+
* referenced metrics change.
|
|
1673
|
+
*/
|
|
1674
|
+
formula?: string;
|
|
1675
|
+
/**
|
|
1676
|
+
* New LLM prompt (only for LLM_JUDGE metrics whose prompt is editable)
|
|
1677
|
+
*/
|
|
1678
|
+
llmPrompt?: string;
|
|
1679
|
+
/**
|
|
1680
|
+
* New maximum number of classifications (CLASSIFICATION output only)
|
|
1681
|
+
*/
|
|
1682
|
+
maxClassifications?: number;
|
|
1683
|
+
metricId?: unknown;
|
|
1684
|
+
/**
|
|
1685
|
+
* New name (only for metrics whose name is editable)
|
|
1686
|
+
*/
|
|
1687
|
+
name?: string;
|
|
1688
|
+
organizationId?: unknown;
|
|
1689
|
+
outputType?: unknown;
|
|
1690
|
+
participantRole?: unknown;
|
|
1691
|
+
projectId?: unknown;
|
|
1692
|
+
/**
|
|
1693
|
+
* Replacement set of scale-range labels (SCALE output only)
|
|
1694
|
+
*/
|
|
1695
|
+
scaleLabels?: Array<MetricUpdateDefinitionParams.ScaleLabel>;
|
|
1696
|
+
/**
|
|
1697
|
+
* New scale maximum (SCALE output only)
|
|
1698
|
+
*/
|
|
1699
|
+
scaleMax?: number;
|
|
1700
|
+
/**
|
|
1701
|
+
* New scale minimum (SCALE output only)
|
|
1702
|
+
*/
|
|
1703
|
+
scaleMin?: number;
|
|
1704
|
+
scope?: unknown;
|
|
1705
|
+
slug?: unknown;
|
|
1706
|
+
source?: unknown;
|
|
1707
|
+
/**
|
|
1708
|
+
* Replacement formula sources, required when `formula` changes the referenced
|
|
1709
|
+
* metrics (FORMULA only).
|
|
1710
|
+
*/
|
|
1711
|
+
sources?: Array<MetricUpdateDefinitionParams.Source>;
|
|
1712
|
+
/**
|
|
1713
|
+
* Replacement set of supported contexts. Omit to leave unchanged.
|
|
1714
|
+
*/
|
|
1715
|
+
supportedContexts?: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
1716
|
+
supportsMultipleVariants?: unknown;
|
|
1717
|
+
/**
|
|
1718
|
+
* Replacement set of scoped tool-definition ids (only for metrics whose tool
|
|
1719
|
+
* scoping is editable)
|
|
1720
|
+
*/
|
|
1721
|
+
toolDefinitionIds?: Array<string>;
|
|
1722
|
+
}
|
|
1723
|
+
export declare namespace MetricUpdateDefinitionParams {
|
|
1724
|
+
/**
|
|
1725
|
+
* Option for classification metrics.
|
|
1726
|
+
*/
|
|
1727
|
+
interface ClassificationOption {
|
|
1728
|
+
description: string;
|
|
1729
|
+
displayOrder: number;
|
|
1730
|
+
label: string;
|
|
1731
|
+
}
|
|
1732
|
+
interface ScaleLabel {
|
|
1733
|
+
/**
|
|
1734
|
+
* Display order of this label
|
|
1735
|
+
*/
|
|
1736
|
+
displayOrder: number;
|
|
1737
|
+
/**
|
|
1738
|
+
* Label for this range
|
|
1739
|
+
*/
|
|
1740
|
+
label: string;
|
|
1741
|
+
/**
|
|
1742
|
+
* Maximum value for this label range
|
|
1743
|
+
*/
|
|
1744
|
+
rangeMax: number;
|
|
1745
|
+
/**
|
|
1746
|
+
* Minimum value for this label range
|
|
1747
|
+
*/
|
|
1748
|
+
rangeMin: number;
|
|
1749
|
+
/**
|
|
1750
|
+
* Hex color code for this label (e.g. "#FF0000")
|
|
1751
|
+
*/
|
|
1752
|
+
colorHex?: string;
|
|
1753
|
+
/**
|
|
1754
|
+
* Description of what this range means
|
|
1755
|
+
*/
|
|
1756
|
+
description?: string;
|
|
1757
|
+
}
|
|
1758
|
+
interface Source {
|
|
1759
|
+
/**
|
|
1760
|
+
* ID of a metric referenced in the formula
|
|
1761
|
+
*/
|
|
1762
|
+
sourceMetricDefinitionId: string;
|
|
1763
|
+
/**
|
|
1764
|
+
* Variant of the source metric to use
|
|
1765
|
+
*/
|
|
1766
|
+
sourceVariantId?: string;
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1108
1769
|
export declare namespace Metric {
|
|
1109
|
-
export { type MetricCreateDefinitionResponse as MetricCreateDefinitionResponse, type MetricListDefinitionsResponse as MetricListDefinitionsResponse, type MetricCreateDefinitionParams as MetricCreateDefinitionParams, type MetricListDefinitionsParams as MetricListDefinitionsParams, };
|
|
1770
|
+
export { type MetricCreateDefinitionResponse as MetricCreateDefinitionResponse, type MetricListDefinitionsResponse as MetricListDefinitionsResponse, type MetricUpdateDefinitionResponse as MetricUpdateDefinitionResponse, type MetricCreateDefinitionParams as MetricCreateDefinitionParams, type MetricListDefinitionsParams as MetricListDefinitionsParams, type MetricUpdateDefinitionParams as MetricUpdateDefinitionParams, };
|
|
1110
1771
|
}
|
|
1111
1772
|
//# sourceMappingURL=metric.d.ts.map
|