runbios-sdk 0.2.20 → 0.2.21-dev.294

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/dist/types.d.ts CHANGED
@@ -8,13 +8,13 @@ export interface BiOSConfig {
8
8
  orgId?: string;
9
9
  /** Workspace ID. Optional when using API keys (resolved from the key). Can override for multi-workspace keys. */
10
10
  workspaceId?: string;
11
- /** Base URL for the API. Falls back to the RUNBIOS_BASE_URL environment variable (legacy: BIOS_BASE_URL), then the canonical https://api.runbios.ai hostname. */
11
+ /** Base URL for the API. Falls back to the RUNBIOS_BASE_URL environment variable (legacy: BIOS_BASE_URL), then the canonical https://api-dev.runbios.ai hostname. */
12
12
  baseUrl?: string;
13
13
  /** Request timeout in milliseconds. Defaults to 30000. */
14
14
  timeout?: number;
15
15
  /** Default per-deployment inference key. Can be overridden per inference call. */
16
16
  inferenceKey?: string;
17
- /** Inference base URL. Defaults to baseUrl, then https://api.runbios.ai. */
17
+ /** Inference base URL. Defaults to baseUrl, then https://api-dev.runbios.ai. */
18
18
  inferenceBaseUrl?: string;
19
19
  /** End-to-end inference timeout in milliseconds. Defaults to 15 minutes. */
20
20
  inferenceTimeout?: number;
@@ -178,14 +178,6 @@ export interface Model {
178
178
  /** Run BiOS-side usage rollups for this model. */
179
179
  train_count?: number;
180
180
  inference_count?: number;
181
- verified_at?: string | null;
182
- /** Per-surface verification badges plus the image build that passed. */
183
- training_verified?: boolean;
184
- training_verified_at?: string | null;
185
- training_verified_image?: string;
186
- inference_verified?: boolean;
187
- inference_verified_at?: string | null;
188
- inference_verified_image?: string;
189
181
  updated_at?: string;
190
182
  /**
191
183
  * Native max context window in tokens -- the ceiling a deployment's
@@ -757,6 +749,14 @@ export interface TrainingJob {
757
749
  has_cached_dataset?: boolean;
758
750
  final_model_s3_key?: string | null;
759
751
  final_artifact_verified?: boolean;
752
+ /** Final model of a completed run: 'verified' (stored), 'deleted' (was saved and
753
+ * verified, then deleted on purpose; not a failed save), 'unavailable' (never
754
+ * committed). '' for runs that are not completed; absent on older backends. */
755
+ final_artifact_state?: 'verified' | 'deleted' | 'unavailable' | '';
756
+ /** When a 'deleted' final model was removed. */
757
+ final_artifact_deleted_at?: string | null;
758
+ /** Who removed it: 'you' | 'member' | 'system:pipeline_deleted' | 'system:save_total_limit' | other 'system:*'. */
759
+ final_artifact_deleted_by?: string | null;
760
760
  mix_manifest?: Record<string, unknown> | null;
761
761
  preserve_on_stop?: boolean;
762
762
  desired_state?: 'running' | 'stopped';
@@ -2784,6 +2784,7 @@ export interface LoopMetricPoint {
2784
2784
  mean_delta: number | null;
2785
2785
  judge_incumbent_mean: number | null;
2786
2786
  judge_candidate_mean: number | null;
2787
+ /** The trainer's loss on its validation slice, as {@link Evaluation.trainer_eval_loss}. */
2787
2788
  trainer_eval_loss: number | null;
2788
2789
  /** The bar this attempt had to clear, frozen with its report. */
2789
2790
  promote_margin: number | null;
@@ -2901,9 +2902,34 @@ export type TrainingRunState = 'built' | 'registering' | 'dataset_validating' |
2901
2902
  /** The closed set a run never leaves. */
2902
2903
  export declare const TERMINAL_RUN_STATES: readonly TrainingRunState[];
2903
2904
  export type TrainingVerdict = 'better' | 'not_better' | 'inconclusive' | 'not_evaluated';
2904
- export type TrainingDecision = 'auto_promoted' | 'promoted' | 'rejected' | 'auto_rejected' | 'rolled_back';
2905
+ /**
2906
+ * What was decided about a compared attempt, and who decided: `promoted` (a
2907
+ * member put it live), `auto_promoted`, `rejected` (a member chose not to
2908
+ * publish it), `auto_rejected` (the pipeline's rule turned it down on its
2909
+ * own), `expired` (nobody decided before the review deadline, so it was
2910
+ * retired; its verdict, `better` included, stands) or `rolled_back`.
2911
+ */
2912
+ export type TrainingDecision = 'auto_promoted' | 'promoted' | 'rejected' | 'auto_rejected' | 'expired' | 'rolled_back';
2905
2913
  export type EvaluationStatus = 'open' | 'done' | 'failed' | 'budget_stopped';
2906
2914
  export type EvaluationItemStatus = 'pending' | 'working' | 'done' | 'failed';
2915
+ /**
2916
+ * Why a failed conversation of a report failed (`error_code` on both items
2917
+ * routes), from a closed set; the row's `error` is the sentence for a person.
2918
+ * unreadable / unprepared: the conversation could not be read or prepared to
2919
+ * be asked. too_large_to_keep: too large to keep in storage. no_right_answer:
2920
+ * an exact-check benchmark's conversation with no right answer.
2921
+ * incumbent_unanswered / candidate_unanswered / scorer_failed: on its last
2922
+ * try the other side, or the new model, could not answer, or an answer could
2923
+ * not be scored. ended_outage / ended_deployment_stopped / ended_unscorable:
2924
+ * the comparison ended before it (an outage on the platform's side, a
2925
+ * stopped deployment, nothing able to score it). run_ended / replay_ended: its
2926
+ * attempt or replay ended first. answers_not_kept: replayed, its answers
2927
+ * held until storage could keep them, and storage could not before the
2928
+ * replay ended (a conversation never asked is replay_ended). not_finished:
2929
+ * its tries (or the comparison's money) ran out with nothing more particular
2930
+ * recorded.
2931
+ */
2932
+ export type ItemErrorCode = 'unreadable' | 'unprepared' | 'too_large_to_keep' | 'no_right_answer' | 'incumbent_unanswered' | 'candidate_unanswered' | 'scorer_failed' | 'ended_outage' | 'ended_deployment_stopped' | 'ended_unscorable' | 'run_ended' | 'replay_ended' | 'answers_not_kept' | 'not_finished';
2907
2933
  export type EvaluationWinner = 'candidate' | 'incumbent' | 'tie';
2908
2934
  /** Typed warning codes. Each surface renders its own plain sentence. */
2909
2935
  export type EvaluationWarningCode = 'holdout_too_small' | 'judge_unreliable' | 'graders_not_applied' | 'many_failures' | 'no_judge' | 'judge_labelled_training_rows' | 'capture_source_moved';
@@ -3005,6 +3031,7 @@ export interface TrainingRun {
3005
3031
  train_rows: number | null;
3006
3032
  holdout_rows: number | null;
3007
3033
  train_dataset_id: string | null;
3034
+ /** Null on a run made since the held-back rows stopped leaving the loop; set on older runs. */
3008
3035
  holdout_dataset_id: string | null;
3009
3036
  training_job_id: string | null;
3010
3037
  job_status: string | null;
@@ -3029,6 +3056,7 @@ export interface TrainingRun {
3029
3056
  model_family: string | null;
3030
3057
  /** Machine time the run held (training job plus comparison machine); null until known. */
3031
3058
  gpu_seconds: number | null;
3059
+ /** The trainer's loss on its validation slice, as {@link Evaluation.trainer_eval_loss}. */
3032
3060
  training_eval_loss: number | null;
3033
3061
  candidate_deployment_id: string | null;
3034
3062
  candidate_name: string | null;
@@ -3119,6 +3147,7 @@ export interface TrainingRunEvent {
3119
3147
  export interface TrainingRunLinks {
3120
3148
  training_job_url: string | null;
3121
3149
  candidate_url: string | null;
3150
+ /** The console page of this attempt's comparison report, every conversation included. */
3122
3151
  evaluation_url: string | null;
3123
3152
  /** The TREND the benchmark number belongs to, not the one replay. */
3124
3153
  benchmark_url: string | null;
@@ -3189,8 +3218,25 @@ export interface Evaluation {
3189
3218
  mean_delta: number | null;
3190
3219
  judge_incumbent_mean: number | null;
3191
3220
  judge_candidate_mean: number | null;
3221
+ /**
3222
+ * An answer PASSED (score 0.70 or more) when the judge scored it at least
3223
+ * `pass_threshold`; an answer with no score never passes. `*_passed`
3224
+ * counts the conversations each side passed, and `*_pass_rate` is that
3225
+ * count over `rows_scored`. The counts are null until the report is
3226
+ * finished, and the rates also when nothing was scored.
3227
+ */
3228
+ pass_threshold: number;
3229
+ incumbent_passed: number | null;
3230
+ candidate_passed: number | null;
3231
+ incumbent_pass_rate: number | null;
3232
+ candidate_pass_rate: number | null;
3192
3233
  per_dimension: EvaluationDimensionScore[];
3193
- /** Informational: there is no incumbent counterpart to compare it against. */
3234
+ /**
3235
+ * The trainer's loss on its validation slice: about 5% of the rows the
3236
+ * attempt trains on, kept aside to pick the best checkpoint. Informational:
3237
+ * there is no incumbent counterpart to compare it against, and it is not
3238
+ * measured on the held-back conversations this report compares.
3239
+ */
3194
3240
  trainer_eval_loss: number | null;
3195
3241
  warnings: EvaluationWarning[];
3196
3242
  verdict: TrainingVerdict | null;
@@ -3204,12 +3250,61 @@ export interface Evaluation {
3204
3250
  created_at: string;
3205
3251
  finished_at: string | null;
3206
3252
  }
3253
+ /**
3254
+ * What the judge made of one answer: its overall score, one score per rubric
3255
+ * dimension (keyed as `judge_dimensions` names them), and the judge's reason
3256
+ * in its own words, with anything that looks like a credential or a personal
3257
+ * detail removed. `reason` is null when the judge gave none.
3258
+ */
3259
+ export interface EvaluationItemJudge {
3260
+ overall: number;
3261
+ dimensions: Record<string, number>;
3262
+ reason: string | null;
3263
+ }
3264
+ /**
3265
+ * Where a conversation's reference answer came from: a person said the
3266
+ * model's own answer was `good`, a person's `correction`, or a `gold` answer
3267
+ * written as the right one.
3268
+ */
3269
+ export type EvaluationReferenceKind = 'good' | 'correction' | 'gold';
3270
+ /**
3271
+ * What a person said the right answer is, frozen with the report and shown
3272
+ * to the judge beside both answers. Null on a conversation nobody gave one.
3273
+ *
3274
+ * A right answer is its text AND the tool calls it makes: an answer marked
3275
+ * good that only calls a tool has `answer` `""` and its calls.
3276
+ * `tool_calls` is null when it makes none.
3277
+ */
3278
+ export interface EvaluationReference {
3279
+ answer: string;
3280
+ kind: EvaluationReferenceKind;
3281
+ tool_calls: TrainingToolCall[] | null;
3282
+ }
3283
+ /** Which answer the judge preferred in one order of showing them, and why. */
3284
+ export interface EvaluationPairwiseOrder {
3285
+ winner: EvaluationWinner;
3286
+ reason: string | null;
3287
+ }
3288
+ /**
3289
+ * The direct comparison, asked twice: once with the serving version's answer
3290
+ * shown first and once with the attempt's first. A win counts only when both
3291
+ * orders pick the same side (`agreed`); anything else is a `tie`, which is
3292
+ * what removes the judge's preference for whichever answer it reads first.
3293
+ */
3294
+ export interface EvaluationItemPairwise {
3295
+ incumbent_first: EvaluationPairwiseOrder;
3296
+ candidate_first: EvaluationPairwiseOrder;
3297
+ winner: EvaluationWinner;
3298
+ agreed: boolean;
3299
+ }
3207
3300
  /** One model's answer to one held-out conversation, with the scores it earned. */
3208
3301
  export interface EvaluationItemSide {
3209
3302
  completion: string | null;
3210
3303
  tool_calls: TrainingToolCall[] | null;
3211
- judge: Record<string, unknown> | null;
3304
+ judge: EvaluationItemJudge | null;
3212
3305
  score: number | null;
3306
+ /** True when it passed (score 0.70 or more); null when it has no score. */
3307
+ passed: boolean | null;
3213
3308
  model_version: string | null;
3214
3309
  }
3215
3310
  /**
@@ -3225,12 +3320,17 @@ export interface EvaluationItem {
3225
3320
  trace_url: string | null;
3226
3321
  prompt: TrainingMessage[];
3227
3322
  tools: unknown[] | null;
3323
+ reference: EvaluationReference | null;
3228
3324
  incumbent: EvaluationItemSide;
3229
3325
  candidate: EvaluationItemSide;
3326
+ /** Null on a conversation compared before both orders were kept. */
3327
+ pairwise: EvaluationItemPairwise | null;
3230
3328
  human_verdict: number | null;
3231
3329
  winner: EvaluationWinner | null;
3232
3330
  status: EvaluationItemStatus;
3233
3331
  error: string | null;
3332
+ /** Why the row failed; null unless it failed, and on a row failed before causes were kept. */
3333
+ error_code: ItemErrorCode | null;
3234
3334
  }
3235
3335
  /**
3236
3336
  * Which pairs to read: the ones the attempt won (`candidate`), the ones the
@@ -3238,8 +3338,39 @@ export interface EvaluationItem {
3238
3338
  * or the ties.
3239
3339
  */
3240
3340
  export type EvaluationItemWinnerFilter = 'candidate' | 'serving' | 'tie';
3341
+ /** A row's status: scored, or failed (could not be scored). */
3342
+ export type ReportStatusFilter = 'scored' | 'failed';
3343
+ /**
3344
+ * The order of a report's rows: its own (`ordinal`, the default), or the new
3345
+ * model's score less the other's, largest first (`score_change`).
3346
+ */
3347
+ export type ReportSort = 'ordinal' | 'score_change';
3348
+ /**
3349
+ * Which rows of a report to read, and in what order. Every filter narrows the
3350
+ * page and `total` alike; a value the service does not take is refused 400
3351
+ * naming it. `candidate_passed` and `incumbent_passed` are one side each and
3352
+ * compose: `true` is that side's answer passed (score 0.70 or more), `false`
3353
+ * that it was scored below 0.70, and a side with no score matches neither --
3354
+ * `candidate_passed: false, incumbent_passed: true` is the regressions,
3355
+ * `candidate_passed: false` alone every row the new model did not pass.
3356
+ * `q` (2 to 200 characters) searches, case-insensitively, what a
3357
+ * reader of each row sees -- the conversation, the right answer, both answers
3358
+ * and their tool calls, every reason -- read from storage by the service; the
3359
+ * answer's `searched` says how many rows it searched. A search can be refused
3360
+ * 429 `RATE_LIMITED`, with `Retry-After`, while this workspace already has a
3361
+ * search running or while the service is running as many searches as it can
3362
+ * at once; try again after `Retry-After` seconds (the message says how many).
3363
+ */
3241
3364
  export interface EvaluationItemListParams {
3242
3365
  winner?: EvaluationItemWinnerFilter;
3366
+ candidate_passed?: boolean;
3367
+ incumbent_passed?: boolean;
3368
+ /** Whether the two side-by-side orders picked the same side. */
3369
+ orders?: 'agreed' | 'disagreed';
3370
+ has_reference?: boolean;
3371
+ status?: ReportStatusFilter;
3372
+ sort?: ReportSort;
3373
+ q?: string;
3243
3374
  /** 50 when absent; at most 200. */
3244
3375
  limit?: number;
3245
3376
  offset?: number;
@@ -3290,11 +3421,31 @@ export type BenchmarkRunStatus = 'open' | 'done' | 'failed' | 'budget_stopped' |
3290
3421
  * is a missing number, never a lower one.
3291
3422
  */
3292
3423
  export interface BenchmarkScoring {
3424
+ /** `judge_overall` (a scoring model) or `exact_match` (the exact check). */
3293
3425
  metric: string;
3294
3426
  scale: string;
3295
3427
  aggregate: string;
3296
3428
  require_all_rows: boolean;
3297
3429
  }
3430
+ /**
3431
+ * How a benchmark's answers are scored, chosen when it is made and frozen:
3432
+ *
3433
+ * - `judge` (the default): a scoring model reads both answers against the
3434
+ * right answer, as for the held-back set.
3435
+ * - `exact`: the answer or the tool call must match the right answer, and no
3436
+ * model is asked. When the right answer calls tools, the answer must make
3437
+ * the same calls (the same tools with JSON-equal arguments, in any order,
3438
+ * none left out and none extra; its text is not read); otherwise its text
3439
+ * must be the right answer's ignoring case and spacing, or both the same
3440
+ * number (a currency or percent sign on one side only is ignored; `$20` is
3441
+ * not `20%` or `€20`). 1 or 0, and each side's `judge` is
3442
+ * `{overall, dimensions: {match}, reason}`, the reason saying what matched
3443
+ * or what differed. Every conversation needs a right answer. A value hidden
3444
+ * when the conversation was captured (an email, a long number, an IP
3445
+ * address or a key, kept as `[redacted:...]`) cannot be checked: an answer
3446
+ * that matches everywhere else still scores 0, and the reason says so.
3447
+ */
3448
+ export type BenchmarkCheck = 'judge' | 'exact';
3298
3449
  /**
3299
3450
  * One rubric dimension of one replay, for both models.
3300
3451
  *
@@ -3307,6 +3458,19 @@ export interface BenchmarkDimensionScore {
3307
3458
  candidate: number;
3308
3459
  delta: number;
3309
3460
  }
3461
+ /**
3462
+ * What a pipeline's history, or a benchmark's pinned set, takes up in storage
3463
+ * right now. Conversations, answers and scoring, and the training rows of a
3464
+ * pipeline's curated sets, are kept in storage only, never in the database. Not billed; it counts toward the workspace's storage
3465
+ * quota and is deleted with the pipeline (a benchmark's with the workspace).
3466
+ * `where` is null while nothing is stored.
3467
+ */
3468
+ export type LoopStorageWhere = 'platform' | 'your_storage' | 'both';
3469
+ export interface LoopStorage {
3470
+ bytes: number;
3471
+ objects: number;
3472
+ where: LoopStorageWhere | null;
3473
+ }
3310
3474
  /**
3311
3475
  * The frozen definition: the oracle, the scoring rule and the fingerprint of
3312
3476
  * the set. The conversations themselves are their own paged route.
@@ -3316,6 +3480,11 @@ export interface Benchmark {
3316
3480
  workspace_id: string;
3317
3481
  name: string;
3318
3482
  status: BenchmarkStatus;
3483
+ /**
3484
+ * How its answers are scored (`scoring.metric` read out). On an `exact`
3485
+ * benchmark `judge_model` is `""` and the judge fields describe the check.
3486
+ */
3487
+ check: BenchmarkCheck;
3319
3488
  /** Provenance only: everything needed from the judge is copied below it. */
3320
3489
  judge_id: string | null;
3321
3490
  judge_name: string;
@@ -3331,6 +3500,8 @@ export interface Benchmark {
3331
3500
  created_at: string;
3332
3501
  retired_at: string | null;
3333
3502
  retired_by: string | null;
3503
+ /** What the pinned set takes up in storage. */
3504
+ storage: LoopStorage;
3334
3505
  }
3335
3506
  /**
3336
3507
  * One pinned conversation.
@@ -3347,15 +3518,22 @@ export interface BenchmarkItem {
3347
3518
  source_trace_url: string | null;
3348
3519
  prompt: TrainingMessage[];
3349
3520
  tools: unknown[] | null;
3521
+ /** The right answer pinned with it, calls and all; null when nobody gave one. */
3522
+ reference: EvaluationReference | null;
3350
3523
  }
3351
3524
  /**
3352
3525
  * One replay: this benchmark, on this training run, against both models.
3353
3526
  *
3354
- * IT DOES NOT GATE PROMOTION. The paired comparison applies the judge to both
3355
- * sides of one conversation in one pass, so most of the judge's variance
3356
- * cancels in its delta; an absolute mean carries that variance whole. What
3357
- * ships here is the number, the difference against what serves today on the
3358
- * same set, and the history. A person reads the trend.
3527
+ * IT DECIDES A PROMOTION ONLY UNDER A POLICY THAT READS BENCHMARKS. The
3528
+ * paired comparison applies the judge to both sides of one conversation in
3529
+ * one pass, so most of the judge's variance cancels in its delta; an absolute
3530
+ * mean carries that variance whole. Under the default `holdout` policy a
3531
+ * replay is the number, the difference against what serves today on the same
3532
+ * set, and the history, and a person reads the trend. Under `all`, `primary`,
3533
+ * `k_of_n` or `weighted` the policy reads this replay's delta.
3534
+ *
3535
+ * Every conversation behind it, both answers and the judge's reasons, is
3536
+ * `listBenchmarkRunItems`.
3359
3537
  */
3360
3538
  export interface BenchmarkRun {
3361
3539
  id: string;
@@ -3375,6 +3553,27 @@ export interface BenchmarkRun {
3375
3553
  incumbent_score: number | null;
3376
3554
  score_delta: number | null;
3377
3555
  per_dimension: BenchmarkDimensionScore[];
3556
+ /**
3557
+ * An answer PASSED (score 0.70 or more) when the judge scored it at least
3558
+ * `pass_threshold`. `*_passed` counts the conversations each side passed
3559
+ * and `*_pass_rate` is that count over `rows_scored`: null unless `status`
3560
+ * is `done`, like the scores.
3561
+ */
3562
+ pass_threshold: number;
3563
+ incumbent_passed: number | null;
3564
+ candidate_passed: number | null;
3565
+ incumbent_pass_rate: number | null;
3566
+ candidate_pass_rate: number | null;
3567
+ /**
3568
+ * Conversations the attempt scored higher on (`wins`), lower on (`losses`),
3569
+ * or about the same on (`ties`) as the serving version, by the tie band
3570
+ * promotion uses: 0.02 or more above counts as higher; less than 0.02 apart
3571
+ * is about the same.
3572
+ * Null unless `status` is `done`.
3573
+ */
3574
+ wins: number | null;
3575
+ losses: number | null;
3576
+ ties: number | null;
3378
3577
  prompt_tokens: number;
3379
3578
  completion_tokens: number;
3380
3579
  spent_cents: number;
@@ -3406,11 +3605,71 @@ export interface BenchmarkHistoryPoint {
3406
3605
  candidate_score: number | null;
3407
3606
  incumbent_score: number | null;
3408
3607
  score_delta: number | null;
3608
+ /** The share each side passed (score 0.70 or more); null when the replay has no score. */
3609
+ incumbent_pass_rate: number | null;
3610
+ candidate_pass_rate: number | null;
3409
3611
  checkpoint_id: string | null;
3410
3612
  decision: TrainingDecision | null;
3411
3613
  status: BenchmarkRunStatus;
3412
3614
  status_reason: string | null;
3413
3615
  }
3616
+ /**
3617
+ * One model's answer to one pinned conversation in a replay -- its text and
3618
+ * the tool calls it made (null when none, and on a replay scored before they
3619
+ * were kept) -- and its score. On an exact benchmark `judge` is the exact
3620
+ * check's verdict.
3621
+ */
3622
+ export interface BenchmarkRunItemSide {
3623
+ completion: string | null;
3624
+ tool_calls: TrainingToolCall[] | null;
3625
+ judge: EvaluationItemJudge | null;
3626
+ score: number | null;
3627
+ /** True when it passed (score 0.70 or more); null when it has no score. */
3628
+ passed: boolean | null;
3629
+ }
3630
+ /**
3631
+ * One pinned conversation of one replay: the prompt, both answers, what the
3632
+ * judge made of each, and which side won it.
3633
+ *
3634
+ * `winner` compares the two scores by the tie band promotion uses: the side
3635
+ * scoring 0.02 or more above the other, `tie` when they are less than 0.02
3636
+ * apart, and null until both are scored.
3637
+ * `source_trace_id` goes null once the conversation it was pinned from is
3638
+ * deleted; the pinned copy stays.
3639
+ */
3640
+ export interface BenchmarkRunItem {
3641
+ id: number;
3642
+ benchmark_item_id: number;
3643
+ ordinal: number;
3644
+ source_trace_id: string | null;
3645
+ source_trace_url: string | null;
3646
+ prompt: TrainingMessage[];
3647
+ tools: unknown[] | null;
3648
+ reference: EvaluationReference | null;
3649
+ incumbent: BenchmarkRunItemSide;
3650
+ candidate: BenchmarkRunItemSide;
3651
+ winner: EvaluationWinner | null;
3652
+ status: EvaluationItemStatus;
3653
+ error: string | null;
3654
+ /** Why the row failed; null unless it failed, and on a row failed before causes were kept. */
3655
+ error_code: ItemErrorCode | null;
3656
+ }
3657
+ /**
3658
+ * Which conversations of a replay to read: the filters a report's items take,
3659
+ * but `orders` -- a replay has no side-by-side reading.
3660
+ */
3661
+ export interface BenchmarkRunItemListParams {
3662
+ winner?: EvaluationItemWinnerFilter;
3663
+ candidate_passed?: boolean;
3664
+ incumbent_passed?: boolean;
3665
+ has_reference?: boolean;
3666
+ status?: ReportStatusFilter;
3667
+ sort?: ReportSort;
3668
+ q?: string;
3669
+ /** 50 when absent; at most 200. */
3670
+ limit?: number;
3671
+ offset?: number;
3672
+ }
3414
3673
  /**
3415
3674
  * Where the conversations are copied FROM. Read once, at creation, never again.
3416
3675
  * A benchmark pins conversations by id; to make one from a file, import it
@@ -3424,20 +3683,30 @@ export interface BenchmarkSource {
3424
3683
  /**
3425
3684
  * The pin: 20 to 200 conversations, and a judge with a rubric to measure them.
3426
3685
  *
3427
- * A conversation with nothing to ask a model is refused rather than skipped.
3686
+ * A conversation with nothing to ask a model, or too large to keep in
3687
+ * storage, is refused (422 `BENCHMARK_ROW_UNUSABLE`) rather than skipped.
3428
3688
  * Pinning 47 of the 50 somebody chose is the set being wrong from the first
3429
3689
  * day, and they would never find out.
3430
3690
  */
3431
3691
  /**
3432
- * A name and the conversations, nothing else. The platform freezes the judge
3433
- * and the model it scores on, gives both models the comparison's own answer
3434
- * length, and sets what one replay may spend; none of that is sent (the
3435
- * service refuses `judge_id`, `judge_model`, `max_tokens` and
3436
- * `per_run_ceiling_cents` by name).
3692
+ * A name, the conversations and how they are scored, nothing else. The
3693
+ * platform freezes the judge and the model it scores on, gives both models
3694
+ * the comparison's own answer length, and sets what one replay may spend;
3695
+ * none of that is sent (the service refuses `judge_id`, `judge_model`,
3696
+ * `max_tokens` and `per_run_ceiling_cents` by name).
3697
+ *
3698
+ * `check` is `judge` when absent. An `exact` benchmark needs a right answer
3699
+ * on every conversation: one without is refused 422
3700
+ * `BENCHMARK_ROW_HAS_NO_ANSWER`, naming it, and nothing is saved. One with
3701
+ * nothing to ask a model, or too large to keep in storage, is refused 422
3702
+ * `BENCHMARK_ROW_UNUSABLE`, naming it; and when the conversations cannot be
3703
+ * stored just then the create is refused 409 `CONFLICT` with nothing saved
3704
+ * (try again in a minute).
3437
3705
  */
3438
3706
  export interface BenchmarkCreateParams {
3439
3707
  name: string;
3440
3708
  source: BenchmarkSource;
3709
+ check?: BenchmarkCheck;
3441
3710
  }
3442
3711
  export interface BenchmarkListParams {
3443
3712
  status?: BenchmarkStatus;
@@ -3506,6 +3775,10 @@ export type TrainingRuleRunRefusalCode = 'NOT_ENOUGH_SAMPLES' | 'PIPELINE_NEEDS_
3506
3775
  * body (400, which names the field). The SDK's tests read them off the
3507
3776
  * service. Nothing is saved when any of them is answered.
3508
3777
  *
3778
+ * A `train_when.min_samples` is one of those 400s: the sample minimums are
3779
+ * fixed by the platform (`listModels` returns them as `floors`) and no body
3780
+ * sets them.
3781
+ *
3509
3782
  * The name and tags:
3510
3783
  * - `PIPELINE_NAME_TAKEN` (409): another pipeline in the workspace has the
3511
3784
  * name, a deleted one included. Choose another name.
@@ -3514,17 +3787,20 @@ export type TrainingRuleRunRefusalCode = 'NOT_ENOUGH_SAMPLES' | 'PIPELINE_NEEDS_
3514
3787
  *
3515
3788
  * An edit only:
3516
3789
  * - `REVISION_MISMATCH` (409): `expected_revision` is not the pipeline's
3517
- * revision any more. Read it again and resend.
3790
+ * revision any more, or the pipeline changed while the edit was being saved
3791
+ * (a version went live, which can change its models). Nothing was saved.
3792
+ * Read it again and resend.
3518
3793
  * - `RUN_ACTIVE` (409): the model cannot change while an attempt is running.
3519
3794
  * - `NOT_A_SIMPLE_PIPELINE` (409): a tag, use case or challenger edit on a
3520
3795
  * pipeline created before pipelines had them; its other settings can
3521
3796
  * still change.
3522
3797
  *
3523
- * The model and when to train:
3798
+ * The model and how it is promoted:
3524
3799
  * - `MODEL_NOT_TRAINABLE` (422): `model.id` or `challenger_model.id` is not a
3525
- * model `listModels` offers, or the challenger is the model itself.
3526
- * - `MIN_SAMPLES_TOO_LOW` (422): `train_when.min_samples` is under the floor
3527
- * `listModels` returns as `floors.new_samples`.
3800
+ * model `listModels` offers, or the challenger is the model itself. On an
3801
+ * edit only a changed id is checked against the list: an id equal to the
3802
+ * pipeline's current one (ignoring case) is kept, and whether it can still
3803
+ * be trained is checked when an attempt starts.
3528
3804
  * - `NO_GPU_FITS` (422): no machines can train or serve the model right now.
3529
3805
  * - `MODEL_REVISION_UNAVAILABLE` (422): the model could not be pinned to an
3530
3806
  * exact revision because the training service did not answer. Try again
@@ -3552,7 +3828,7 @@ export type TrainingRuleRunRefusalCode = 'NOT_ENOUGH_SAMPLES' | 'PIPELINE_NEEDS_
3552
3828
  * the key every comparison is scored with) did not answer just then. Try
3553
3829
  * again in a minute.
3554
3830
  */
3555
- export type TrainingRuleSaveRefusalCode = 'PIPELINE_NAME_TAKEN' | 'OWN_TAG_TAKEN' | 'REVISION_MISMATCH' | 'RUN_ACTIVE' | 'NOT_A_SIMPLE_PIPELINE' | 'MODEL_NOT_TRAINABLE' | 'MIN_SAMPLES_TOO_LOW' | 'NO_GPU_FITS' | 'MODEL_REVISION_UNAVAILABLE' | 'NO_JUDGE_MODEL' | 'PROMOTION_POLICY_UNKNOWN' | 'PROMOTION_K_REQUIRED' | 'PROMOTION_K_UNREACHABLE' | 'PROMOTION_POLICY_NEEDS_BENCHMARK' | 'TRAINING_NOT_ENABLED' | 'METHOD_NOT_ENABLED' | 'CEILING_TOO_LOW' | 'MODELS_UNAVAILABLE' | 'GPU_OPTIONS_UNAVAILABLE' | 'AGENT_COULD_NOT_START';
3831
+ export type TrainingRuleSaveRefusalCode = 'PIPELINE_NAME_TAKEN' | 'OWN_TAG_TAKEN' | 'REVISION_MISMATCH' | 'RUN_ACTIVE' | 'NOT_A_SIMPLE_PIPELINE' | 'MODEL_NOT_TRAINABLE' | 'NO_GPU_FITS' | 'MODEL_REVISION_UNAVAILABLE' | 'NO_JUDGE_MODEL' | 'PROMOTION_POLICY_UNKNOWN' | 'PROMOTION_K_REQUIRED' | 'PROMOTION_K_UNREACHABLE' | 'PROMOTION_POLICY_NEEDS_BENCHMARK' | 'TRAINING_NOT_ENABLED' | 'METHOD_NOT_ENABLED' | 'CEILING_TOO_LOW' | 'MODELS_UNAVAILABLE' | 'GPU_OPTIONS_UNAVAILABLE' | 'AGENT_COULD_NOT_START';
3556
3832
  /**
3557
3833
  * The body of a manual run refused `409 MONTHLY_LIMIT_REACHED`, as
3558
3834
  * `ApiError.body` carries it.
@@ -3671,6 +3947,9 @@ export interface PipelineVersion {
3671
3947
  rows_scored: number | null;
3672
3948
  win_rate: number | null;
3673
3949
  mean_delta: number | null;
3950
+ /** The share of those conversations each side passed (score 0.70 or more). */
3951
+ candidate_pass_rate: number | null;
3952
+ incumbent_pass_rate: number | null;
3674
3953
  /**
3675
3954
  * The standing benchmark's replay of this version, when the rule has one.
3676
3955
  * Only scores with `benchmark_comparable` sit on one axis.
@@ -3746,6 +4025,14 @@ export interface PipelineAttempt {
3746
4025
  base_model_id: string | null;
3747
4026
  model_family: string | null;
3748
4027
  outcome: PipelineAttemptOutcome;
4028
+ /**
4029
+ * What was decided about it once it was compared; null while nothing has
4030
+ * been. A member's rejection is `rejected` where the outcome says `stopped`.
4031
+ */
4032
+ decision: TrainingDecision | null;
4033
+ /** The samples its set trained on and held back; null until its set was built. */
4034
+ train_rows: number | null;
4035
+ holdout_rows: number | null;
3749
4036
  /** The version it became, when it became one. */
3750
4037
  version: number | null;
3751
4038
  created_at: string;
@@ -3757,6 +4044,12 @@ export interface PipelineAttempt {
3757
4044
  cost_up_to: boolean;
3758
4045
  verdict: TrainingVerdict | null;
3759
4046
  win_rate: number | null;
4047
+ /**
4048
+ * The share of the held-back conversations the attempt and the version it
4049
+ * was compared with passed (score 0.70 or more); null until it is compared.
4050
+ */
4051
+ candidate_pass_rate: number | null;
4052
+ incumbent_pass_rate: number | null;
3760
4053
  evaluation_id: string | null;
3761
4054
  /** Its last sentence. */
3762
4055
  reason: string | null;
@@ -3783,22 +4076,52 @@ export interface PipelineSchedule {
3783
4076
  hour_utc: number;
3784
4077
  }
3785
4078
  /**
3786
- * When a pipeline trains: at least `min_samples` new samples AND, when there
3787
- * is one, at its scheduled slot. A null schedule trains as soon as the minimum
3788
- * is met.
4079
+ * When a pipeline trains: once it has the samples the platform's fixed
4080
+ * minimum asks for (`minimums` says how many, and how many it has) AND, when
4081
+ * there is a schedule, at its scheduled slot. A null schedule trains as soon
4082
+ * as the minimum is met. The minimum is not a setting: no body sets it.
3789
4083
  */
3790
4084
  export interface PipelineTrainWhen {
3791
- min_samples: number;
3792
4085
  schedule: PipelineSchedule | null;
3793
4086
  }
3794
- /** What is held back beyond max(50, 5% of the data): a larger percent, or a count. */
4087
+ /**
4088
+ * What is held back to judge each attempt by, and never trained on:
4089
+ * max(`min_rows`, `percent`% of the pipeline's samples). The set is sticky:
4090
+ * lowering the percent releases no sample already held back, and raising it
4091
+ * holds back only samples no attempt trained on.
4092
+ */
3795
4093
  export interface PipelineHoldout {
4094
+ /** The pipeline's share, 5 to 20 (5 unless a member chose more); set with `holdout.percent`. */
4095
+ percent: number;
4096
+ /** The floor, 100, held back whatever the share says. */
3796
4097
  min_rows: number;
4098
+ /** How many samples it holds back today (= `holdout_size`). Detail only; null on the list. */
4099
+ rows: number | null;
4100
+ /**
4101
+ * How many of `rows` are held back because an earlier run of the pipeline
4102
+ * held them back: they stay held back whatever became of that run and
4103
+ * whatever the share says; the rest are the share's. Before the first
4104
+ * version it is what raises `minimums.needed` above the share's own (these
4105
+ * rows plus the 1,000 to train on). Detail only; null on the list.
4106
+ */
4107
+ held_before: number | null;
3797
4108
  }
3798
4109
  /**
3799
- * How far the data is from the next version. `first_version`: `needed` usable
3800
- * rows v1 trains on. `new_rows`: `needed` usable rows the last version's set
3801
- * did not have. `have`, `short` and `message` are measured on the detail only.
4110
+ * How far the data is from the next attempt, by the platform's fixed
4111
+ * minimums (`floors` on `listModels`). READ-ONLY: no body changes them.
4112
+ *
4113
+ * `first_version`: `needed` usable samples the first attempt needs -- the
4114
+ * rows it trains on plus the ones held back to judge it. `new_rows`: `needed`
4115
+ * usable samples the last trained attempt did not have, which is
4116
+ * `floors.new_samples` or `floors.new_samples_percent` of the rows that
4117
+ * attempt trained on, whichever is more. `have`, `short` and `message` are
4118
+ * measured on the detail only. There, after an attempt has trained, `short`
4119
+ * is how many more new samples have to arrive: new samples fill the held-back
4120
+ * set first, so after the held-back share is raised it can be more than
4121
+ * `needed` - `have`; and `have` is the new samples the next attempt would
4122
+ * train on, or the samples since that attempt when that count is what it
4123
+ * waits for. Train now's 422 NOT_ENOUGH_SAMPLES carries the same `have` and
4124
+ * `need`.
3802
4125
  */
3803
4126
  export interface PipelineMinimums {
3804
4127
  basis: 'first_version' | 'new_rows';
@@ -3807,6 +4130,22 @@ export interface PipelineMinimums {
3807
4130
  short: number | null;
3808
4131
  message: string | null;
3809
4132
  }
4133
+ /**
4134
+ * The state of the live version's deployment:
4135
+ * - `serving`: it answers.
4136
+ * - `starting`: it is on its way up.
4137
+ * - `stopped`, `paused_for_funds` (the wallet ran out) and `deleted`: it does
4138
+ * not answer and is not billed.
4139
+ * - `paused_by_platform`: the platform paused it because billing could not be
4140
+ * reached; it does not answer.
4141
+ * - `failed`: it does not answer.
4142
+ */
4143
+ export type PipelineLiveDeploymentStatus = 'serving' | 'starting' | 'stopped' | 'paused_for_funds' | 'paused_by_platform' | 'failed' | 'deleted';
4144
+ /** The live version's deployment, as last checked (`checked_at`). */
4145
+ export interface PipelineLiveDeployment {
4146
+ status: PipelineLiveDeploymentStatus;
4147
+ checked_at: string;
4148
+ }
3810
4149
  export interface Pipeline {
3811
4150
  rule_id: string;
3812
4151
  rule_name: string;
@@ -3825,8 +4164,9 @@ export interface Pipeline {
3825
4164
  tags: string[];
3826
4165
  /**
3827
4166
  * A second base model trained on the same data after each attempt; it
3828
- * becomes the next version only if it beats the live one. `revision` is the
3829
- * commit the server pinned.
4167
+ * becomes the next version only if it beats the live one, and then it
4168
+ * becomes the pipeline's model (`base_model_id`) while the model it replaced
4169
+ * becomes this one. `revision` is the commit the server pinned.
3830
4170
  */
3831
4171
  challenger_model: PipelineModelRef | null;
3832
4172
  train_when: PipelineTrainWhen;
@@ -3842,6 +4182,14 @@ export interface Pipeline {
3842
4182
  live_version: number | null;
3843
4183
  /** The same number under its older name. */
3844
4184
  champion_version: number | null;
4185
+ /**
4186
+ * Whether the deployment the live version answers from is up, as the
4187
+ * platform last checked it. Null when there is no live version, when what
4188
+ * serves is not a deployment, or before the first check of that deployment.
4189
+ */
4190
+ live_deployment: PipelineLiveDeployment | null;
4191
+ /** What the pipeline's history takes up in storage. */
4192
+ storage: LoopStorage;
3845
4193
  /** The name the app calls. It does not change when a version is promoted. */
3846
4194
  serving_name: string;
3847
4195
  /**
@@ -3903,10 +4251,10 @@ export interface TrainingRuleDeleteResponse {
3903
4251
  deleted: boolean;
3904
4252
  rule_id: string;
3905
4253
  /**
3906
- * The name this delete just spent. The delete is a soft delete and the name
3907
- * index carries no partial predicate, so the row goes on holding the name
3908
- * after it has left every list you can read, and no later rule in the
3909
- * workspace can be called that. There is no purge and no undelete.
4254
+ * The name this delete just spent. The pipeline's history is purged in the
4255
+ * background, but its record keeps the name after it has left every list
4256
+ * you can read, so no later pipeline in the workspace can be called that.
4257
+ * There is no undelete.
3910
4258
  */
3911
4259
  retained_name: string;
3912
4260
  cancelled_run_id: string | null;
@@ -3915,6 +4263,14 @@ export interface TrainingRunListResponse {
3915
4263
  runs: TrainingRunSummary[];
3916
4264
  total: number;
3917
4265
  }
4266
+ /** One replay of a run on one of its pipeline's benchmarks, to link its report by. */
4267
+ export interface TrainingRunBenchmarkRun {
4268
+ benchmark_id: string;
4269
+ name: string;
4270
+ /** The replay's id: what `getBenchmarkRun` and `listBenchmarkRunItems` take. */
4271
+ run_id: string;
4272
+ status: BenchmarkRunStatus;
4273
+ }
3918
4274
  export interface TrainingRunResponse {
3919
4275
  run: TrainingRun;
3920
4276
  timeline: TrainingRunEvent[];
@@ -3924,8 +4280,84 @@ export interface TrainingRunResponse {
3924
4280
  * attached to the rule.
3925
4281
  */
3926
4282
  benchmark: BenchmarkRun | null;
4283
+ /** Every benchmark this run was replayed on, the primary included. */
4284
+ benchmark_runs: TrainingRunBenchmarkRun[];
3927
4285
  links: TrainingRunLinks;
3928
4286
  available_actions: TrainingRunActions;
4287
+ /** What became of the attempt and why, measurement by measurement. */
4288
+ promotion: TrainingRunPromotion;
4289
+ /**
4290
+ * Every bar the held-back verdict applied, with what it needed, what it got
4291
+ * and whether it was met: the rule itself, which the verdict is read off.
4292
+ * Null until the comparison is finished, when no thresholds were recorded,
4293
+ * and for a report decided under an earlier rule that this list would read
4294
+ * differently from its verdict (`verdict_checks_withheld` says so).
4295
+ */
4296
+ verdict_checks: VerdictCheck[] | null;
4297
+ /**
4298
+ * Why a finished report's `verdict_checks` is null although its thresholds
4299
+ * were recorded: `decided_under_earlier_rule` when an earlier version of
4300
+ * the rule decided it, so today's bars would not explain its verdict. Null
4301
+ * for every other null (not finished, no thresholds recorded) and when the
4302
+ * list is shown. Never rebuild the bars from today's rule for such a report.
4303
+ */
4304
+ verdict_checks_withheld: VerdictChecksWithheld | null;
4305
+ /** What the attempt has cost, part by part, from the charges recorded on it. */
4306
+ cost: TrainingRunCost;
4307
+ }
4308
+ /** Why a run detail's `verdict_checks` is withheld. */
4309
+ export type VerdictChecksWithheld = 'decided_under_earlier_rule';
4310
+ /**
4311
+ * What became of an attempt and why. `decision` is what was done, and who
4312
+ * did it: `rejected` is a member choosing not to publish it, beside a
4313
+ * `verdict` that may say `better`; `auto_rejected` is the pipeline's rule
4314
+ * turning it down; `expired` is nobody deciding before the review deadline,
4315
+ * with `outcome` `stopped` when it was better. `policy` to `measurements` are the promotion rule's record, null
4316
+ * (and `[]`) when it recorded none: an attempt still being compared, one that
4317
+ * ended before it was, or one decided before the record was kept.
4318
+ */
4319
+ export interface TrainingRunPromotion {
4320
+ /** As the pipeline's attempts list says it (`PipelineAttempt.outcome`). */
4321
+ outcome: PipelineAttemptOutcome;
4322
+ decision: TrainingDecision | null;
4323
+ policy: string | null;
4324
+ k: number | null;
4325
+ verdict: string | null;
4326
+ reason: string | null;
4327
+ weighted_delta: number | null;
4328
+ /** The held-back comparison first, then each benchmark, each with its outcome and reason. */
4329
+ measurements: PromotionMeasurement[];
4330
+ }
4331
+ /** The bars a held-back verdict applies. */
4332
+ export type VerdictCheckKey = 'rows_scored' | 'failures' | 'rubric' | 'mean_change' | 'win_rate' | 'beyond_chance';
4333
+ /**
4334
+ * One bar of the held-back verdict. `needed` and `got` are on the bar's own
4335
+ * scale -- conversations for `rows_scored` (at least) and `failures` (at
4336
+ * most), the score change for `mean_change` (at least), a share for
4337
+ * `win_rate` (at least), a probability for `beyond_chance` (at most) -- and
4338
+ * null where the bar has no number (`rubric`) or nothing produced one.
4339
+ */
4340
+ export interface VerdictCheck {
4341
+ key: VerdictCheckKey;
4342
+ /** The bar in plain words, its direction included. */
4343
+ label: string;
4344
+ needed: number | null;
4345
+ got: number | null;
4346
+ met: boolean;
4347
+ }
4348
+ /**
4349
+ * An attempt's cost in cents, part by part. `total_cents` is the attempt's
4350
+ * `cost_cents` on the pipeline. `up_to` says `comparison_cents` (and so the
4351
+ * total) is the most the comparison machines can have cost rather than what
4352
+ * they did; the other three parts are always charges.
4353
+ */
4354
+ export interface TrainingRunCost {
4355
+ training_cents: number;
4356
+ comparison_cents: number;
4357
+ scoring_cents: number;
4358
+ benchmark_cents: number;
4359
+ total_cents: number;
4360
+ up_to: boolean;
3929
4361
  }
3930
4362
  export interface TrainingRunActionResponse {
3931
4363
  run: TrainingRun;
@@ -3935,6 +4367,16 @@ export interface TrainingRunActionResponse {
3935
4367
  export interface EvaluationItemsResponse {
3936
4368
  items: EvaluationItem[];
3937
4369
  total: number;
4370
+ /** How many rows a `q` search read and searched; null without `q`. */
4371
+ searched: number | null;
4372
+ }
4373
+ /** A page of one replay's conversations, in the benchmark's order. */
4374
+ export interface BenchmarkRunItemsResponse {
4375
+ items: BenchmarkRunItem[];
4376
+ /** Every conversation the filter matches, not only this page. */
4377
+ total: number;
4378
+ /** How many rows a `q` search read and searched; null without `q`. */
4379
+ searched: number | null;
3938
4380
  }
3939
4381
  export interface InferenceAliasListResponse {
3940
4382
  aliases: InferenceAlias[];
@@ -3996,9 +4438,12 @@ export interface PipelineWriteRequest {
3996
4438
  } | null;
3997
4439
  /** More tags whose conversations the pipeline trains on. On an edit the list replaces the old one. */
3998
4440
  tags?: string[];
3999
- /** At least `min_samples` new samples (250 and up for SFT) AND, when set, the schedule. */
4441
+ /**
4442
+ * The schedule to wait for, beside the platform's fixed sample minimum.
4443
+ * There is no `min_samples`: the minimums are fixed, and a body that sends
4444
+ * one is refused 400 naming it.
4445
+ */
4000
4446
  train_when?: {
4001
- min_samples?: number;
4002
4447
  schedule?: {
4003
4448
  every: 'day' | 'week';
4004
4449
  weekday?: number;
@@ -4009,6 +4454,21 @@ export interface PipelineWriteRequest {
4009
4454
  policy: PipelinePromotion['policy'];
4010
4455
  k?: number;
4011
4456
  };
4457
+ /**
4458
+ * The share of the pipeline's samples held back to judge each attempt and
4459
+ * never trained on: a whole number from 5 to 20 (5 when absent on a
4460
+ * create; unchanged when absent on an edit). At least 100 are held back
4461
+ * whatever it says. Anything else is 400 naming `holdout.percent`, and
4462
+ * null is 400. It does not change what the pipeline may spend and nothing
4463
+ * is asked again: a new share is a new revision, saved at once. But a
4464
+ * larger share means more held-back samples are scored on each attempt (at
4465
+ * most `floors.held_back.scored_rows`), and scoring is paid from the
4466
+ * wallet. Lowering it keeps every sample already held back; raising it
4467
+ * holds back only new samples, which then do not count as new work.
4468
+ */
4469
+ holdout?: {
4470
+ percent: number;
4471
+ };
4012
4472
  /** 1 to 100, or null for no limit (the default). Counts versions, not attempts. */
4013
4473
  max_versions?: number | null;
4014
4474
  enabled?: boolean;
@@ -4031,12 +4491,40 @@ export interface LoopModel {
4031
4491
  /** Verified end to end on the platform for training and serving. */
4032
4492
  recommended: boolean;
4033
4493
  }
4034
- /** The floors a new pipeline is held to, in samples (`GET /api/loop/models`). */
4494
+ /**
4495
+ * The fixed minimums a pipeline is held to, in samples
4496
+ * (`GET /api/loop/models`). READ-ONLY: they are the platform's, and no body
4497
+ * sets them.
4498
+ */
4035
4499
  export interface PipelineFloors {
4036
- /** Samples a new pipeline's first attempt needs: training rows plus the held-back set. */
4500
+ /**
4501
+ * Samples a new pipeline's first attempt needs at the default held-back
4502
+ * share: the rows it trains on plus the held-back set (a pipeline holding
4503
+ * back more needs more; its own `minimums` says how many).
4504
+ */
4037
4505
  first_version_samples: number;
4038
- /** `train_when.min_samples`' default and floor. */
4506
+ /** The fewest new samples any later attempt waits for. */
4039
4507
  new_samples: number;
4508
+ /**
4509
+ * The share, in percent, of the rows the last trained attempt trained on
4510
+ * that a later attempt must add when that is more than `new_samples`.
4511
+ */
4512
+ new_samples_percent: number;
4513
+ /** The held-back rule a pipeline chooses its share within. */
4514
+ held_back: HeldBackFloors;
4515
+ }
4516
+ /**
4517
+ * The held-back rule: a pipeline holds back max(`min_rows`, its percent of its
4518
+ * samples), and chooses the percent from `default_percent` to `max_percent`
4519
+ * (the body's `holdout.percent`). Each attempt is judged on at most
4520
+ * `scored_rows` of them (the same ones every time); a share that holds back
4521
+ * more than that only keeps samples out of training.
4522
+ */
4523
+ export interface HeldBackFloors {
4524
+ min_rows: number;
4525
+ default_percent: number;
4526
+ max_percent: number;
4527
+ scored_rows: number;
4040
4528
  }
4041
4529
  export interface LoopModelsResponse {
4042
4530
  models: LoopModel[];
@@ -4057,6 +4545,10 @@ export interface RuleBenchmark {
4057
4545
  benchmark_status: string;
4058
4546
  item_count: number;
4059
4547
  items_digest: string;
4548
+ /** How it scores an answer: a scoring model reading its rubric (`judge`) or an exact check against its right answer (`exact`). */
4549
+ check: BenchmarkCheck;
4550
+ /** What its pinned set takes up in storage now: the figure the benchmark itself carries, this workspace's alone. */
4551
+ storage: LoopStorage;
4060
4552
  /** False for a benchmark this pipeline stopped using; its history stays. */
4061
4553
  attached: boolean;
4062
4554
  /** 1 is the primary; null once removed. */
@@ -4091,6 +4583,8 @@ export interface CompareBenchmark {
4091
4583
  name: string;
4092
4584
  benchmark_status: string;
4093
4585
  items_digest: string;
4586
+ /** How it scores an answer: `judge` or `exact`. */
4587
+ check: BenchmarkCheck;
4094
4588
  attached: boolean;
4095
4589
  priority: number | null;
4096
4590
  added_at: string | null;
@@ -4111,6 +4605,9 @@ export interface VersionBenchmarkScore {
4111
4605
  items_digest: string | null;
4112
4606
  comparable: boolean;
4113
4607
  why: string | null;
4608
+ /** The share each side passed (score 0.70 or more); null when there is no score. */
4609
+ incumbent_pass_rate: number | null;
4610
+ candidate_pass_rate: number | null;
4114
4611
  }
4115
4612
  /** One measurement a promotion rule weighed. */
4116
4613
  export interface PromotionMeasurement {
@@ -4136,6 +4633,15 @@ export interface PromotionOutcome {
4136
4633
  weighted_delta: number | null;
4137
4634
  measurements: PromotionMeasurement[];
4138
4635
  }
4636
+ /** A version's head-to-head on the held-back conversations. */
4637
+ export interface VersionHoldout {
4638
+ rows_scored: number | null;
4639
+ win_rate: number | null;
4640
+ mean_delta: number | null;
4641
+ /** The share each side passed (score 0.70 or more). */
4642
+ incumbent_pass_rate: number | null;
4643
+ candidate_pass_rate: number | null;
4644
+ }
4139
4645
  /** One version with every measurement it has. */
4140
4646
  export interface VersionScores {
4141
4647
  version: number;
@@ -4148,11 +4654,7 @@ export interface VersionScores {
4148
4654
  verdict: string | null;
4149
4655
  decision: string | null;
4150
4656
  compared_at: string | null;
4151
- holdout: {
4152
- rows_scored: number | null;
4153
- win_rate: number | null;
4154
- mean_delta: number | null;
4155
- };
4657
+ holdout: VersionHoldout;
4156
4658
  /** One entry per entry of the response's `benchmarks`, in the same order. */
4157
4659
  benchmarks: VersionBenchmarkScore[];
4158
4660
  promotion: PromotionOutcome | null;
@@ -4181,6 +4683,165 @@ export interface VersionCompareParams {
4181
4683
  a?: number;
4182
4684
  b?: number;
4183
4685
  }
4686
+ /**
4687
+ * b's score against a's on one held-back conversation, by the tie band:
4688
+ * 0.02 or more above counts as higher; less than 0.02 apart is about the same.
4689
+ */
4690
+ export type AttemptDirection = 'higher' | 'lower' | 'same';
4691
+ /**
4692
+ * One attempt's held-back comparison against what it was compared with on its
4693
+ * day, over ITS OWN held-back set (the set grows between attempts: the
4694
+ * like-for-like figures are `shared_sample.a` and `.b`). Every number is null
4695
+ * until the comparison is finished; two attempts' win rates are never
4696
+ * subtracted, since their opponents differ.
4697
+ */
4698
+ export interface AttemptHoldout {
4699
+ evaluation_id: string | null;
4700
+ status: EvaluationStatus | null;
4701
+ /** The scoring model its comparison froze when it opened; null for an attempt never compared. */
4702
+ judge_model: string | null;
4703
+ rows_scored: number | null;
4704
+ wins: number | null;
4705
+ losses: number | null;
4706
+ ties: number | null;
4707
+ win_rate: number | null;
4708
+ mean_delta: number | null;
4709
+ incumbent_mean: number | null;
4710
+ candidate_mean: number | null;
4711
+ /** The share each side passed (score 0.70 or more). */
4712
+ incumbent_pass_rate: number | null;
4713
+ candidate_pass_rate: number | null;
4714
+ }
4715
+ /** One side of an attempt comparison. */
4716
+ export interface AttemptCompareSide {
4717
+ run_id: string;
4718
+ attempt: number | null;
4719
+ version: number | null;
4720
+ trigger: PipelineAttemptTrigger;
4721
+ base_model_id: string | null;
4722
+ model_family: string | null;
4723
+ outcome: PipelineAttemptOutcome;
4724
+ verdict: TrainingVerdict | null;
4725
+ decision: TrainingDecision | null;
4726
+ train_rows: number | null;
4727
+ holdout_rows: number | null;
4728
+ finished_at: string | null;
4729
+ holdout: AttemptHoldout;
4730
+ }
4731
+ /**
4732
+ * The held-back conversations both attempts were scored on (`rows`), matched
4733
+ * by the conversation they came from.
4734
+ *
4735
+ * `comparable` says both were scored the same way: the same scoring model and
4736
+ * the same rubric, both recorded. When not, `why` says so, naming both scoring
4737
+ * models, and `higher`, `lower`, `same`, `a` and `b` are null: the two scores
4738
+ * are not on one scale. `answer_changed` counts the conversations whose right
4739
+ * answer a member changed between the two attempts; they have no direction
4740
+ * and are left out of `a` and `b`. `answer_unknown` counts the ones whose
4741
+ * right answer one of the two comparisons did not record which it was (it was
4742
+ * compared before that was kept), so whether both were scored against the same
4743
+ * answer is not known: no direction either, left out of `a` and `b`, and
4744
+ * never counted as changed. When comparable, rows = higher + lower + same +
4745
+ * answer_changed + answer_unknown.
4746
+ */
4747
+ export interface AttemptSharedSample {
4748
+ rows: number;
4749
+ comparable: boolean;
4750
+ why: string | null;
4751
+ answer_changed: number;
4752
+ answer_unknown: number;
4753
+ higher: number | null;
4754
+ lower: number | null;
4755
+ same: number | null;
4756
+ /**
4757
+ * Each attempt over the same conversations (`rows` less `answer_changed`
4758
+ * and `answer_unknown`):
4759
+ * the like-for-like figures, which may be subtracted. Null when there are
4760
+ * none, when the two were not scored the same way, and while either
4761
+ * comparison is still being scored.
4762
+ */
4763
+ a: AttemptSharedFigures | null;
4764
+ b: AttemptSharedFigures | null;
4765
+ }
4766
+ /** One attempt over the shared conversations: its mean score and how many passed (score 0.70 or more) of `rows`. */
4767
+ export interface AttemptSharedFigures {
4768
+ rows: number;
4769
+ mean: number;
4770
+ passed: number;
4771
+ pass_rate: number;
4772
+ }
4773
+ /** One attempt's replay of a benchmark. `score` and `pass_rate` are null unless it published a score. */
4774
+ export interface AttemptBenchmarkSide {
4775
+ benchmark_run_id: string;
4776
+ status: BenchmarkRunStatus;
4777
+ rows_scored: number;
4778
+ rows_total: number;
4779
+ score: number | null;
4780
+ pass_rate: number | null;
4781
+ }
4782
+ /**
4783
+ * A benchmark both attempts replayed. `delta` is b minus a, null unless
4784
+ * `comparable` (both scored on the same revision of it, every conversation);
4785
+ * `why` says why not.
4786
+ */
4787
+ export interface AttemptCompareBenchmark {
4788
+ benchmark_id: string;
4789
+ name: string;
4790
+ /** How it scores an answer: a rubric (`judge`) or an exact check (`exact`). */
4791
+ check: 'judge' | 'exact';
4792
+ a: AttemptBenchmarkSide;
4793
+ b: AttemptBenchmarkSide;
4794
+ delta: number | null;
4795
+ comparable: boolean;
4796
+ why: string | null;
4797
+ }
4798
+ /**
4799
+ * One attempt's own answer on a shared conversation, as its comparison scored
4800
+ * it. The answer itself is the `evaluation_item_id` row of
4801
+ * `listEvaluationItems(holdout.evaluation_id)`.
4802
+ */
4803
+ export interface AttemptCompareItemSide {
4804
+ evaluation_item_id: number;
4805
+ score: number;
4806
+ passed: boolean;
4807
+ }
4808
+ /**
4809
+ * One held-back conversation both attempts were scored on. `direction` is null
4810
+ * when the two scores are not on one scale, and `why` then says why (the two
4811
+ * attempts were scored differently, this conversation's right answer
4812
+ * changed between them, or which right answer one of them was scored against
4813
+ * was not recorded); both scores are listed either way.
4814
+ */
4815
+ export interface AttemptCompareItem {
4816
+ trace_id: string;
4817
+ a: AttemptCompareItemSide;
4818
+ b: AttemptCompareItemSide;
4819
+ direction: AttemptDirection | null;
4820
+ why: string | null;
4821
+ }
4822
+ /** `GET /api/loop/pipelines/{id}/attempts/compare`: numbers and ids only. */
4823
+ export interface AttemptCompareResponse {
4824
+ rule_id: string;
4825
+ a: AttemptCompareSide;
4826
+ b: AttemptCompareSide;
4827
+ /** Closer than this on one conversation is `same`. */
4828
+ tie_band: number;
4829
+ shared_sample: AttemptSharedSample;
4830
+ benchmarks: AttemptCompareBenchmark[];
4831
+ /** One page of the shared sample, in a's order, narrowed by `filter`. */
4832
+ items: AttemptCompareItem[];
4833
+ /** Every conversation the filter matches, not only this page. */
4834
+ total: number;
4835
+ }
4836
+ /** Which two attempts to set side by side, by RUN id, and which page of their shared conversations. */
4837
+ export interface AttemptCompareParams {
4838
+ a: string;
4839
+ b: string;
4840
+ filter?: AttemptDirection;
4841
+ /** 1 to 200; 50 when absent. */
4842
+ limit?: number;
4843
+ offset?: number;
4844
+ }
4184
4845
  /**
4185
4846
  * `POST /api/loop/pipelines/{id}/import`: the import body, `source` optional.
4186
4847
  * `default_feedback: 'good'` records every answered row without a verdict of