@roarkanalytics/sdk 9.12.0 → 9.14.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.
@@ -118,6 +118,22 @@ export class SimulationRunPlanJob extends APIResource {
118
118
  return this._client.get(path`/v1/simulation/plan/job/${jobID}/cost`, options);
119
119
  }
120
120
 
121
+ /**
122
+ * The run's most recent re-score, with its status and how many conversations have
123
+ * been graded.
124
+ *
125
+ * @example
126
+ * ```ts
127
+ * const response =
128
+ * await client.simulationRunPlanJob.getRescore(
129
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
130
+ * );
131
+ * ```
132
+ */
133
+ getRescore(jobID: string, options?: RequestOptions): APIPromise<SimulationRunPlanJobGetRescoreResponse> {
134
+ return this._client.get(path`/v1/simulation/plan/job/${jobID}/rescore`, options);
135
+ }
136
+
121
137
  /**
122
138
  * Everything the run report shows, in one request: the summary and score, the
123
139
  * pass/fail verdict, per-metric aggregates, every simulation with its check
@@ -145,6 +161,32 @@ export class SimulationRunPlanJob extends APIResource {
145
161
  return this._client.get(path`/v1/simulation/plan/job/${jobID}/results`, { query, ...options });
146
162
  }
147
163
 
164
+ /**
165
+ * Grade a finished run's calls again, without placing new calls: the same calls
166
+ * and metrics, with each metric's current version and the flows' current agent
167
+ * expectations. Use it after editing a metric or a flow's expectations, to see how
168
+ * the run you already have scores against them.
169
+ *
170
+ * The new values replace the run's current ones; earlier values stay in each
171
+ * metric value's history. The grading is billed like any metric collection. A run
172
+ * is re-scored one at a time: while one re-score runs, another is refused
173
+ * with 409.
174
+ *
175
+ * Returns immediately. Poll GET /v1/simulation/plan/job/{jobId}/rescore until
176
+ * `status` is COMPLETED or FAILED, then read the new values from GET
177
+ * /v1/simulation/plan/job/{jobId}/results.
178
+ *
179
+ * @example
180
+ * ```ts
181
+ * const response = await client.simulationRunPlanJob.rescore(
182
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
183
+ * );
184
+ * ```
185
+ */
186
+ rescore(jobID: string, options?: RequestOptions): APIPromise<SimulationRunPlanJobRescoreResponse> {
187
+ return this._client.post(path`/v1/simulation/plan/job/${jobID}/rescore`, options);
188
+ }
189
+
148
190
  /**
149
191
  * Deprecated: use POST /v1/simulation/run, which does the same thing and can also
150
192
  * take the plan configuration inline, so a one-off run does not have to create a
@@ -1461,6 +1503,13 @@ export namespace SimulationRunPlanJobGetByIDResponse {
1461
1503
  */
1462
1504
  checks: Array<Verdict.Check>;
1463
1505
 
1506
+ /**
1507
+ * Every simulation of the run that counts: the most any check can have in scope.
1508
+ * Compare a check's `inScopeSims` against it to see how much of the run the check
1509
+ * covers.
1510
+ */
1511
+ countedSims: number;
1512
+
1464
1513
  /**
1465
1514
  * Every criterion the run missed. Empty when it passed.
1466
1515
  */
@@ -1507,8 +1556,23 @@ export namespace SimulationRunPlanJobGetByIDResponse {
1507
1556
  * never appear here. Put a threshold on one to judge it.
1508
1557
  */
1509
1558
  export interface Check {
1559
+ /**
1560
+ * The flows this check is attached to. It is evaluated only on simulations of
1561
+ * these flows, and the rest of the run is out of its scope. Null when the check is
1562
+ * run-wide: attached to the run plan, so every simulation is in scope.
1563
+ */
1564
+ customerFlows: Array<Check.CustomerFlow> | null;
1565
+
1510
1566
  evaluatedSims: number;
1511
1567
 
1568
+ /**
1569
+ * Simulations the check applies to: every counted simulation for a run-wide check,
1570
+ * those of `customerFlows` otherwise. `evaluatedSims` can be lower: a check
1571
+ * returns no verdict on a simulation with nothing for it to grade, and that
1572
+ * simulation is left out of `passRate`.
1573
+ */
1574
+ inScopeSims: number;
1575
+
1512
1576
  /**
1513
1577
  * Whether `minPassRate` is the 80% default (`true`) or a minimum this metric set
1514
1578
  * for itself.
@@ -1539,6 +1603,23 @@ export namespace SimulationRunPlanJobGetByIDResponse {
1539
1603
  metricName?: string | null;
1540
1604
  }
1541
1605
 
1606
+ export namespace Check {
1607
+ /**
1608
+ * A flow one of the run's metrics is attached to.
1609
+ */
1610
+ export interface CustomerFlow {
1611
+ /**
1612
+ * The flow.
1613
+ */
1614
+ id: string;
1615
+
1616
+ /**
1617
+ * The flow as the run ran it. Null when no simulation of the run ran the flow.
1618
+ */
1619
+ name: string | null;
1620
+ }
1621
+ }
1622
+
1542
1623
  export interface UnionMember0 {
1543
1624
  /**
1544
1625
  * The status the run actually ended in.
@@ -1775,6 +1856,61 @@ export namespace SimulationRunPlanJobGetCostResponse {
1775
1856
  }
1776
1857
  }
1777
1858
 
1859
+ export interface SimulationRunPlanJobGetRescoreResponse {
1860
+ data: SimulationRunPlanJobGetRescoreResponse.Data;
1861
+ }
1862
+
1863
+ export namespace SimulationRunPlanJobGetRescoreResponse {
1864
+ export interface Data {
1865
+ /**
1866
+ * When the grading finished. Null while it runs.
1867
+ */
1868
+ completedAt: string | null;
1869
+
1870
+ /**
1871
+ * When the re-score was requested
1872
+ */
1873
+ createdAt: string;
1874
+
1875
+ /**
1876
+ * When the run's debrief was queued for a rewrite after this re-score. Null until
1877
+ * then, and for a run without a debrief.
1878
+ */
1879
+ debriefRequestedAt: string | null;
1880
+
1881
+ /**
1882
+ * Why the re-score failed to start, when it did
1883
+ */
1884
+ errorMessage: string | null;
1885
+
1886
+ /**
1887
+ * The simulation run plan job that was re-scored
1888
+ */
1889
+ jobId: string;
1890
+
1891
+ /**
1892
+ * Re-score ID
1893
+ */
1894
+ rescoreId: string;
1895
+
1896
+ /**
1897
+ * Conversations whose grading has finished
1898
+ */
1899
+ scoredConversations: number;
1900
+
1901
+ /**
1902
+ * RUNNING while the calls are graded again, then COMPLETED. FAILED when the
1903
+ * re-score could not start or its grading failed.
1904
+ */
1905
+ status: 'RUNNING' | 'COMPLETED' | 'FAILED';
1906
+
1907
+ /**
1908
+ * Conversations this re-score grades
1909
+ */
1910
+ totalConversations: number;
1911
+ }
1912
+ }
1913
+
1778
1914
  export interface SimulationRunPlanJobGetResultsResponse {
1779
1915
  /**
1780
1916
  * Everything the run report shows, in one response.
@@ -2276,6 +2412,12 @@ export namespace SimulationRunPlanJobGetResultsResponse {
2276
2412
  */
2277
2413
  check: Metric.Check | null;
2278
2414
 
2415
+ /**
2416
+ * The flows the metric is attached to: it is collected only on simulations of
2417
+ * these flows. Null when it is run-wide, collected on every simulation.
2418
+ */
2419
+ customerFlows: Array<Metric.CustomerFlow> | null;
2420
+
2279
2421
  /**
2280
2422
  * How many values took each reading, for BOOLEAN, SCALE and CLASSIFICATION
2281
2423
  * metrics. Null without the `metric:read` permission.
@@ -2287,6 +2429,12 @@ export namespace SimulationRunPlanJobGetResultsResponse {
2287
2429
  */
2288
2430
  evaluatedCalls: number;
2289
2431
 
2432
+ /**
2433
+ * Counted simulations the metric applies to: all of them for a run-wide metric,
2434
+ * those of `customerFlows` otherwise.
2435
+ */
2436
+ inScopeCalls: number;
2437
+
2290
2438
  /**
2291
2439
  * A threshold: one of the checks the run is judged on.
2292
2440
  */
@@ -2337,6 +2485,21 @@ export namespace SimulationRunPlanJobGetResultsResponse {
2337
2485
  passedCalls: number;
2338
2486
  }
2339
2487
 
2488
+ /**
2489
+ * A flow one of the run's metrics is attached to.
2490
+ */
2491
+ export interface CustomerFlow {
2492
+ /**
2493
+ * The flow.
2494
+ */
2495
+ id: string;
2496
+
2497
+ /**
2498
+ * The flow as the run ran it. Null when no simulation of the run ran the flow.
2499
+ */
2500
+ name: string | null;
2501
+ }
2502
+
2340
2503
  export interface Distribution {
2341
2504
  count: number;
2342
2505
 
@@ -2740,6 +2903,13 @@ export namespace SimulationRunPlanJobGetResultsResponse {
2740
2903
  */
2741
2904
  checks: Array<Verdict.Check>;
2742
2905
 
2906
+ /**
2907
+ * Every simulation of the run that counts: the most any check can have in scope.
2908
+ * Compare a check's `inScopeSims` against it to see how much of the run the check
2909
+ * covers.
2910
+ */
2911
+ countedSims: number;
2912
+
2743
2913
  /**
2744
2914
  * Every criterion the run missed. Empty when it passed.
2745
2915
  */
@@ -2786,8 +2956,23 @@ export namespace SimulationRunPlanJobGetResultsResponse {
2786
2956
  * never appear here. Put a threshold on one to judge it.
2787
2957
  */
2788
2958
  export interface Check {
2959
+ /**
2960
+ * The flows this check is attached to. It is evaluated only on simulations of
2961
+ * these flows, and the rest of the run is out of its scope. Null when the check is
2962
+ * run-wide: attached to the run plan, so every simulation is in scope.
2963
+ */
2964
+ customerFlows: Array<Check.CustomerFlow> | null;
2965
+
2789
2966
  evaluatedSims: number;
2790
2967
 
2968
+ /**
2969
+ * Simulations the check applies to: every counted simulation for a run-wide check,
2970
+ * those of `customerFlows` otherwise. `evaluatedSims` can be lower: a check
2971
+ * returns no verdict on a simulation with nothing for it to grade, and that
2972
+ * simulation is left out of `passRate`.
2973
+ */
2974
+ inScopeSims: number;
2975
+
2791
2976
  /**
2792
2977
  * Whether `minPassRate` is the 80% default (`true`) or a minimum this metric set
2793
2978
  * for itself.
@@ -2818,6 +3003,23 @@ export namespace SimulationRunPlanJobGetResultsResponse {
2818
3003
  metricName?: string | null;
2819
3004
  }
2820
3005
 
3006
+ export namespace Check {
3007
+ /**
3008
+ * A flow one of the run's metrics is attached to.
3009
+ */
3010
+ export interface CustomerFlow {
3011
+ /**
3012
+ * The flow.
3013
+ */
3014
+ id: string;
3015
+
3016
+ /**
3017
+ * The flow as the run ran it. Null when no simulation of the run ran the flow.
3018
+ */
3019
+ name: string | null;
3020
+ }
3021
+ }
3022
+
2821
3023
  export interface UnionMember0 {
2822
3024
  /**
2823
3025
  * The status the run actually ended in.
@@ -2920,6 +3122,61 @@ export namespace SimulationRunPlanJobGetResultsResponse {
2920
3122
  }
2921
3123
  }
2922
3124
 
3125
+ export interface SimulationRunPlanJobRescoreResponse {
3126
+ data: SimulationRunPlanJobRescoreResponse.Data;
3127
+ }
3128
+
3129
+ export namespace SimulationRunPlanJobRescoreResponse {
3130
+ export interface Data {
3131
+ /**
3132
+ * When the grading finished. Null while it runs.
3133
+ */
3134
+ completedAt: string | null;
3135
+
3136
+ /**
3137
+ * When the re-score was requested
3138
+ */
3139
+ createdAt: string;
3140
+
3141
+ /**
3142
+ * When the run's debrief was queued for a rewrite after this re-score. Null until
3143
+ * then, and for a run without a debrief.
3144
+ */
3145
+ debriefRequestedAt: string | null;
3146
+
3147
+ /**
3148
+ * Why the re-score failed to start, when it did
3149
+ */
3150
+ errorMessage: string | null;
3151
+
3152
+ /**
3153
+ * The simulation run plan job that was re-scored
3154
+ */
3155
+ jobId: string;
3156
+
3157
+ /**
3158
+ * Re-score ID
3159
+ */
3160
+ rescoreId: string;
3161
+
3162
+ /**
3163
+ * Conversations whose grading has finished
3164
+ */
3165
+ scoredConversations: number;
3166
+
3167
+ /**
3168
+ * RUNNING while the calls are graded again, then COMPLETED. FAILED when the
3169
+ * re-score could not start or its grading failed.
3170
+ */
3171
+ status: 'RUNNING' | 'COMPLETED' | 'FAILED';
3172
+
3173
+ /**
3174
+ * Conversations this re-score grades
3175
+ */
3176
+ totalConversations: number;
3177
+ }
3178
+ }
3179
+
2923
3180
  export interface SimulationRunPlanJobStartResponse {
2924
3181
  /**
2925
3182
  * Response when triggering a simulation run plan
@@ -3107,7 +3364,9 @@ export declare namespace SimulationRunPlanJob {
3107
3364
  type SimulationRunPlanJobCreateDebriefResponse as SimulationRunPlanJobCreateDebriefResponse,
3108
3365
  type SimulationRunPlanJobGetByIDResponse as SimulationRunPlanJobGetByIDResponse,
3109
3366
  type SimulationRunPlanJobGetCostResponse as SimulationRunPlanJobGetCostResponse,
3367
+ type SimulationRunPlanJobGetRescoreResponse as SimulationRunPlanJobGetRescoreResponse,
3110
3368
  type SimulationRunPlanJobGetResultsResponse as SimulationRunPlanJobGetResultsResponse,
3369
+ type SimulationRunPlanJobRescoreResponse as SimulationRunPlanJobRescoreResponse,
3111
3370
  type SimulationRunPlanJobStartResponse as SimulationRunPlanJobStartResponse,
3112
3371
  type SimulationRunPlanJobListParams as SimulationRunPlanJobListParams,
3113
3372
  type SimulationRunPlanJobCreateDebriefParams as SimulationRunPlanJobCreateDebriefParams,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '9.12.0'; // x-release-please-version
1
+ export const VERSION = '9.14.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "9.12.0";
1
+ export declare const VERSION = "9.14.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "9.12.0";
1
+ export declare const VERSION = "9.14.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '9.12.0'; // x-release-please-version
4
+ exports.VERSION = '9.14.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '9.12.0'; // x-release-please-version
1
+ export const VERSION = '9.14.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map