@roarkanalytics/sdk 2.9.1 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/index.d.mts +5 -2
  3. package/index.d.ts +5 -2
  4. package/index.d.ts.map +1 -1
  5. package/index.js +3 -0
  6. package/index.js.map +1 -1
  7. package/index.mjs +4 -1
  8. package/index.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/call.d.ts +180 -1
  11. package/resources/call.d.ts.map +1 -1
  12. package/resources/call.js +7 -0
  13. package/resources/call.js.map +1 -1
  14. package/resources/call.mjs +7 -0
  15. package/resources/call.mjs.map +1 -1
  16. package/resources/evaluation.d.ts +12 -10
  17. package/resources/evaluation.d.ts.map +1 -1
  18. package/resources/index.d.ts +2 -1
  19. package/resources/index.d.ts.map +1 -1
  20. package/resources/index.js +3 -1
  21. package/resources/index.js.map +1 -1
  22. package/resources/index.mjs +2 -1
  23. package/resources/index.mjs.map +1 -1
  24. package/resources/metric.d.ts +74 -0
  25. package/resources/metric.d.ts.map +1 -0
  26. package/resources/metric.js +17 -0
  27. package/resources/metric.js.map +1 -0
  28. package/resources/metric.mjs +13 -0
  29. package/resources/metric.mjs.map +1 -0
  30. package/resources/persona.d.ts +105 -119
  31. package/resources/persona.d.ts.map +1 -1
  32. package/resources/persona.js +5 -31
  33. package/resources/persona.js.map +1 -1
  34. package/resources/persona.mjs +5 -31
  35. package/resources/persona.mjs.map +1 -1
  36. package/resources/simulation.d.ts +99 -64
  37. package/resources/simulation.d.ts.map +1 -1
  38. package/resources/simulation.js +3 -2
  39. package/resources/simulation.js.map +1 -1
  40. package/resources/simulation.mjs +3 -2
  41. package/resources/simulation.mjs.map +1 -1
  42. package/src/index.ts +14 -1
  43. package/src/resources/call.ts +230 -0
  44. package/src/resources/evaluation.ts +26 -8
  45. package/src/resources/index.ts +8 -1
  46. package/src/resources/metric.ts +90 -0
  47. package/src/resources/persona.ts +156 -114
  48. package/src/resources/simulation.ts +121 -64
  49. package/src/version.ts +1 -1
  50. package/version.d.ts +1 -1
  51. package/version.d.ts.map +1 -1
  52. package/version.js +1 -1
  53. package/version.js.map +1 -1
  54. package/version.mjs +1 -1
  55. package/version.mjs.map +1 -1
@@ -1,6 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../resource';
4
+ import { isRequestOptions } from '../core';
4
5
  import * as Core from '../core';
5
6
 
6
7
  export class Call extends APIResource {
@@ -14,6 +15,27 @@ export class Call extends APIResource {
14
15
  return this._client.get(`/v1/call/${callId}/evaluation-run`, options);
15
16
  }
16
17
 
18
+ /**
19
+ * Fetch all call-level metrics for a specific call, including both
20
+ * system-generated and custom metrics. Only returns successfully computed metrics.
21
+ */
22
+ getMetrics(
23
+ callId: string,
24
+ query?: CallGetMetricsParams,
25
+ options?: Core.RequestOptions,
26
+ ): Core.APIPromise<CallGetMetricsResponse>;
27
+ getMetrics(callId: string, options?: Core.RequestOptions): Core.APIPromise<CallGetMetricsResponse>;
28
+ getMetrics(
29
+ callId: string,
30
+ query: CallGetMetricsParams | Core.RequestOptions = {},
31
+ options?: Core.RequestOptions,
32
+ ): Core.APIPromise<CallGetMetricsResponse> {
33
+ if (isRequestOptions(query)) {
34
+ return this.getMetrics(callId, {}, query);
35
+ }
36
+ return this._client.get(`/v1/call/${callId}/metrics`, { query, ...options });
37
+ }
38
+
17
39
  /**
18
40
  * Fetch detailed sentiment analysis results for a specific call, including
19
41
  * emotional tone, key phrases, and sentiment scores.
@@ -214,6 +236,204 @@ export namespace CallGetEvaluationRunsResponse {
214
236
  }
215
237
  }
216
238
 
239
+ export interface CallGetMetricsResponse {
240
+ /**
241
+ * Call metrics response payload grouped by metric definition
242
+ */
243
+ data: Array<CallGetMetricsResponse.Data>;
244
+ }
245
+
246
+ export namespace CallGetMetricsResponse {
247
+ /**
248
+ * Call metric data grouped by metric definition
249
+ */
250
+ export interface Data {
251
+ /**
252
+ * Description of what the metric measures
253
+ */
254
+ description: string;
255
+
256
+ /**
257
+ * Unique identifier for the metric definition
258
+ */
259
+ metricDefinitionId: string;
260
+
261
+ /**
262
+ * Stable metric identifier
263
+ */
264
+ metricId: string;
265
+
266
+ /**
267
+ * Name of the metric
268
+ */
269
+ name: string;
270
+
271
+ /**
272
+ * Whether metric is global or per-participant
273
+ */
274
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
275
+
276
+ /**
277
+ * Type of value this metric produces
278
+ */
279
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
280
+
281
+ /**
282
+ * Array of metric values (multiple for PER_PARTICIPANT metrics, or multiple
283
+ * segments/turns)
284
+ */
285
+ values: Array<Data.Value>;
286
+
287
+ /**
288
+ * Unit information if applicable
289
+ */
290
+ unit?: Data.Unit;
291
+ }
292
+
293
+ export namespace Data {
294
+ export interface Value {
295
+ /**
296
+ * ISO 8601 timestamp when the metric was computed
297
+ */
298
+ computedAt: string;
299
+
300
+ /**
301
+ * Confidence score (0-1) for the computed value. Defaults to 1.0 for deterministic
302
+ * metrics.
303
+ */
304
+ confidence: number;
305
+
306
+ /**
307
+ * Context level: CALL (entire call), SEGMENT (single segment), SEGMENT_RANGE
308
+ * (between/across segments)
309
+ */
310
+ context: 'CALL' | 'SEGMENT' | 'SEGMENT_RANGE';
311
+
312
+ /**
313
+ * The metric value (type depends on outputType)
314
+ */
315
+ value: number | boolean | string;
316
+
317
+ /**
318
+ * Starting segment information (for SEGMENT_RANGE context metrics)
319
+ */
320
+ fromSegment?: Value.FromSegment;
321
+
322
+ /**
323
+ * Role of participant (only for PER_PARTICIPANT metrics)
324
+ */
325
+ participantRole?: 'agent' | 'customer';
326
+
327
+ /**
328
+ * Segment information (for SEGMENT context metrics)
329
+ */
330
+ segment?: Value.Segment;
331
+
332
+ /**
333
+ * Ending segment information (for SEGMENT_RANGE context metrics)
334
+ */
335
+ toSegment?: Value.ToSegment;
336
+
337
+ /**
338
+ * Explanation for the metric value (especially useful for AI-computed metrics)
339
+ */
340
+ valueReasoning?: string;
341
+ }
342
+
343
+ export namespace Value {
344
+ /**
345
+ * Starting segment information (for SEGMENT_RANGE context metrics)
346
+ */
347
+ export interface FromSegment {
348
+ /**
349
+ * Starting segment ID
350
+ */
351
+ id: string;
352
+
353
+ /**
354
+ * End time offset in milliseconds
355
+ */
356
+ endOffsetMs: number;
357
+
358
+ /**
359
+ * Start time offset in milliseconds
360
+ */
361
+ startOffsetMs: number;
362
+
363
+ /**
364
+ * Starting segment text content
365
+ */
366
+ text: string;
367
+ }
368
+
369
+ /**
370
+ * Segment information (for SEGMENT context metrics)
371
+ */
372
+ export interface Segment {
373
+ /**
374
+ * Segment ID
375
+ */
376
+ id: string;
377
+
378
+ /**
379
+ * End time offset in milliseconds
380
+ */
381
+ endOffsetMs: number;
382
+
383
+ /**
384
+ * Start time offset in milliseconds
385
+ */
386
+ startOffsetMs: number;
387
+
388
+ /**
389
+ * Segment text content
390
+ */
391
+ text: string;
392
+ }
393
+
394
+ /**
395
+ * Ending segment information (for SEGMENT_RANGE context metrics)
396
+ */
397
+ export interface ToSegment {
398
+ /**
399
+ * Ending segment ID
400
+ */
401
+ id: string;
402
+
403
+ /**
404
+ * End time offset in milliseconds
405
+ */
406
+ endOffsetMs: number;
407
+
408
+ /**
409
+ * Start time offset in milliseconds
410
+ */
411
+ startOffsetMs: number;
412
+
413
+ /**
414
+ * Ending segment text content
415
+ */
416
+ text: string;
417
+ }
418
+ }
419
+
420
+ /**
421
+ * Unit information if applicable
422
+ */
423
+ export interface Unit {
424
+ /**
425
+ * Name of the unit
426
+ */
427
+ name: string;
428
+
429
+ /**
430
+ * Symbol for the unit
431
+ */
432
+ symbol: string | null;
433
+ }
434
+ }
435
+ }
436
+
217
437
  export interface CallGetSentimentRunsResponse {
218
438
  /**
219
439
  * Sentiment run response payload
@@ -248,9 +468,19 @@ export namespace CallGetSentimentRunsResponse {
248
468
  }
249
469
  }
250
470
 
471
+ export interface CallGetMetricsParams {
472
+ /**
473
+ * Whether to return a flat list instead of grouped by metric definition (default:
474
+ * false)
475
+ */
476
+ flatten?: string;
477
+ }
478
+
251
479
  export declare namespace Call {
252
480
  export {
253
481
  type CallGetEvaluationRunsResponse as CallGetEvaluationRunsResponse,
482
+ type CallGetMetricsResponse as CallGetMetricsResponse,
254
483
  type CallGetSentimentRunsResponse as CallGetSentimentRunsResponse,
484
+ type CallGetMetricsParams as CallGetMetricsParams,
255
485
  };
256
486
  }
@@ -1363,8 +1363,8 @@ export namespace EvaluationCreateJobParams {
1363
1363
  participants: Array<Call.Participant>;
1364
1364
 
1365
1365
  /**
1366
- * URL of source recording (must be an accessible WAV or MP3 file). Can be a signed
1367
- * URL.
1366
+ * URL of source recording (must be an accessible WAV, MP3, or MP4 file). Can be a
1367
+ * signed URL.
1368
1368
  */
1369
1369
  recordingUrl: string;
1370
1370
 
@@ -1382,14 +1382,21 @@ export namespace EvaluationCreateJobParams {
1382
1382
  * High-level call end status, indicating how the call terminated
1383
1383
  */
1384
1384
  endedStatus?:
1385
+ | 'PARTICIPANTS_DID_NOT_SPEAK'
1386
+ | 'AGENT_DID_NOT_ANSWER'
1387
+ | 'AGENT_DID_NOT_SPEAK'
1388
+ | 'AGENT_STOPPED_SPEAKING'
1385
1389
  | 'AGENT_ENDED_CALL'
1386
1390
  | 'AGENT_TRANSFERRED_CALL'
1391
+ | 'AGENT_BUSY'
1387
1392
  | 'AGENT_ERROR'
1388
1393
  | 'CUSTOMER_ENDED_CALL'
1389
1394
  | 'VOICE_MAIL_REACHED'
1390
1395
  | 'SILENCE_TIME_OUT'
1391
1396
  | 'PHONE_CALL_PROVIDER_CONNECTION_ERROR'
1392
1397
  | 'CUSTOMER_DID_NOT_ANSWER'
1398
+ | 'CUSTOMER_DID_NOT_SPEAK'
1399
+ | 'CUSTOMER_STOPPED_SPEAKING'
1393
1400
  | 'CUSTOMER_BUSY'
1394
1401
  | 'DIAL_ERROR'
1395
1402
  | 'MAX_DURATION_REACHED'
@@ -1412,8 +1419,8 @@ export namespace EvaluationCreateJobParams {
1412
1419
  retellCallId?: string;
1413
1420
 
1414
1421
  /**
1415
- * URL of source stereo recording in WAV format. Must be accessible. Can be a
1416
- * signed URL. While optional it allows for a richer audio player
1422
+ * URL of source stereo recording. Must be accessible. Can be a signed URL. While
1423
+ * optional it allows for a richer audio player. Supported formats: WAV, MP3, MP4.
1417
1424
  */
1418
1425
  stereoRecordingUrl?: string;
1419
1426
 
@@ -1436,6 +1443,8 @@ export namespace EvaluationCreateJobParams {
1436
1443
 
1437
1444
  name?: string | null;
1438
1445
 
1446
+ participantId?: string | null;
1447
+
1439
1448
  phoneNumber?: string | null;
1440
1449
 
1441
1450
  spokeFirst?: boolean;
@@ -1515,8 +1524,8 @@ export namespace EvaluationCreateJobParams {
1515
1524
  participants: Array<Call.Participant>;
1516
1525
 
1517
1526
  /**
1518
- * URL of source recording (must be an accessible WAV or MP3 file). Can be a signed
1519
- * URL.
1527
+ * URL of source recording (must be an accessible WAV, MP3, or MP4 file). Can be a
1528
+ * signed URL.
1520
1529
  */
1521
1530
  recordingUrl: string;
1522
1531
 
@@ -1534,14 +1543,21 @@ export namespace EvaluationCreateJobParams {
1534
1543
  * High-level call end status, indicating how the call terminated
1535
1544
  */
1536
1545
  endedStatus?:
1546
+ | 'PARTICIPANTS_DID_NOT_SPEAK'
1547
+ | 'AGENT_DID_NOT_ANSWER'
1548
+ | 'AGENT_DID_NOT_SPEAK'
1549
+ | 'AGENT_STOPPED_SPEAKING'
1537
1550
  | 'AGENT_ENDED_CALL'
1538
1551
  | 'AGENT_TRANSFERRED_CALL'
1552
+ | 'AGENT_BUSY'
1539
1553
  | 'AGENT_ERROR'
1540
1554
  | 'CUSTOMER_ENDED_CALL'
1541
1555
  | 'VOICE_MAIL_REACHED'
1542
1556
  | 'SILENCE_TIME_OUT'
1543
1557
  | 'PHONE_CALL_PROVIDER_CONNECTION_ERROR'
1544
1558
  | 'CUSTOMER_DID_NOT_ANSWER'
1559
+ | 'CUSTOMER_DID_NOT_SPEAK'
1560
+ | 'CUSTOMER_STOPPED_SPEAKING'
1545
1561
  | 'CUSTOMER_BUSY'
1546
1562
  | 'DIAL_ERROR'
1547
1563
  | 'MAX_DURATION_REACHED'
@@ -1564,8 +1580,8 @@ export namespace EvaluationCreateJobParams {
1564
1580
  retellCallId?: string;
1565
1581
 
1566
1582
  /**
1567
- * URL of source stereo recording in WAV format. Must be accessible. Can be a
1568
- * signed URL. While optional it allows for a richer audio player
1583
+ * URL of source stereo recording. Must be accessible. Can be a signed URL. While
1584
+ * optional it allows for a richer audio player. Supported formats: WAV, MP3, MP4.
1569
1585
  */
1570
1586
  stereoRecordingUrl?: string;
1571
1587
 
@@ -1588,6 +1604,8 @@ export namespace EvaluationCreateJobParams {
1588
1604
 
1589
1605
  name?: string | null;
1590
1606
 
1607
+ participantId?: string | null;
1608
+
1591
1609
  phoneNumber?: string | null;
1592
1610
 
1593
1611
  spokeFirst?: boolean;
@@ -1,6 +1,12 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export { Call, type CallGetEvaluationRunsResponse, type CallGetSentimentRunsResponse } from './call';
3
+ export {
4
+ Call,
5
+ type CallGetEvaluationRunsResponse,
6
+ type CallGetMetricsResponse,
7
+ type CallGetSentimentRunsResponse,
8
+ type CallGetMetricsParams,
9
+ } from './call';
4
10
  export {
5
11
  Evaluation,
6
12
  type EvaluationCreateJobResponse,
@@ -20,6 +26,7 @@ export {
20
26
  type IntegrationCreateRetellCallParams,
21
27
  type IntegrationCreateVapiCallParams,
22
28
  } from './integrations';
29
+ export { Metric, type MetricGetDefinitionsResponse } from './metric';
23
30
  export {
24
31
  Persona,
25
32
  type PersonaCreateResponse,
@@ -0,0 +1,90 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import * as Core from '../core';
5
+
6
+ export class Metric extends APIResource {
7
+ /**
8
+ * Fetch all metric definitions available in the project, including both
9
+ * system-generated and custom metrics. Only returns metrics from enabled analysis
10
+ * packages.
11
+ */
12
+ getDefinitions(options?: Core.RequestOptions): Core.APIPromise<MetricGetDefinitionsResponse> {
13
+ return this._client.get('/v1/metric/definitions', options);
14
+ }
15
+ }
16
+
17
+ export interface MetricGetDefinitionsResponse {
18
+ /**
19
+ * Metrics response payload
20
+ */
21
+ data: Array<MetricGetDefinitionsResponse.Data>;
22
+ }
23
+
24
+ export namespace MetricGetDefinitionsResponse {
25
+ /**
26
+ * Metric definition data
27
+ */
28
+ export interface Data {
29
+ /**
30
+ * Unique identifier for the metric definition
31
+ */
32
+ id: string;
33
+
34
+ /**
35
+ * Description of what the metric measures
36
+ */
37
+ description: string;
38
+
39
+ /**
40
+ * Stable metric identifier
41
+ */
42
+ metricId: string;
43
+
44
+ /**
45
+ * Name of the metric
46
+ */
47
+ name: string;
48
+
49
+ /**
50
+ * Whether metric is global or per-participant
51
+ */
52
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
53
+
54
+ /**
55
+ * Which levels this metric can produce values at
56
+ */
57
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
58
+
59
+ /**
60
+ * Type of value this metric produces
61
+ */
62
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
63
+
64
+ /**
65
+ * Unit information if applicable
66
+ */
67
+ unit?: Data.Unit;
68
+ }
69
+
70
+ export namespace Data {
71
+ /**
72
+ * Unit information if applicable
73
+ */
74
+ export interface Unit {
75
+ /**
76
+ * Name of the unit
77
+ */
78
+ name: string;
79
+
80
+ /**
81
+ * Symbol for the unit
82
+ */
83
+ symbol: string | null;
84
+ }
85
+ }
86
+ }
87
+
88
+ export declare namespace Metric {
89
+ export { type MetricGetDefinitionsResponse as MetricGetDefinitionsResponse };
90
+ }