@roarkanalytics/sdk 2.31.0 → 2.33.1
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 +69 -0
- package/api-promise.d.mts +1 -0
- package/api-promise.d.mts.map +1 -1
- package/api-promise.d.ts +1 -0
- package/api-promise.d.ts.map +1 -1
- package/api-promise.mjs +1 -0
- package/api-promise.mjs.map +1 -1
- package/client.d.mts +17 -5
- package/client.d.mts.map +1 -1
- package/client.d.ts +17 -5
- package/client.d.ts.map +1 -1
- package/client.js +35 -4
- package/client.js.map +1 -1
- package/client.mjs +35 -4
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts.map +1 -1
- package/core/api-promise.d.ts.map +1 -1
- package/core/api-promise.mjs.map +1 -1
- package/core/error.mjs.map +1 -1
- package/core/resource.d.mts.map +1 -1
- package/core/resource.d.ts.map +1 -1
- package/core/uploads.d.mts.map +1 -1
- package/core/uploads.d.ts.map +1 -1
- package/core/uploads.mjs.map +1 -1
- package/error.d.mts +1 -0
- package/error.d.mts.map +1 -1
- package/error.d.ts +1 -0
- package/error.d.ts.map +1 -1
- package/error.mjs +1 -0
- package/error.mjs.map +1 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.mjs.map +1 -1
- package/internal/detect-platform.mjs.map +1 -1
- package/internal/headers.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.mjs.map +1 -1
- package/internal/qs/formats.d.mts.map +1 -1
- package/internal/qs/formats.d.ts.map +1 -1
- package/internal/qs/index.d.mts +2 -2
- package/internal/qs/index.d.mts.map +1 -1
- package/internal/qs/index.d.ts +2 -2
- package/internal/qs/index.d.ts.map +1 -1
- package/internal/qs/index.mjs.map +1 -1
- package/internal/qs/stringify.d.mts.map +1 -1
- package/internal/qs/stringify.d.ts.map +1 -1
- package/internal/qs/stringify.mjs.map +1 -1
- package/internal/qs/utils.d.mts.map +1 -1
- package/internal/qs/utils.d.ts.map +1 -1
- package/internal/qs/utils.mjs.map +1 -1
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts.map +1 -1
- package/internal/shims.d.mts +6 -0
- package/internal/shims.d.mts.map +1 -1
- package/internal/shims.d.ts +6 -0
- package/internal/shims.d.ts.map +1 -1
- package/internal/to-file.d.mts.map +1 -1
- package/internal/to-file.d.ts.map +1 -1
- package/internal/to-file.mjs.map +1 -1
- package/internal/types.d.mts +10 -10
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +10 -10
- package/internal/types.d.ts.map +1 -1
- package/internal/uploads.d.mts.map +1 -1
- package/internal/uploads.d.ts.map +1 -1
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/base64.mjs.map +1 -1
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +2 -0
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +2 -0
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/path.mjs.map +1 -1
- package/internal/utils/query.mjs.map +1 -1
- package/internal/utils/values.mjs.map +1 -1
- package/internal/utils.d.mts.map +1 -1
- package/internal/utils.d.ts.map +1 -1
- package/internal/utils.mjs.map +1 -1
- package/package.json +1 -1
- package/resource.d.mts +1 -0
- package/resource.d.mts.map +1 -1
- package/resource.d.ts +1 -0
- package/resource.d.ts.map +1 -1
- package/resource.mjs +1 -0
- package/resource.mjs.map +1 -1
- package/resources/agent-endpoint.d.mts +4 -4
- package/resources/agent-endpoint.d.mts.map +1 -1
- package/resources/agent-endpoint.d.ts +4 -4
- package/resources/agent-endpoint.d.ts.map +1 -1
- package/resources/agent-endpoint.mjs.map +1 -1
- package/resources/agent.d.mts.map +1 -1
- package/resources/agent.d.ts.map +1 -1
- package/resources/agent.mjs.map +1 -1
- package/resources/call.d.mts +303 -155
- package/resources/call.d.mts.map +1 -1
- package/resources/call.d.ts +303 -155
- package/resources/call.d.ts.map +1 -1
- package/resources/call.js +6 -7
- package/resources/call.js.map +1 -1
- package/resources/call.mjs +6 -7
- package/resources/call.mjs.map +1 -1
- package/resources/config.d.mts +535 -0
- package/resources/config.d.mts.map +1 -0
- package/resources/config.d.ts +535 -0
- package/resources/config.d.ts.map +1 -0
- package/resources/config.js +28 -0
- package/resources/config.js.map +1 -0
- package/resources/config.mjs +24 -0
- package/resources/config.mjs.map +1 -0
- package/resources/customer-flow-edge-case.d.mts +1742 -0
- package/resources/customer-flow-edge-case.d.mts.map +1 -0
- package/resources/customer-flow-edge-case.d.ts +1742 -0
- package/resources/customer-flow-edge-case.d.ts.map +1 -0
- package/resources/customer-flow-edge-case.js +50 -0
- package/resources/customer-flow-edge-case.js.map +1 -0
- package/resources/customer-flow-edge-case.mjs +46 -0
- package/resources/customer-flow-edge-case.mjs.map +1 -0
- package/resources/customer-flow.d.mts +7163 -0
- package/resources/customer-flow.d.mts.map +1 -0
- package/resources/customer-flow.d.ts +7163 -0
- package/resources/customer-flow.d.ts.map +1 -0
- package/resources/customer-flow.js +87 -0
- package/resources/customer-flow.js.map +1 -0
- package/resources/customer-flow.mjs +83 -0
- package/resources/customer-flow.mjs.map +1 -0
- package/resources/health.d.mts.map +1 -1
- package/resources/health.d.ts.map +1 -1
- package/resources/health.mjs.map +1 -1
- package/resources/http-request-definition.d.mts.map +1 -1
- package/resources/http-request-definition.d.ts.map +1 -1
- package/resources/http-request-definition.mjs.map +1 -1
- package/resources/index.d.mts +6 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +6 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +11 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +5 -1
- package/resources/index.mjs.map +1 -1
- package/resources/metric-collection-job.d.mts +5 -3
- package/resources/metric-collection-job.d.mts.map +1 -1
- package/resources/metric-collection-job.d.ts +5 -3
- package/resources/metric-collection-job.d.ts.map +1 -1
- package/resources/metric-collection-job.mjs.map +1 -1
- package/resources/metric-policy.d.mts.map +1 -1
- package/resources/metric-policy.d.ts.map +1 -1
- package/resources/metric-policy.mjs.map +1 -1
- package/resources/metric.d.mts +804 -109
- package/resources/metric.d.mts.map +1 -1
- package/resources/metric.d.ts +804 -109
- package/resources/metric.d.ts.map +1 -1
- package/resources/metric.js +6 -7
- package/resources/metric.js.map +1 -1
- package/resources/metric.mjs +6 -7
- package/resources/metric.mjs.map +1 -1
- package/resources/simulation-environment.d.mts +95 -0
- package/resources/simulation-environment.d.mts.map +1 -0
- package/resources/simulation-environment.d.ts +95 -0
- package/resources/simulation-environment.d.ts.map +1 -0
- package/resources/simulation-environment.js +24 -0
- package/resources/simulation-environment.js.map +1 -0
- package/resources/simulation-environment.mjs +20 -0
- package/resources/simulation-environment.mjs.map +1 -0
- package/resources/simulation-job.d.mts +58 -10
- package/resources/simulation-job.d.mts.map +1 -1
- package/resources/simulation-job.d.ts +58 -10
- package/resources/simulation-job.d.ts.map +1 -1
- package/resources/simulation-job.mjs.map +1 -1
- package/resources/simulation-persona.d.mts +60 -24
- package/resources/simulation-persona.d.mts.map +1 -1
- package/resources/simulation-persona.d.ts +60 -24
- package/resources/simulation-persona.d.ts.map +1 -1
- package/resources/simulation-persona.mjs.map +1 -1
- package/resources/simulation-run-plan-job.d.mts +73 -32
- package/resources/simulation-run-plan-job.d.mts.map +1 -1
- package/resources/simulation-run-plan-job.d.ts +73 -32
- package/resources/simulation-run-plan-job.d.ts.map +1 -1
- package/resources/simulation-run-plan-job.js +7 -8
- package/resources/simulation-run-plan-job.js.map +1 -1
- package/resources/simulation-run-plan-job.mjs +7 -8
- package/resources/simulation-run-plan-job.mjs.map +1 -1
- package/resources/simulation-run-plan.d.mts +408 -39
- package/resources/simulation-run-plan.d.mts.map +1 -1
- package/resources/simulation-run-plan.d.ts +408 -39
- package/resources/simulation-run-plan.d.ts.map +1 -1
- package/resources/simulation-run-plan.js +6 -11
- package/resources/simulation-run-plan.js.map +1 -1
- package/resources/simulation-run-plan.mjs +6 -11
- package/resources/simulation-run-plan.mjs.map +1 -1
- package/resources/simulation.d.mts +379 -0
- package/resources/simulation.d.mts.map +1 -0
- package/resources/simulation.d.ts +379 -0
- package/resources/simulation.d.ts.map +1 -0
- package/resources/simulation.js +33 -0
- package/resources/simulation.js.map +1 -0
- package/resources/simulation.mjs +29 -0
- package/resources/simulation.mjs.map +1 -0
- package/resources/webhook.d.mts +4 -4
- package/resources/webhook.d.mts.map +1 -1
- package/resources/webhook.d.ts +4 -4
- package/resources/webhook.d.ts.map +1 -1
- package/resources/webhook.mjs.map +1 -1
- package/resources.d.mts.map +1 -1
- package/resources.d.ts.map +1 -1
- package/resources.mjs.map +1 -1
- package/src/client.ts +124 -28
- package/src/internal/types.ts +6 -8
- package/src/internal/utils/log.ts +2 -0
- package/src/resources/agent-endpoint.ts +36 -4
- package/src/resources/call.ts +326 -169
- package/src/resources/config.ts +1162 -0
- package/src/resources/customer-flow-edge-case.ts +2884 -0
- package/src/resources/customer-flow.ts +11713 -0
- package/src/resources/index.ts +42 -12
- package/src/resources/metric-collection-job.ts +5 -3
- package/src/resources/metric.ts +1057 -115
- package/src/resources/simulation-environment.ts +147 -0
- package/src/resources/simulation-job.ts +122 -10
- package/src/resources/simulation-persona.ts +192 -24
- package/src/resources/simulation-run-plan-job.ts +109 -27
- package/src/resources/simulation-run-plan.ts +445 -40
- package/src/resources/simulation.ts +444 -0
- package/src/resources/webhook.ts +8 -0
- package/src/version.ts +1 -1
- package/uploads.d.mts +1 -0
- package/uploads.d.mts.map +1 -1
- package/uploads.d.ts +1 -0
- package/uploads.d.ts.map +1 -1
- package/uploads.mjs +1 -0
- package/uploads.mjs.map +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/simulation-scenario.d.mts +0 -424
- package/resources/simulation-scenario.d.mts.map +0 -1
- package/resources/simulation-scenario.d.ts +0 -424
- package/resources/simulation-scenario.d.ts.map +0 -1
- package/resources/simulation-scenario.js +0 -40
- package/resources/simulation-scenario.js.map +0 -1
- package/resources/simulation-scenario.mjs +0 -36
- package/resources/simulation-scenario.mjs.map +0 -1
- package/src/resources/simulation-scenario.ts +0 -602
package/src/resources/metric.ts
CHANGED
|
@@ -6,13 +6,17 @@ import { RequestOptions } from '../internal/request-options';
|
|
|
6
6
|
|
|
7
7
|
export class Metric extends APIResource {
|
|
8
8
|
/**
|
|
9
|
-
* Create a new
|
|
10
|
-
*
|
|
9
|
+
* Create a new metric definition. The `calculationType` field selects the variant:
|
|
10
|
+
* LLM_JUDGE (LLM-evaluated), FORMULA (computed from a math expression over other
|
|
11
|
+
* metrics), or PATTERN (detects a trigger→outcome pattern within a window). To
|
|
12
|
+
* create a threshold on top of an existing metric, use
|
|
13
|
+
* `POST /metric/definitions/{idOrSlug}/thresholds` instead.
|
|
11
14
|
*
|
|
12
15
|
* @example
|
|
13
16
|
* ```ts
|
|
14
17
|
* const response = await client.metric.createDefinition({
|
|
15
18
|
* analysisPackageId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
19
|
+
* calculationType: 'LLM_JUDGE',
|
|
16
20
|
* name: 'Customer Satisfaction',
|
|
17
21
|
* outputType: 'BOOLEAN',
|
|
18
22
|
* });
|
|
@@ -28,11 +32,6 @@ export class Metric extends APIResource {
|
|
|
28
32
|
/**
|
|
29
33
|
* Fetch all metric definitions available in the project, including both
|
|
30
34
|
* system-generated and custom metrics.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```ts
|
|
34
|
-
* const response = await client.metric.listDefinitions();
|
|
35
|
-
* ```
|
|
36
35
|
*/
|
|
37
36
|
listDefinitions(options?: RequestOptions): APIPromise<MetricListDefinitionsResponse> {
|
|
38
37
|
return this._client.get('/v1/metric/definitions', options);
|
|
@@ -41,28 +40,33 @@ export class Metric extends APIResource {
|
|
|
41
40
|
|
|
42
41
|
export interface MetricCreateDefinitionResponse {
|
|
43
42
|
/**
|
|
44
|
-
*
|
|
43
|
+
* The created metric definition. The variant is selected by `calculationType`.
|
|
45
44
|
*/
|
|
46
|
-
data:
|
|
45
|
+
data:
|
|
46
|
+
| MetricCreateDefinitionResponse.LlmJudgeMetricResponse
|
|
47
|
+
| MetricCreateDefinitionResponse.FormulaMetricResponse
|
|
48
|
+
| MetricCreateDefinitionResponse.PatternMetricResponse;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
export namespace MetricCreateDefinitionResponse {
|
|
50
|
-
|
|
51
|
-
* Metric definition data
|
|
52
|
-
*/
|
|
53
|
-
export interface Data {
|
|
52
|
+
export interface LlmJudgeMetricResponse {
|
|
54
53
|
/**
|
|
55
54
|
* Unique identifier for the metric definition
|
|
56
55
|
*/
|
|
57
56
|
id: string;
|
|
58
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Metric evaluated by an LLM against a prompt.
|
|
60
|
+
*/
|
|
61
|
+
calculationType: 'LLM_JUDGE';
|
|
62
|
+
|
|
59
63
|
/**
|
|
60
64
|
* Description of what the metric measures
|
|
61
65
|
*/
|
|
62
66
|
description: string;
|
|
63
67
|
|
|
64
68
|
/**
|
|
65
|
-
*
|
|
69
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
66
70
|
*/
|
|
67
71
|
metricId: string;
|
|
68
72
|
|
|
@@ -76,6 +80,11 @@ export namespace MetricCreateDefinitionResponse {
|
|
|
76
80
|
*/
|
|
77
81
|
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
78
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
85
|
+
*/
|
|
86
|
+
slug: string;
|
|
87
|
+
|
|
79
88
|
/**
|
|
80
89
|
* Which levels this metric can produce values at
|
|
81
90
|
*/
|
|
@@ -86,13 +95,26 @@ export namespace MetricCreateDefinitionResponse {
|
|
|
86
95
|
*/
|
|
87
96
|
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
88
97
|
|
|
98
|
+
/**
|
|
99
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
100
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
101
|
+
* building a derived metric off this one to pin the exact config.
|
|
102
|
+
*/
|
|
103
|
+
variantId: string;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
107
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
108
|
+
*/
|
|
109
|
+
versionId: string;
|
|
110
|
+
|
|
89
111
|
/**
|
|
90
112
|
* Unit information if applicable
|
|
91
113
|
*/
|
|
92
|
-
unit?:
|
|
114
|
+
unit?: LlmJudgeMetricResponse.Unit;
|
|
93
115
|
}
|
|
94
116
|
|
|
95
|
-
export namespace
|
|
117
|
+
export namespace LlmJudgeMetricResponse {
|
|
96
118
|
/**
|
|
97
119
|
* Unit information if applicable
|
|
98
120
|
*/
|
|
@@ -108,32 +130,30 @@ export namespace MetricCreateDefinitionResponse {
|
|
|
108
130
|
symbol: string | null;
|
|
109
131
|
}
|
|
110
132
|
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface MetricListDefinitionsResponse {
|
|
114
|
-
/**
|
|
115
|
-
* Metrics response payload
|
|
116
|
-
*/
|
|
117
|
-
data: Array<MetricListDefinitionsResponse.Data>;
|
|
118
|
-
}
|
|
119
133
|
|
|
120
|
-
export
|
|
121
|
-
/**
|
|
122
|
-
* Metric definition data
|
|
123
|
-
*/
|
|
124
|
-
export interface Data {
|
|
134
|
+
export interface FormulaMetricResponse {
|
|
125
135
|
/**
|
|
126
136
|
* Unique identifier for the metric definition
|
|
127
137
|
*/
|
|
128
138
|
id: string;
|
|
129
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Metric computed by evaluating an expression over other metrics.
|
|
142
|
+
*/
|
|
143
|
+
calculationType: 'FORMULA';
|
|
144
|
+
|
|
130
145
|
/**
|
|
131
146
|
* Description of what the metric measures
|
|
132
147
|
*/
|
|
133
148
|
description: string;
|
|
134
149
|
|
|
135
150
|
/**
|
|
136
|
-
*
|
|
151
|
+
* Formula configuration.
|
|
152
|
+
*/
|
|
153
|
+
formula: FormulaMetricResponse.Formula;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
137
157
|
*/
|
|
138
158
|
metricId: string;
|
|
139
159
|
|
|
@@ -147,6 +167,11 @@ export namespace MetricListDefinitionsResponse {
|
|
|
147
167
|
*/
|
|
148
168
|
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
149
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
172
|
+
*/
|
|
173
|
+
slug: string;
|
|
174
|
+
|
|
150
175
|
/**
|
|
151
176
|
* Which levels this metric can produce values at
|
|
152
177
|
*/
|
|
@@ -157,13 +182,43 @@ export namespace MetricListDefinitionsResponse {
|
|
|
157
182
|
*/
|
|
158
183
|
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
159
184
|
|
|
185
|
+
/**
|
|
186
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
187
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
188
|
+
* building a derived metric off this one to pin the exact config.
|
|
189
|
+
*/
|
|
190
|
+
variantId: string;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
194
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
195
|
+
*/
|
|
196
|
+
versionId: string;
|
|
197
|
+
|
|
160
198
|
/**
|
|
161
199
|
* Unit information if applicable
|
|
162
200
|
*/
|
|
163
|
-
unit?:
|
|
201
|
+
unit?: FormulaMetricResponse.Unit;
|
|
164
202
|
}
|
|
165
203
|
|
|
166
|
-
export namespace
|
|
204
|
+
export namespace FormulaMetricResponse {
|
|
205
|
+
/**
|
|
206
|
+
* Formula configuration.
|
|
207
|
+
*/
|
|
208
|
+
export interface Formula {
|
|
209
|
+
expression: string;
|
|
210
|
+
|
|
211
|
+
sources: Array<Formula.Source>;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export namespace Formula {
|
|
215
|
+
export interface Source {
|
|
216
|
+
sourceMetricDefinitionId: string;
|
|
217
|
+
|
|
218
|
+
sourceVariantId: string | null;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
167
222
|
/**
|
|
168
223
|
* Unit information if applicable
|
|
169
224
|
*/
|
|
@@ -179,136 +234,1023 @@ export namespace MetricListDefinitionsResponse {
|
|
|
179
234
|
symbol: string | null;
|
|
180
235
|
}
|
|
181
236
|
}
|
|
182
|
-
}
|
|
183
237
|
|
|
184
|
-
export interface
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
238
|
+
export interface PatternMetricResponse {
|
|
239
|
+
/**
|
|
240
|
+
* Unique identifier for the metric definition
|
|
241
|
+
*/
|
|
242
|
+
id: string;
|
|
189
243
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
244
|
+
/**
|
|
245
|
+
* Metric detecting a trigger condition followed by an outcome within a window.
|
|
246
|
+
*/
|
|
247
|
+
calculationType: 'PATTERN';
|
|
194
248
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
249
|
+
/**
|
|
250
|
+
* Description of what the metric measures
|
|
251
|
+
*/
|
|
252
|
+
description: string;
|
|
199
253
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
256
|
+
*/
|
|
257
|
+
metricId: string;
|
|
204
258
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
259
|
+
/**
|
|
260
|
+
* Name of the metric
|
|
261
|
+
*/
|
|
262
|
+
name: string;
|
|
209
263
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
264
|
+
/**
|
|
265
|
+
* Pattern configuration.
|
|
266
|
+
*/
|
|
267
|
+
pattern: PatternMetricResponse.Pattern;
|
|
214
268
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
llmPrompt?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Whether metric is global or per-participant
|
|
271
|
+
*/
|
|
272
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
220
273
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
maxClassifications?: number;
|
|
274
|
+
/**
|
|
275
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
276
|
+
*/
|
|
277
|
+
slug: string;
|
|
226
278
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
metricId?: string;
|
|
279
|
+
/**
|
|
280
|
+
* Which levels this metric can produce values at
|
|
281
|
+
*/
|
|
282
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
232
283
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
284
|
+
/**
|
|
285
|
+
* Type of value this metric produces
|
|
286
|
+
*/
|
|
287
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
237
288
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
289
|
+
/**
|
|
290
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
291
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
292
|
+
* building a derived metric off this one to pin the exact config.
|
|
293
|
+
*/
|
|
294
|
+
variantId: string;
|
|
242
295
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
296
|
+
/**
|
|
297
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
298
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
299
|
+
*/
|
|
300
|
+
versionId: string;
|
|
247
301
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
302
|
+
/**
|
|
303
|
+
* Unit information if applicable
|
|
304
|
+
*/
|
|
305
|
+
unit?: PatternMetricResponse.Unit;
|
|
306
|
+
}
|
|
252
307
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
308
|
+
export namespace PatternMetricResponse {
|
|
309
|
+
/**
|
|
310
|
+
* Pattern configuration.
|
|
311
|
+
*/
|
|
312
|
+
export interface Pattern {
|
|
313
|
+
operation: 'PATTERN_EXISTS' | 'PATTERN_COUNT' | 'OUTCOME_AGGREGATE';
|
|
314
|
+
|
|
315
|
+
outcome: Pattern.Outcome | null;
|
|
316
|
+
|
|
317
|
+
triggerCombinator: 'AND' | 'OR' | null;
|
|
318
|
+
|
|
319
|
+
triggers: Array<Pattern.Trigger>;
|
|
320
|
+
|
|
321
|
+
windowMode: string | null;
|
|
322
|
+
}
|
|
257
323
|
|
|
324
|
+
export namespace Pattern {
|
|
325
|
+
export interface Outcome {
|
|
326
|
+
operator:
|
|
327
|
+
| 'GREATER_THAN'
|
|
328
|
+
| 'GREATER_THAN_OR_EQUALS'
|
|
329
|
+
| 'LESS_THAN'
|
|
330
|
+
| 'LESS_THAN_OR_EQUALS'
|
|
331
|
+
| 'EQUALS'
|
|
332
|
+
| 'NOT_EQUALS';
|
|
333
|
+
|
|
334
|
+
sourceMetricDefinitionId: string;
|
|
335
|
+
|
|
336
|
+
sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
|
|
337
|
+
|
|
338
|
+
sourceVariantId: string | null;
|
|
339
|
+
|
|
340
|
+
thresholdValue: string;
|
|
341
|
+
|
|
342
|
+
windowAfter: number | null;
|
|
343
|
+
|
|
344
|
+
windowBefore: number | null;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
export interface Trigger {
|
|
348
|
+
operator:
|
|
349
|
+
| 'GREATER_THAN'
|
|
350
|
+
| 'GREATER_THAN_OR_EQUALS'
|
|
351
|
+
| 'LESS_THAN'
|
|
352
|
+
| 'LESS_THAN_OR_EQUALS'
|
|
353
|
+
| 'EQUALS'
|
|
354
|
+
| 'NOT_EQUALS';
|
|
355
|
+
|
|
356
|
+
sourceMetricDefinitionId: string;
|
|
357
|
+
|
|
358
|
+
sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
|
|
359
|
+
|
|
360
|
+
sourceVariantId: string | null;
|
|
361
|
+
|
|
362
|
+
thresholdValue: string;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Unit information if applicable
|
|
368
|
+
*/
|
|
369
|
+
export interface Unit {
|
|
370
|
+
/**
|
|
371
|
+
* Name of the unit
|
|
372
|
+
*/
|
|
373
|
+
name: string;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Symbol for the unit
|
|
377
|
+
*/
|
|
378
|
+
symbol: string | null;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export interface MetricListDefinitionsResponse {
|
|
258
384
|
/**
|
|
259
|
-
*
|
|
385
|
+
* Metrics response payload
|
|
260
386
|
*/
|
|
261
|
-
|
|
387
|
+
data: Array<
|
|
388
|
+
| MetricListDefinitionsResponse.LlmJudgeMetricResponse
|
|
389
|
+
| MetricListDefinitionsResponse.ProviderMetricResponse
|
|
390
|
+
| MetricListDefinitionsResponse.ThresholdMetricResponse
|
|
391
|
+
| MetricListDefinitionsResponse.FormulaMetricResponse
|
|
392
|
+
| MetricListDefinitionsResponse.PatternMetricResponse
|
|
393
|
+
>;
|
|
262
394
|
}
|
|
263
395
|
|
|
264
|
-
export namespace
|
|
265
|
-
export interface
|
|
396
|
+
export namespace MetricListDefinitionsResponse {
|
|
397
|
+
export interface LlmJudgeMetricResponse {
|
|
398
|
+
/**
|
|
399
|
+
* Unique identifier for the metric definition
|
|
400
|
+
*/
|
|
401
|
+
id: string;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Metric evaluated by an LLM against a prompt.
|
|
405
|
+
*/
|
|
406
|
+
calculationType: 'LLM_JUDGE';
|
|
407
|
+
|
|
266
408
|
/**
|
|
267
|
-
* Description of what
|
|
409
|
+
* Description of what the metric measures
|
|
268
410
|
*/
|
|
269
411
|
description: string;
|
|
270
412
|
|
|
271
413
|
/**
|
|
272
|
-
*
|
|
414
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
415
|
+
*/
|
|
416
|
+
metricId: string;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Name of the metric
|
|
420
|
+
*/
|
|
421
|
+
name: string;
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Whether metric is global or per-participant
|
|
425
|
+
*/
|
|
426
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
430
|
+
*/
|
|
431
|
+
slug: string;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Which levels this metric can produce values at
|
|
435
|
+
*/
|
|
436
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Type of value this metric produces
|
|
440
|
+
*/
|
|
441
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
445
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
446
|
+
* building a derived metric off this one to pin the exact config.
|
|
447
|
+
*/
|
|
448
|
+
variantId: string;
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
452
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
273
453
|
*/
|
|
274
|
-
|
|
454
|
+
versionId: string;
|
|
275
455
|
|
|
276
456
|
/**
|
|
277
|
-
*
|
|
457
|
+
* Unit information if applicable
|
|
458
|
+
*/
|
|
459
|
+
unit?: LlmJudgeMetricResponse.Unit;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export namespace LlmJudgeMetricResponse {
|
|
463
|
+
/**
|
|
464
|
+
* Unit information if applicable
|
|
278
465
|
*/
|
|
279
|
-
|
|
466
|
+
export interface Unit {
|
|
467
|
+
/**
|
|
468
|
+
* Name of the unit
|
|
469
|
+
*/
|
|
470
|
+
name: string;
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Symbol for the unit
|
|
474
|
+
*/
|
|
475
|
+
symbol: string | null;
|
|
476
|
+
}
|
|
280
477
|
}
|
|
281
478
|
|
|
282
|
-
export interface
|
|
479
|
+
export interface ProviderMetricResponse {
|
|
480
|
+
/**
|
|
481
|
+
* Unique identifier for the metric definition
|
|
482
|
+
*/
|
|
483
|
+
id: string;
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* System-managed metric produced by an analysis provider.
|
|
487
|
+
*/
|
|
488
|
+
calculationType: 'PROVIDER';
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Description of what the metric measures
|
|
492
|
+
*/
|
|
493
|
+
description: string;
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
497
|
+
*/
|
|
498
|
+
metricId: string;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Name of the metric
|
|
502
|
+
*/
|
|
503
|
+
name: string;
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Whether metric is global or per-participant
|
|
507
|
+
*/
|
|
508
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
509
|
+
|
|
283
510
|
/**
|
|
284
|
-
*
|
|
511
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
512
|
+
*/
|
|
513
|
+
slug: string;
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Which levels this metric can produce values at
|
|
285
517
|
*/
|
|
286
|
-
|
|
518
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
287
519
|
|
|
288
520
|
/**
|
|
289
|
-
*
|
|
521
|
+
* Type of value this metric produces
|
|
290
522
|
*/
|
|
291
|
-
|
|
523
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
292
524
|
|
|
293
525
|
/**
|
|
294
|
-
*
|
|
526
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
527
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
528
|
+
* building a derived metric off this one to pin the exact config.
|
|
295
529
|
*/
|
|
296
|
-
|
|
530
|
+
variantId: string;
|
|
297
531
|
|
|
298
532
|
/**
|
|
299
|
-
*
|
|
533
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
534
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
300
535
|
*/
|
|
301
|
-
|
|
536
|
+
versionId: string;
|
|
302
537
|
|
|
303
538
|
/**
|
|
304
|
-
*
|
|
539
|
+
* Unit information if applicable
|
|
305
540
|
*/
|
|
306
|
-
|
|
541
|
+
unit?: ProviderMetricResponse.Unit;
|
|
542
|
+
}
|
|
307
543
|
|
|
544
|
+
export namespace ProviderMetricResponse {
|
|
308
545
|
/**
|
|
309
|
-
*
|
|
546
|
+
* Unit information if applicable
|
|
310
547
|
*/
|
|
311
|
-
|
|
548
|
+
export interface Unit {
|
|
549
|
+
/**
|
|
550
|
+
* Name of the unit
|
|
551
|
+
*/
|
|
552
|
+
name: string;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Symbol for the unit
|
|
556
|
+
*/
|
|
557
|
+
symbol: string | null;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
export interface ThresholdMetricResponse {
|
|
562
|
+
/**
|
|
563
|
+
* Unique identifier for the metric definition
|
|
564
|
+
*/
|
|
565
|
+
id: string;
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Boolean metric derived by comparing a source metric against a threshold.
|
|
569
|
+
*/
|
|
570
|
+
calculationType: 'THRESHOLD';
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Description of what the metric measures
|
|
574
|
+
*/
|
|
575
|
+
description: string;
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
579
|
+
*/
|
|
580
|
+
metricId: string;
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Name of the metric
|
|
584
|
+
*/
|
|
585
|
+
name: string;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Whether metric is global or per-participant
|
|
589
|
+
*/
|
|
590
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
594
|
+
*/
|
|
595
|
+
slug: string;
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Which levels this metric can produce values at
|
|
599
|
+
*/
|
|
600
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Type of value this metric produces
|
|
604
|
+
*/
|
|
605
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
609
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
610
|
+
* building a derived metric off this one to pin the exact config.
|
|
611
|
+
*/
|
|
612
|
+
variantId: string;
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
616
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
617
|
+
*/
|
|
618
|
+
versionId: string;
|
|
619
|
+
|
|
620
|
+
/**
|
|
621
|
+
* Threshold configuration.
|
|
622
|
+
*/
|
|
623
|
+
threshold?: ThresholdMetricResponse.Threshold;
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* Unit information if applicable
|
|
627
|
+
*/
|
|
628
|
+
unit?: ThresholdMetricResponse.Unit;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
export namespace ThresholdMetricResponse {
|
|
632
|
+
/**
|
|
633
|
+
* Threshold configuration.
|
|
634
|
+
*/
|
|
635
|
+
export interface Threshold {
|
|
636
|
+
aggregationMode: 'EACH' | 'COUNT' | 'AVERAGE' | 'MIN' | 'MAX' | 'MEDIAN' | 'P95' | 'P99' | 'SUM';
|
|
637
|
+
|
|
638
|
+
countThreshold: number | null;
|
|
639
|
+
|
|
640
|
+
operator:
|
|
641
|
+
| 'GREATER_THAN'
|
|
642
|
+
| 'GREATER_THAN_OR_EQUALS'
|
|
643
|
+
| 'LESS_THAN'
|
|
644
|
+
| 'LESS_THAN_OR_EQUALS'
|
|
645
|
+
| 'EQUALS'
|
|
646
|
+
| 'NOT_EQUALS';
|
|
647
|
+
|
|
648
|
+
sourceMetricDefinitionId: string;
|
|
649
|
+
|
|
650
|
+
sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
|
|
651
|
+
|
|
652
|
+
sourceVariantId: string | null;
|
|
653
|
+
|
|
654
|
+
thresholdValue: string;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Unit information if applicable
|
|
659
|
+
*/
|
|
660
|
+
export interface Unit {
|
|
661
|
+
/**
|
|
662
|
+
* Name of the unit
|
|
663
|
+
*/
|
|
664
|
+
name: string;
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Symbol for the unit
|
|
668
|
+
*/
|
|
669
|
+
symbol: string | null;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
export interface FormulaMetricResponse {
|
|
674
|
+
/**
|
|
675
|
+
* Unique identifier for the metric definition
|
|
676
|
+
*/
|
|
677
|
+
id: string;
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Metric computed by evaluating an expression over other metrics.
|
|
681
|
+
*/
|
|
682
|
+
calculationType: 'FORMULA';
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* Description of what the metric measures
|
|
686
|
+
*/
|
|
687
|
+
description: string;
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Formula configuration.
|
|
691
|
+
*/
|
|
692
|
+
formula: FormulaMetricResponse.Formula;
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
696
|
+
*/
|
|
697
|
+
metricId: string;
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Name of the metric
|
|
701
|
+
*/
|
|
702
|
+
name: string;
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* Whether metric is global or per-participant
|
|
706
|
+
*/
|
|
707
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
711
|
+
*/
|
|
712
|
+
slug: string;
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Which levels this metric can produce values at
|
|
716
|
+
*/
|
|
717
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* Type of value this metric produces
|
|
721
|
+
*/
|
|
722
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
726
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
727
|
+
* building a derived metric off this one to pin the exact config.
|
|
728
|
+
*/
|
|
729
|
+
variantId: string;
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
733
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
734
|
+
*/
|
|
735
|
+
versionId: string;
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* Unit information if applicable
|
|
739
|
+
*/
|
|
740
|
+
unit?: FormulaMetricResponse.Unit;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
export namespace FormulaMetricResponse {
|
|
744
|
+
/**
|
|
745
|
+
* Formula configuration.
|
|
746
|
+
*/
|
|
747
|
+
export interface Formula {
|
|
748
|
+
expression: string;
|
|
749
|
+
|
|
750
|
+
sources: Array<Formula.Source>;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
export namespace Formula {
|
|
754
|
+
export interface Source {
|
|
755
|
+
sourceMetricDefinitionId: string;
|
|
756
|
+
|
|
757
|
+
sourceVariantId: string | null;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
/**
|
|
762
|
+
* Unit information if applicable
|
|
763
|
+
*/
|
|
764
|
+
export interface Unit {
|
|
765
|
+
/**
|
|
766
|
+
* Name of the unit
|
|
767
|
+
*/
|
|
768
|
+
name: string;
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* Symbol for the unit
|
|
772
|
+
*/
|
|
773
|
+
symbol: string | null;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
export interface PatternMetricResponse {
|
|
778
|
+
/**
|
|
779
|
+
* Unique identifier for the metric definition
|
|
780
|
+
*/
|
|
781
|
+
id: string;
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Metric detecting a trigger condition followed by an outcome within a window.
|
|
785
|
+
*/
|
|
786
|
+
calculationType: 'PATTERN';
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Description of what the metric measures
|
|
790
|
+
*/
|
|
791
|
+
description: string;
|
|
792
|
+
|
|
793
|
+
/**
|
|
794
|
+
* Alias of `slug` retained for backwards compatibility. Same value as `slug`.
|
|
795
|
+
*/
|
|
796
|
+
metricId: string;
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* Name of the metric
|
|
800
|
+
*/
|
|
801
|
+
name: string;
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* Pattern configuration.
|
|
805
|
+
*/
|
|
806
|
+
pattern: PatternMetricResponse.Pattern;
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Whether metric is global or per-participant
|
|
810
|
+
*/
|
|
811
|
+
scope: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Stable metric slug (e.g. "call_reason", "customer_satisfaction")
|
|
815
|
+
*/
|
|
816
|
+
slug: string;
|
|
817
|
+
|
|
818
|
+
/**
|
|
819
|
+
* Which levels this metric can produce values at
|
|
820
|
+
*/
|
|
821
|
+
supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Type of value this metric produces
|
|
825
|
+
*/
|
|
826
|
+
type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* The resolved variant this response reflects (org-scoped Default if the org has
|
|
830
|
+
* customized it, otherwise the system Default). Pass this as sourceVariantId when
|
|
831
|
+
* building a derived metric off this one to pin the exact config.
|
|
832
|
+
*/
|
|
833
|
+
variantId: string;
|
|
834
|
+
|
|
835
|
+
/**
|
|
836
|
+
* The variant's current version. Immutable snapshot of the config — editing the
|
|
837
|
+
* metric produces a new versionId. Use it to detect config changes.
|
|
838
|
+
*/
|
|
839
|
+
versionId: string;
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Unit information if applicable
|
|
843
|
+
*/
|
|
844
|
+
unit?: PatternMetricResponse.Unit;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
export namespace PatternMetricResponse {
|
|
848
|
+
/**
|
|
849
|
+
* Pattern configuration.
|
|
850
|
+
*/
|
|
851
|
+
export interface Pattern {
|
|
852
|
+
operation: 'PATTERN_EXISTS' | 'PATTERN_COUNT' | 'OUTCOME_AGGREGATE';
|
|
853
|
+
|
|
854
|
+
outcome: Pattern.Outcome | null;
|
|
855
|
+
|
|
856
|
+
triggerCombinator: 'AND' | 'OR' | null;
|
|
857
|
+
|
|
858
|
+
triggers: Array<Pattern.Trigger>;
|
|
859
|
+
|
|
860
|
+
windowMode: string | null;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
export namespace Pattern {
|
|
864
|
+
export interface Outcome {
|
|
865
|
+
operator:
|
|
866
|
+
| 'GREATER_THAN'
|
|
867
|
+
| 'GREATER_THAN_OR_EQUALS'
|
|
868
|
+
| 'LESS_THAN'
|
|
869
|
+
| 'LESS_THAN_OR_EQUALS'
|
|
870
|
+
| 'EQUALS'
|
|
871
|
+
| 'NOT_EQUALS';
|
|
872
|
+
|
|
873
|
+
sourceMetricDefinitionId: string;
|
|
874
|
+
|
|
875
|
+
sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
|
|
876
|
+
|
|
877
|
+
sourceVariantId: string | null;
|
|
878
|
+
|
|
879
|
+
thresholdValue: string;
|
|
880
|
+
|
|
881
|
+
windowAfter: number | null;
|
|
882
|
+
|
|
883
|
+
windowBefore: number | null;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
export interface Trigger {
|
|
887
|
+
operator:
|
|
888
|
+
| 'GREATER_THAN'
|
|
889
|
+
| 'GREATER_THAN_OR_EQUALS'
|
|
890
|
+
| 'LESS_THAN'
|
|
891
|
+
| 'LESS_THAN_OR_EQUALS'
|
|
892
|
+
| 'EQUALS'
|
|
893
|
+
| 'NOT_EQUALS';
|
|
894
|
+
|
|
895
|
+
sourceMetricDefinitionId: string;
|
|
896
|
+
|
|
897
|
+
sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
|
|
898
|
+
|
|
899
|
+
sourceVariantId: string | null;
|
|
900
|
+
|
|
901
|
+
thresholdValue: string;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* Unit information if applicable
|
|
907
|
+
*/
|
|
908
|
+
export interface Unit {
|
|
909
|
+
/**
|
|
910
|
+
* Name of the unit
|
|
911
|
+
*/
|
|
912
|
+
name: string;
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* Symbol for the unit
|
|
916
|
+
*/
|
|
917
|
+
symbol: string | null;
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
export type MetricCreateDefinitionParams =
|
|
923
|
+
| MetricCreateDefinitionParams.PromptMetricInput
|
|
924
|
+
| MetricCreateDefinitionParams.FormulaMetricInput
|
|
925
|
+
| MetricCreateDefinitionParams.PatternMetricInput;
|
|
926
|
+
|
|
927
|
+
export declare namespace MetricCreateDefinitionParams {
|
|
928
|
+
export interface PromptMetricInput {
|
|
929
|
+
/**
|
|
930
|
+
* ID of the analysis package to add this metric to
|
|
931
|
+
*/
|
|
932
|
+
analysisPackageId: string;
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* LLM-evaluated metric.
|
|
936
|
+
*/
|
|
937
|
+
calculationType: 'LLM_JUDGE';
|
|
938
|
+
|
|
939
|
+
/**
|
|
940
|
+
* Name of the metric
|
|
941
|
+
*/
|
|
942
|
+
name: string;
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* Type of value this metric produces
|
|
946
|
+
*/
|
|
947
|
+
outputType: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
|
|
948
|
+
|
|
949
|
+
/**
|
|
950
|
+
* Label for the false case (only for BOOLEAN type)
|
|
951
|
+
*/
|
|
952
|
+
booleanFalseLabel?: string;
|
|
953
|
+
|
|
954
|
+
/**
|
|
955
|
+
* Label for the true case (only for BOOLEAN type)
|
|
956
|
+
*/
|
|
957
|
+
booleanTrueLabel?: string;
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Options for classification. Required for CLASSIFICATION type.
|
|
961
|
+
*/
|
|
962
|
+
classificationOptions?: Array<PromptMetricInput.ClassificationOption>;
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* LLM prompt/criteria for evaluating this metric. Required for BOOLEAN, NUMERIC,
|
|
966
|
+
* TEXT, and SCALE types.
|
|
967
|
+
*/
|
|
968
|
+
llmPrompt?: string;
|
|
969
|
+
|
|
970
|
+
/**
|
|
971
|
+
* Maximum number of classifications that can be selected (only for CLASSIFICATION
|
|
972
|
+
* type)
|
|
973
|
+
*/
|
|
974
|
+
maxClassifications?: number;
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Alias of `slug` accepted for backwards compatibility. Use `slug` for new
|
|
978
|
+
* integrations.
|
|
979
|
+
*/
|
|
980
|
+
metricId?: string;
|
|
981
|
+
|
|
982
|
+
/**
|
|
983
|
+
* Participant role to evaluate. Required when scope is PER_PARTICIPANT.
|
|
984
|
+
*/
|
|
985
|
+
participantRole?: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER';
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* Labels for scale ranges (only for SCALE type)
|
|
989
|
+
*/
|
|
990
|
+
scaleLabels?: Array<PromptMetricInput.ScaleLabel>;
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* Maximum value for scale. Required for SCALE type.
|
|
994
|
+
*/
|
|
995
|
+
scaleMax?: number;
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* Minimum value for scale. Required for SCALE type.
|
|
999
|
+
*/
|
|
1000
|
+
scaleMin?: number;
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* Whether metric is global or per-participant (default: GLOBAL)
|
|
1004
|
+
*/
|
|
1005
|
+
scope?: 'GLOBAL' | 'PER_PARTICIPANT';
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* Stable slug for the metric. Auto-generated from name if omitted.
|
|
1009
|
+
*/
|
|
1010
|
+
slug?: string;
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* Which levels this metric can produce values at (default: ["CALL"])
|
|
1014
|
+
*/
|
|
1015
|
+
supportedContexts?: Array<'CALL' | 'SEGMENT' | 'TURN'>;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
export namespace PromptMetricInput {
|
|
1019
|
+
/**
|
|
1020
|
+
* Option for classification metrics.
|
|
1021
|
+
*/
|
|
1022
|
+
export interface ClassificationOption {
|
|
1023
|
+
description: string;
|
|
1024
|
+
|
|
1025
|
+
displayOrder: number;
|
|
1026
|
+
|
|
1027
|
+
label: string;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
export interface ScaleLabel {
|
|
1031
|
+
/**
|
|
1032
|
+
* Display order of this label
|
|
1033
|
+
*/
|
|
1034
|
+
displayOrder: number;
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* Label for this range
|
|
1038
|
+
*/
|
|
1039
|
+
label: string;
|
|
1040
|
+
|
|
1041
|
+
/**
|
|
1042
|
+
* Maximum value for this label range
|
|
1043
|
+
*/
|
|
1044
|
+
rangeMax: number;
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Minimum value for this label range
|
|
1048
|
+
*/
|
|
1049
|
+
rangeMin: number;
|
|
1050
|
+
|
|
1051
|
+
/**
|
|
1052
|
+
* Hex color code for this label (e.g. "#FF0000")
|
|
1053
|
+
*/
|
|
1054
|
+
colorHex?: string;
|
|
1055
|
+
|
|
1056
|
+
/**
|
|
1057
|
+
* Description of what this range means
|
|
1058
|
+
*/
|
|
1059
|
+
description?: string;
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
export interface FormulaMetricInput {
|
|
1064
|
+
/**
|
|
1065
|
+
* ID of the analysis package to add this metric to
|
|
1066
|
+
*/
|
|
1067
|
+
analysisPackageId: string;
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* Metric computed by evaluating a mathematical expression over other metrics.
|
|
1071
|
+
*/
|
|
1072
|
+
calculationType: 'FORMULA';
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* Formula expression using `{{id:<uuid>}}` references to source metrics. Operators
|
|
1076
|
+
* depend on output type: +, -, \*, / for NUMERIC; ==, !=, >=, <=, >, < for
|
|
1077
|
+
* BOOLEAN.
|
|
1078
|
+
*/
|
|
1079
|
+
formula: string;
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* Name of the metric
|
|
1083
|
+
*/
|
|
1084
|
+
name: string;
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* Output type of the formula. NUMERIC for arithmetic expressions, BOOLEAN for
|
|
1088
|
+
* comparison expressions.
|
|
1089
|
+
*/
|
|
1090
|
+
outputType: 'NUMERIC' | 'BOOLEAN';
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Source metrics referenced by the formula. Minimum 2.
|
|
1094
|
+
*/
|
|
1095
|
+
sources: Array<FormulaMetricInput.Source>;
|
|
1096
|
+
|
|
1097
|
+
/**
|
|
1098
|
+
* Alias of `slug` accepted for backwards compatibility. Use `slug` for new
|
|
1099
|
+
* integrations.
|
|
1100
|
+
*/
|
|
1101
|
+
metricId?: string;
|
|
1102
|
+
|
|
1103
|
+
/**
|
|
1104
|
+
* Stable slug for the metric. Auto-generated from name if omitted.
|
|
1105
|
+
*/
|
|
1106
|
+
slug?: string;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
export namespace FormulaMetricInput {
|
|
1110
|
+
export interface Source {
|
|
1111
|
+
/**
|
|
1112
|
+
* ID of a metric referenced in the formula
|
|
1113
|
+
*/
|
|
1114
|
+
sourceMetricDefinitionId: string;
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* Variant of the source metric to use
|
|
1118
|
+
*/
|
|
1119
|
+
sourceVariantId?: string;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
export interface PatternMetricInput {
|
|
1124
|
+
/**
|
|
1125
|
+
* ID of the analysis package to add this metric to
|
|
1126
|
+
*/
|
|
1127
|
+
analysisPackageId: string;
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Metric detecting temporal patterns: a trigger condition followed by an outcome
|
|
1131
|
+
* within a window.
|
|
1132
|
+
*/
|
|
1133
|
+
calculationType: 'PATTERN';
|
|
1134
|
+
|
|
1135
|
+
/**
|
|
1136
|
+
* Name of the metric
|
|
1137
|
+
*/
|
|
1138
|
+
name: string;
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* Pattern operation. PATTERN_EXISTS produces a BOOLEAN; PATTERN_COUNT produces a
|
|
1142
|
+
* NUMERIC count; OUTCOME_AGGREGATE aggregates a numeric outcome.
|
|
1143
|
+
*/
|
|
1144
|
+
operation: 'PATTERN_EXISTS' | 'PATTERN_COUNT' | 'OUTCOME_AGGREGATE';
|
|
1145
|
+
|
|
1146
|
+
/**
|
|
1147
|
+
* Outcome condition evaluated within the window relative to the trigger.
|
|
1148
|
+
*/
|
|
1149
|
+
outcome: PatternMetricInput.Outcome;
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* Alias of `slug` accepted for backwards compatibility. Use `slug` for new
|
|
1153
|
+
* integrations.
|
|
1154
|
+
*/
|
|
1155
|
+
metricId?: string;
|
|
1156
|
+
|
|
1157
|
+
/**
|
|
1158
|
+
* Stable slug for the metric. Auto-generated from name if omitted.
|
|
1159
|
+
*/
|
|
1160
|
+
slug?: string;
|
|
1161
|
+
|
|
1162
|
+
/**
|
|
1163
|
+
* Single trigger condition. Use either trigger or triggers + triggerCombinator.
|
|
1164
|
+
*/
|
|
1165
|
+
trigger?: PatternMetricInput.Trigger;
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* How to combine multiple triggers. Required when triggers has more than 1 entry.
|
|
1169
|
+
*/
|
|
1170
|
+
triggerCombinator?: 'AND' | 'OR';
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* Multiple trigger conditions. Use with triggerCombinator.
|
|
1174
|
+
*/
|
|
1175
|
+
triggers?: Array<PatternMetricInput.Trigger>;
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* Unit for trigger/outcome window values (default: seconds)
|
|
1179
|
+
*/
|
|
1180
|
+
windowMode?: 'seconds' | 'segments';
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
export namespace PatternMetricInput {
|
|
1184
|
+
/**
|
|
1185
|
+
* Outcome condition evaluated within the window relative to the trigger.
|
|
1186
|
+
*/
|
|
1187
|
+
export interface Outcome {
|
|
1188
|
+
operator:
|
|
1189
|
+
| 'GREATER_THAN'
|
|
1190
|
+
| 'GREATER_THAN_OR_EQUALS'
|
|
1191
|
+
| 'LESS_THAN'
|
|
1192
|
+
| 'LESS_THAN_OR_EQUALS'
|
|
1193
|
+
| 'EQUALS'
|
|
1194
|
+
| 'NOT_EQUALS';
|
|
1195
|
+
|
|
1196
|
+
sourceMetricDefinitionId: string;
|
|
1197
|
+
|
|
1198
|
+
thresholdValue: string;
|
|
1199
|
+
|
|
1200
|
+
/**
|
|
1201
|
+
* How far after the trigger to look for the outcome (in seconds or segments, see
|
|
1202
|
+
* windowMode)
|
|
1203
|
+
*/
|
|
1204
|
+
windowAfter: number;
|
|
1205
|
+
|
|
1206
|
+
sourceParticipantRole?: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER';
|
|
1207
|
+
|
|
1208
|
+
sourceVariantId?: string;
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
* How far before the trigger to look for the outcome (default: 0)
|
|
1212
|
+
*/
|
|
1213
|
+
windowBefore?: number;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
/**
|
|
1217
|
+
* Single trigger condition. Use either trigger or triggers + triggerCombinator.
|
|
1218
|
+
*/
|
|
1219
|
+
export interface Trigger {
|
|
1220
|
+
operator:
|
|
1221
|
+
| 'GREATER_THAN'
|
|
1222
|
+
| 'GREATER_THAN_OR_EQUALS'
|
|
1223
|
+
| 'LESS_THAN'
|
|
1224
|
+
| 'LESS_THAN_OR_EQUALS'
|
|
1225
|
+
| 'EQUALS'
|
|
1226
|
+
| 'NOT_EQUALS';
|
|
1227
|
+
|
|
1228
|
+
sourceMetricDefinitionId: string;
|
|
1229
|
+
|
|
1230
|
+
thresholdValue: string;
|
|
1231
|
+
|
|
1232
|
+
sourceParticipantRole?: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER';
|
|
1233
|
+
|
|
1234
|
+
sourceVariantId?: string;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
export interface Trigger {
|
|
1238
|
+
operator:
|
|
1239
|
+
| 'GREATER_THAN'
|
|
1240
|
+
| 'GREATER_THAN_OR_EQUALS'
|
|
1241
|
+
| 'LESS_THAN'
|
|
1242
|
+
| 'LESS_THAN_OR_EQUALS'
|
|
1243
|
+
| 'EQUALS'
|
|
1244
|
+
| 'NOT_EQUALS';
|
|
1245
|
+
|
|
1246
|
+
sourceMetricDefinitionId: string;
|
|
1247
|
+
|
|
1248
|
+
thresholdValue: string;
|
|
1249
|
+
|
|
1250
|
+
sourceParticipantRole?: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER';
|
|
1251
|
+
|
|
1252
|
+
sourceVariantId?: string;
|
|
1253
|
+
}
|
|
312
1254
|
}
|
|
313
1255
|
}
|
|
314
1256
|
|