runbios-sdk 0.2.19 → 0.2.20-dev.286

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;
@@ -781,10 +781,24 @@ export interface TrainingJob {
781
781
  checkpoint_count?: number;
782
782
  /** The current machine attempt's per-phase records, in canonical order. */
783
783
  phases?: TrainingJobPhase[];
784
- /** Estimated seconds until the job finishes (absent when unknown). */
784
+ /**
785
+ * Estimated seconds remaining (absent when unknown). What it covers is
786
+ * `eta_scope`: before step 1 only the time until training starts.
787
+ */
785
788
  eta_seconds?: number;
786
- /** How the ETA was derived: measured on the machine, or from historical medians. */
789
+ /**
790
+ * How the ETA was derived: `measured` from this job's own live rate
791
+ * (training: its own steps since the first), or `historical` from past runs
792
+ * of the same model on the same GPU (else the GPU).
793
+ */
787
794
  eta_confidence?: 'measured' | 'historical';
795
+ /**
796
+ * What `eta_seconds` covers: `until_training` before step 1 (startup
797
+ * phases only; training time is measured from the run's own steps, never
798
+ * guessed), `run` once training has started (remaining training plus what
799
+ * follows it).
800
+ */
801
+ eta_scope?: 'until_training' | 'run';
788
802
  /** Most recent per-phase update time. */
789
803
  last_phase_update_at?: string;
790
804
  /**
@@ -1663,6 +1677,12 @@ export interface InferenceDeployment {
1663
1677
  base_model_revision?: string;
1664
1678
  immutable_base_model_source?: string;
1665
1679
  serving_mode?: 'full' | 'adapter' | 'merged';
1680
+ /**
1681
+ * Only on an adapter deployment: the `model` that asks its BASE weights with
1682
+ * no adapter, `<name>:base`, on /chat/completions and /completions. A
1683
+ * deployment with no adapter has no separate base and refuses `:base`.
1684
+ */
1685
+ base_weights_model?: string;
1666
1686
  supports_tool_calls?: boolean;
1667
1687
  tool_call_parser?: InferenceToolCallParser | null;
1668
1688
  reasoning_parser?: InferenceReasoningParser | null;
@@ -2297,18 +2317,17 @@ export interface ChatCompletionUsage {
2297
2317
  total_tokens: number;
2298
2318
  prompt_tokens_details?: PromptTokensDetails;
2299
2319
  }
2300
- /** What a training set is shaped for. The three need different things. */
2301
- export type LoopMethod = 'sft' | 'dpo' | 'grpo' | 'kto';
2302
- /** Who judged an answer. */
2320
+ /** Who gave a verdict. Feedback you send is `human` unless you say otherwise. */
2303
2321
  export type LoopSource = 'human' | 'verifier' | 'judge' | 'behavioural';
2304
- /** The judgement itself. */
2305
2322
  /**
2306
2323
  * The judgement recorded on an answer.
2307
2324
  *
2308
- * `accepted` / `rejected` are the thumbs (see `upvote` / `downvote`).
2309
- * `edited` says the model was WRONG and carries the better answer.
2325
+ * `accepted` / `rejected` are the thumbs (see `upvote` / `downvote`): an
2326
+ * accepted answer is trained on, a rejected one is left out.
2327
+ * `edited` says the model was WRONG and carries the better answer, which is
2328
+ * trained on in place of the model's.
2310
2329
  * `gold` records the reference answer for the question, making no claim about
2311
- * whether the model was right — which is why it is separate from `edited`.
2330
+ * whether the model was right; it is trained on the same way.
2312
2331
  */
2313
2332
  export type LoopVerdict = 'accepted' | 'rejected' | 'edited' | 'scored' | 'gold';
2314
2333
  /** A function an assistant turn asked to invoke. `arguments` is JSON-encoded. */
@@ -2495,7 +2514,7 @@ export interface LoopImportResult {
2495
2514
  not_saved_rows?: number[];
2496
2515
  /**
2497
2516
  * Rows whose CONVERSATION stored and whose VERDICT did not, and which rows
2498
- * those were. A preference pair or a thumbs label is two writes, and the
2517
+ * those were. A chosen/rejected row or a thumbs label is two writes, and the
2499
2518
  * second can fail on its own: the conversation is then in the loop carrying
2500
2519
  * nobody's judgement, counted under `needs_review` rather than `reviewed`,
2501
2520
  * and not trainable. The call rejects with {@link LoopImportIncompleteError},
@@ -2532,6 +2551,8 @@ export interface LoopSignal {
2532
2551
  ground_truth: string | null;
2533
2552
  reason: string | null;
2534
2553
  author: string | null;
2554
+ /** What the caller attached when recording it, or null. */
2555
+ metadata: Record<string, unknown> | null;
2535
2556
  created_at: string;
2536
2557
  }
2537
2558
  export interface LoopSignalParams {
@@ -2539,9 +2560,9 @@ export interface LoopSignalParams {
2539
2560
  source?: LoopSource;
2540
2561
  /** Required when verdict is `edited`. The answer the model should have given. */
2541
2562
  correction?: string;
2542
- /** Required when verdict is `scored`. */
2563
+ /** Required when verdict is `scored`: above zero trains the answer as it stands, otherwise it is left out. */
2543
2564
  score?: number;
2544
- /** A value or fact the answer can be checked against. GRPO needs one. */
2565
+ /** A value or fact the answer can be checked against. Kept with the verdict; a pipeline trains on `correction`, not on this. */
2545
2566
  ground_truth?: string;
2546
2567
  reason?: string;
2547
2568
  author?: string;
@@ -2579,7 +2600,11 @@ export interface LoopTrace {
2579
2600
  deployment_id: string | null;
2580
2601
  model: string;
2581
2602
  model_version: string | null;
2582
- messages: LoopMessage[];
2603
+ /**
2604
+ * The conversation. NULL, with `completion` empty, when its text is kept in
2605
+ * your own storage and could not be read just now: see `payload_unavailable`.
2606
+ */
2607
+ messages: LoopMessage[] | null;
2583
2608
  completion: string;
2584
2609
  tool_calls?: LoopToolCall[];
2585
2610
  tools?: unknown;
@@ -2591,9 +2616,40 @@ export interface LoopTrace {
2591
2616
  redacted_at: string | null;
2592
2617
  /** What the redaction pass removed, counted by rule. */
2593
2618
  redaction_report?: Record<string, number>;
2619
+ /** What the caller attached when recording it, or null. */
2620
+ metadata: Record<string, unknown> | null;
2594
2621
  created_at: string;
2595
2622
  expires_at: string;
2623
+ /** Every verdict recorded on it, oldest first. On the single read only. */
2596
2624
  signals?: LoopSignal[];
2625
+ /** How many verdicts it carries. */
2626
+ signal_count: number;
2627
+ /**
2628
+ * The verdict that decides it -- the one training uses, not whichever
2629
+ * arrived last. Absent when nobody has given feedback.
2630
+ */
2631
+ verdict?: LoopVerdict;
2632
+ /** Who gave that verdict. */
2633
+ verdict_source?: LoopSource;
2634
+ /**
2635
+ * The score a `scored` verdict carries: above zero it trains the answer as
2636
+ * it stands (good feedback), zero or below it trains nothing (bad).
2637
+ */
2638
+ verdict_score?: number;
2639
+ /** Its tags. On the single read only. */
2640
+ labels?: LoopLabel[];
2641
+ /**
2642
+ * True when the conversation's text is kept in your own storage rather than
2643
+ * here. The text is read from there on every request.
2644
+ */
2645
+ payload_stored_externally?: boolean;
2646
+ /**
2647
+ * True when that text could not be read just now (the storage could not be
2648
+ * reached, or the object is gone). `messages` is then null and `completion`
2649
+ * empty: the conversation is NOT empty. Try again later; do not review it or
2650
+ * treat it as a blank answer.
2651
+ */
2652
+ payload_unavailable?: boolean;
2597
2653
  }
2598
2654
  export interface LoopTraceListParams {
2599
2655
  deployment_id?: string;
@@ -2728,6 +2784,7 @@ export interface LoopMetricPoint {
2728
2784
  mean_delta: number | null;
2729
2785
  judge_incumbent_mean: number | null;
2730
2786
  judge_candidate_mean: number | null;
2787
+ /** The trainer's loss on its validation slice, as {@link Evaluation.trainer_eval_loss}. */
2731
2788
  trainer_eval_loss: number | null;
2732
2789
  /** The bar this attempt had to clear, frozen with its report. */
2733
2790
  promote_margin: number | null;
@@ -2810,11 +2867,13 @@ export type TrainingRulePausedReason = 'consent_invalid' | 'insufficient_funds'
2810
2867
  */
2811
2868
  | 'training_not_enabled';
2812
2869
  /**
2813
- * Why a run fired. `variant` is a recipe variant: the pipeline had nothing new
2814
- * to learn, so it trained the same base model on the same conversations with
2815
- * one training setting changed (see {@link TrainingRecipe}).
2870
+ * Why a run fired, as the run stores it: `rows` (enough new samples),
2871
+ * `cadence` (the schedule), `both`, `manual` (train now), `challenger` (the
2872
+ * pipeline's challenger model trained on the same data as the attempt before
2873
+ * it), or `variant` (a recipe variant, retired: the same base model on the
2874
+ * same conversations with one training setting changed; old runs only).
2816
2875
  */
2817
- export type TrainingTrigger = 'rows' | 'cadence' | 'both' | 'manual' | 'variant';
2876
+ export type TrainingTrigger = 'rows' | 'cadence' | 'both' | 'manual' | 'variant' | 'challenger';
2818
2877
  /**
2819
2878
  * The four training settings a recipe variant may change, as the run was
2820
2879
  * actually trained: the training service's own defaults are filled in where
@@ -2828,12 +2887,22 @@ export interface TrainingRecipe {
2828
2887
  lora_rank: number | null;
2829
2888
  lora_alpha: number | null;
2830
2889
  }
2831
- export type TrainingRunState = 'built' | 'registering' | 'dataset_validating' | 'preflighting' | 'job_creating' | 'training' | 'checkpoint_ready' | 'candidate_booking' | 'candidate_running' | 'evaluating' | 'reported' | 'awaiting_review' | 'promoting' | 'waiting_funds' | 'promoted' | 'rejected' | 'expired' | 'failed' | 'budget_stopped' | 'cancelled' | 'superseded' | 'rolled_back';
2890
+ export type TrainingRunState = 'built' | 'registering' | 'dataset_validating' | 'preflighting' | 'job_creating' | 'training' | 'checkpoint_ready' | 'candidate_booking' | 'candidate_running' | 'evaluating' | 'reported' | 'awaiting_review' | 'promoting' | 'waiting_funds'
2891
+ /**
2892
+ * Trained, and waiting for GPUs to run the new model and the one it is
2893
+ * compared with side by side: one machine got a GPU and the other did not
2894
+ * within 20 minutes, so both were stopped. Each try can bill the machine
2895
+ * that got a GPU for up to those 20 minutes; nothing bills between tries.
2896
+ * It keeps what it trained, books both again after 30 minutes, then 1, 2
2897
+ * and 4 hours, and ends (`failed`, `COMPARISON_NO_GPUS`) after four tries or
2898
+ * 24 hours (`COMPARISON_WORKSPACE_FULL` when what was missing was room in
2899
+ * the workspace). Train now books them again at once.
2900
+ */
2901
+ | 'waiting_gpus' | 'promoted' | 'rejected' | 'expired' | 'failed' | 'budget_stopped' | 'cancelled' | 'superseded' | 'rolled_back';
2832
2902
  /** The closed set a run never leaves. */
2833
2903
  export declare const TERMINAL_RUN_STATES: readonly TrainingRunState[];
2834
2904
  export type TrainingVerdict = 'better' | 'not_better' | 'inconclusive' | 'not_evaluated';
2835
2905
  export type TrainingDecision = 'auto_promoted' | 'promoted' | 'rejected' | 'auto_rejected' | 'rolled_back';
2836
- export type NotifyState = 'none' | 'pending' | 'sending' | 'sent' | 'suppressed' | 'failed';
2837
2906
  export type EvaluationStatus = 'open' | 'done' | 'failed' | 'budget_stopped';
2838
2907
  export type EvaluationItemStatus = 'pending' | 'working' | 'done' | 'failed';
2839
2908
  export type EvaluationWinner = 'candidate' | 'incumbent' | 'tie';
@@ -2891,8 +2960,6 @@ export interface TrainingRun {
2891
2960
  workspace_id: string;
2892
2961
  seq: number;
2893
2962
  rule_revision: number;
2894
- authorized_by: string;
2895
- rule_snapshot: Record<string, unknown>;
2896
2963
  trigger: TrainingTrigger;
2897
2964
  /**
2898
2965
  * For a recipe variant, what it changed, in plain words ("half the learning
@@ -2921,16 +2988,25 @@ export interface TrainingRun {
2921
2988
  * no remedy worth printing.
2922
2989
  */
2923
2990
  error_next_step: string | null;
2924
- training_ceiling_cents: number;
2925
- candidate_ceiling_cents: number;
2926
- eval_ceiling_cents: number;
2927
2991
  billed_training_cents: number;
2992
+ /**
2993
+ * The comparison machines: each from the first time it was on a GPU to its
2994
+ * stop, less any time back in the GPU queue, at the price the platform
2995
+ * placed it at.
2996
+ */
2928
2997
  billed_candidate_cents: number;
2998
+ /**
2999
+ * True when a comparison machine was charged: the figure is then the most
3000
+ * it can have cost ("up to"), since it counts each machine from its first
3001
+ * boot where the platform bills from its first answer (and at the hourly
3002
+ * cap when no placement price was reported).
3003
+ */
3004
+ billed_candidate_up_to: boolean;
2929
3005
  spent_eval_cents: number;
2930
- loop_dataset_id: string | null;
2931
3006
  train_rows: number | null;
2932
3007
  holdout_rows: number | null;
2933
3008
  train_dataset_id: string | null;
3009
+ /** Null on a run made since the held-back rows stopped leaving the loop; set on older runs. */
2934
3010
  holdout_dataset_id: string | null;
2935
3011
  training_job_id: string | null;
2936
3012
  job_status: string | null;
@@ -2955,6 +3031,7 @@ export interface TrainingRun {
2955
3031
  model_family: string | null;
2956
3032
  /** Machine time the run held (training job plus comparison machine); null until known. */
2957
3033
  gpu_seconds: number | null;
3034
+ /** The trainer's loss on its validation slice, as {@link Evaluation.trainer_eval_loss}. */
2958
3035
  training_eval_loss: number | null;
2959
3036
  candidate_deployment_id: string | null;
2960
3037
  candidate_name: string | null;
@@ -2967,8 +3044,7 @@ export interface TrainingRun {
2967
3044
  benchmark_run_id: string | null;
2968
3045
  /**
2969
3046
  * What the replay's calls cost. Kept apart from `spent_eval_cents` so a
2970
- * report can say what the comparison cost and what the benchmark cost; both
2971
- * come out of `eval_ceiling_cents` and their sum can never exceed it, so
3047
+ * report can say what the comparison cost and what the benchmark cost, so
2972
3048
  * anything totalling what a run cost has to add this one too.
2973
3049
  */
2974
3050
  benchmark_spent_cents: number;
@@ -2982,10 +3058,6 @@ export interface TrainingRun {
2982
3058
  decided_at: string | null;
2983
3059
  auto_promote_at: string | null;
2984
3060
  review_deadline_at: string | null;
2985
- notify_state: NotifyState;
2986
- notify_event: string | null;
2987
- notify_error: string | null;
2988
- notify_attempts: number;
2989
3061
  created_at: string;
2990
3062
  updated_at: string;
2991
3063
  finished_at: string | null;
@@ -3023,6 +3095,8 @@ export interface TrainingRunSummary {
3023
3095
  holdout_rows: number | null;
3024
3096
  billed_training_cents: number;
3025
3097
  billed_candidate_cents: number;
3098
+ /** See {@link TrainingRun.billed_candidate_up_to}. */
3099
+ billed_candidate_up_to: boolean;
3026
3100
  spent_eval_cents: number;
3027
3101
  /** The fourth money column. A row that leaves it out adds up short. */
3028
3102
  benchmark_spent_cents: number;
@@ -3031,7 +3105,6 @@ export interface TrainingRunSummary {
3031
3105
  evaluation_id: string | null;
3032
3106
  review_deadline_at: string | null;
3033
3107
  auto_promote_at: string | null;
3034
- notify_state: NotifyState;
3035
3108
  created_at: string;
3036
3109
  finished_at: string | null;
3037
3110
  }
@@ -3049,7 +3122,7 @@ export interface TrainingRunEvent {
3049
3122
  export interface TrainingRunLinks {
3050
3123
  training_job_url: string | null;
3051
3124
  candidate_url: string | null;
3052
- dataset_url: string | null;
3125
+ /** The console page of this attempt's comparison report, every conversation included. */
3053
3126
  evaluation_url: string | null;
3054
3127
  /** The TREND the benchmark number belongs to, not the one replay. */
3055
3128
  benchmark_url: string | null;
@@ -3091,41 +3164,13 @@ export interface EvaluationWarning {
3091
3164
  export interface EvaluationMargin {
3092
3165
  promote_margin: number;
3093
3166
  promote_min_win_rate: number;
3094
- min_judge_agreement: number;
3095
3167
  min_holdout_rows: number;
3096
3168
  }
3097
- /**
3098
- * One rubric dimension of a judge-versus-human agreement.
3099
- *
3100
- * Deliberately not EvaluationDimensionScore: that type carries `incumbent` and
3101
- * `candidate`, which are the two models being compared, and an agreement has
3102
- * neither. `pairs` is per dimension because a reviewer who rated one dimension
3103
- * and skipped another leaves a different denominator behind each number.
3104
- */
3105
- export interface JudgeAgreementDimension {
3106
- dimension: string;
3107
- pairs: number;
3108
- agreement: number | null;
3109
- mean_abs_error: number | null;
3110
- }
3111
- /** How often this judge agreed with the workspace's own reviewers. */
3112
- export interface JudgeAgreement {
3113
- judge_id: string;
3114
- pairs: number;
3115
- agreement: number | null;
3116
- mean_abs_error: number | null;
3117
- per_dimension: JudgeAgreementDimension[];
3118
- window_days: number;
3119
- computed_at: string;
3120
- /** "Not enough reviewer overlap yet" is an answer; 100% of two is not. */
3121
- enough_pairs: boolean;
3122
- }
3123
3169
  /** The comparison report: the candidate against what serves today, same rows. */
3124
3170
  export interface Evaluation {
3125
3171
  id: string;
3126
3172
  run_id: string;
3127
3173
  workspace_id: string;
3128
- loop_dataset_id: string | null;
3129
3174
  split: string;
3130
3175
  incumbent_ref: EvaluationRef;
3131
3176
  candidate_ref: EvaluationRef;
@@ -3134,7 +3179,6 @@ export interface Evaluation {
3134
3179
  judge_model: string | null;
3135
3180
  judge_instructions: string | null;
3136
3181
  judge_dimensions: EvaluationJudgeDimension[];
3137
- judge_system_prompt: string | null;
3138
3182
  decoding: EvaluationDecoding;
3139
3183
  rows_selected: number;
3140
3184
  rows_scored: number;
@@ -3149,9 +3193,25 @@ export interface Evaluation {
3149
3193
  mean_delta: number | null;
3150
3194
  judge_incumbent_mean: number | null;
3151
3195
  judge_candidate_mean: number | null;
3196
+ /**
3197
+ * An answer PASSED (score 0.70 or more) when the judge scored it at least
3198
+ * `pass_threshold`; an answer with no score never passes. `*_passed`
3199
+ * counts the conversations each side passed, and `*_pass_rate` is that
3200
+ * count over `rows_scored`. The counts are null until the report is
3201
+ * finished, and the rates also when nothing was scored.
3202
+ */
3203
+ pass_threshold: number;
3204
+ incumbent_passed: number | null;
3205
+ candidate_passed: number | null;
3206
+ incumbent_pass_rate: number | null;
3207
+ candidate_pass_rate: number | null;
3152
3208
  per_dimension: EvaluationDimensionScore[];
3153
- judge_agreement: JudgeAgreement | null;
3154
- /** Informational: there is no incumbent counterpart to compare it against. */
3209
+ /**
3210
+ * The trainer's loss on its validation slice: about 5% of the rows the
3211
+ * attempt trains on, kept aside to pick the best checkpoint. Informational:
3212
+ * there is no incumbent counterpart to compare it against, and it is not
3213
+ * measured on the held-back conversations this report compares.
3214
+ */
3155
3215
  trainer_eval_loss: number | null;
3156
3216
  warnings: EvaluationWarning[];
3157
3217
  verdict: TrainingVerdict | null;
@@ -3165,12 +3225,56 @@ export interface Evaluation {
3165
3225
  created_at: string;
3166
3226
  finished_at: string | null;
3167
3227
  }
3228
+ /**
3229
+ * What the judge made of one answer: its overall score, one score per rubric
3230
+ * dimension (keyed as `judge_dimensions` names them), and the judge's reason
3231
+ * in its own words, with anything that looks like a credential or a personal
3232
+ * detail removed. `reason` is null when the judge gave none.
3233
+ */
3234
+ export interface EvaluationItemJudge {
3235
+ overall: number;
3236
+ dimensions: Record<string, number>;
3237
+ reason: string | null;
3238
+ }
3239
+ /**
3240
+ * Where a conversation's reference answer came from: a person said the
3241
+ * model's own answer was `good`, a person's `correction`, or a `gold` answer
3242
+ * written as the right one.
3243
+ */
3244
+ export type EvaluationReferenceKind = 'good' | 'correction' | 'gold';
3245
+ /**
3246
+ * What a person said the right answer is, frozen with the report and shown
3247
+ * to the judge beside both answers. Null on a conversation nobody gave one.
3248
+ */
3249
+ export interface EvaluationReference {
3250
+ answer: string;
3251
+ kind: EvaluationReferenceKind;
3252
+ }
3253
+ /** Which answer the judge preferred in one order of showing them, and why. */
3254
+ export interface EvaluationPairwiseOrder {
3255
+ winner: EvaluationWinner;
3256
+ reason: string | null;
3257
+ }
3258
+ /**
3259
+ * The direct comparison, asked twice: once with the serving version's answer
3260
+ * shown first and once with the attempt's first. A win counts only when both
3261
+ * orders pick the same side (`agreed`); anything else is a `tie`, which is
3262
+ * what removes the judge's preference for whichever answer it reads first.
3263
+ */
3264
+ export interface EvaluationItemPairwise {
3265
+ incumbent_first: EvaluationPairwiseOrder;
3266
+ candidate_first: EvaluationPairwiseOrder;
3267
+ winner: EvaluationWinner;
3268
+ agreed: boolean;
3269
+ }
3168
3270
  /** One model's answer to one held-out conversation, with the scores it earned. */
3169
3271
  export interface EvaluationItemSide {
3170
3272
  completion: string | null;
3171
3273
  tool_calls: TrainingToolCall[] | null;
3172
- judge: Record<string, unknown> | null;
3274
+ judge: EvaluationItemJudge | null;
3173
3275
  score: number | null;
3276
+ /** True when it passed (score 0.70 or more); null when it has no score. */
3277
+ passed: boolean | null;
3174
3278
  model_version: string | null;
3175
3279
  }
3176
3280
  /**
@@ -3186,8 +3290,11 @@ export interface EvaluationItem {
3186
3290
  trace_url: string | null;
3187
3291
  prompt: TrainingMessage[];
3188
3292
  tools: unknown[] | null;
3293
+ reference: EvaluationReference | null;
3189
3294
  incumbent: EvaluationItemSide;
3190
3295
  candidate: EvaluationItemSide;
3296
+ /** Null on a conversation compared before both orders were kept. */
3297
+ pairwise: EvaluationItemPairwise | null;
3191
3298
  human_verdict: number | null;
3192
3299
  winner: EvaluationWinner | null;
3193
3300
  status: EvaluationItemStatus;
@@ -3283,14 +3390,11 @@ export interface Benchmark {
3283
3390
  judge_model: string;
3284
3391
  judge_instructions: string;
3285
3392
  judge_dimensions: EvaluationJudgeDimension[];
3286
- judge_system_prompt: string | null;
3287
3393
  decoding: EvaluationDecoding;
3288
3394
  scoring: BenchmarkScoring;
3289
3395
  item_count: number;
3290
3396
  /** Recomputed from the rows and compared at the start of every replay. */
3291
3397
  items_digest: string;
3292
- /** A cap INSIDE the run's own amount for judge calls, never an addition to it. */
3293
- per_run_ceiling_cents: number;
3294
3398
  created_by: string;
3295
3399
  created_at: string;
3296
3400
  retired_at: string | null;
@@ -3315,11 +3419,16 @@ export interface BenchmarkItem {
3315
3419
  /**
3316
3420
  * One replay: this benchmark, on this training run, against both models.
3317
3421
  *
3318
- * IT DOES NOT GATE PROMOTION. The paired comparison applies the judge to both
3319
- * sides of one conversation in one pass, so most of the judge's variance
3320
- * cancels in its delta; an absolute mean carries that variance whole. What
3321
- * ships here is the number, the difference against what serves today on the
3322
- * same set, and the history. A person reads the trend.
3422
+ * IT DECIDES A PROMOTION ONLY UNDER A POLICY THAT READS BENCHMARKS. The
3423
+ * paired comparison applies the judge to both sides of one conversation in
3424
+ * one pass, so most of the judge's variance cancels in its delta; an absolute
3425
+ * mean carries that variance whole. Under the default `holdout` policy a
3426
+ * replay is the number, the difference against what serves today on the same
3427
+ * set, and the history, and a person reads the trend. Under `all`, `primary`,
3428
+ * `k_of_n` or `weighted` the policy reads this replay's delta.
3429
+ *
3430
+ * Every conversation behind it, both answers and the judge's reasons, is
3431
+ * `listBenchmarkRunItems`.
3323
3432
  */
3324
3433
  export interface BenchmarkRun {
3325
3434
  id: string;
@@ -3339,10 +3448,28 @@ export interface BenchmarkRun {
3339
3448
  incumbent_score: number | null;
3340
3449
  score_delta: number | null;
3341
3450
  per_dimension: BenchmarkDimensionScore[];
3451
+ /**
3452
+ * An answer PASSED (score 0.70 or more) when the judge scored it at least
3453
+ * `pass_threshold`. `*_passed` counts the conversations each side passed
3454
+ * and `*_pass_rate` is that count over `rows_scored`: null unless `status`
3455
+ * is `done`, like the scores.
3456
+ */
3457
+ pass_threshold: number;
3458
+ incumbent_passed: number | null;
3459
+ candidate_passed: number | null;
3460
+ incumbent_pass_rate: number | null;
3461
+ candidate_pass_rate: number | null;
3462
+ /**
3463
+ * Conversations the attempt scored higher on (`wins`), lower on (`losses`),
3464
+ * or within the tie band promotion uses of the serving version (`ties`).
3465
+ * Null unless `status` is `done`.
3466
+ */
3467
+ wins: number | null;
3468
+ losses: number | null;
3469
+ ties: number | null;
3342
3470
  prompt_tokens: number;
3343
3471
  completion_tokens: number;
3344
3472
  spent_cents: number;
3345
- ceiling_cents: number;
3346
3473
  status: BenchmarkRunStatus;
3347
3474
  /** The whole explanation when there is no score, so never empty on one. */
3348
3475
  status_reason: string | null;
@@ -3371,11 +3498,53 @@ export interface BenchmarkHistoryPoint {
3371
3498
  candidate_score: number | null;
3372
3499
  incumbent_score: number | null;
3373
3500
  score_delta: number | null;
3501
+ /** The share each side passed (score 0.70 or more); null when the replay has no score. */
3502
+ incumbent_pass_rate: number | null;
3503
+ candidate_pass_rate: number | null;
3374
3504
  checkpoint_id: string | null;
3375
3505
  decision: TrainingDecision | null;
3376
3506
  status: BenchmarkRunStatus;
3377
3507
  status_reason: string | null;
3378
3508
  }
3509
+ /** One model's answer to one pinned conversation in a replay, and its score. */
3510
+ export interface BenchmarkRunItemSide {
3511
+ completion: string | null;
3512
+ judge: EvaluationItemJudge | null;
3513
+ score: number | null;
3514
+ /** True when it passed (score 0.70 or more); null when it has no score. */
3515
+ passed: boolean | null;
3516
+ }
3517
+ /**
3518
+ * One pinned conversation of one replay: the prompt, both answers, what the
3519
+ * judge made of each, and which side won it.
3520
+ *
3521
+ * `winner` compares the two scores: the side scoring higher by more than the
3522
+ * tie band promotion uses, `tie` inside it, and null until both are scored.
3523
+ * `source_trace_id` goes null once the conversation it was pinned from is
3524
+ * deleted; the pinned copy stays.
3525
+ */
3526
+ export interface BenchmarkRunItem {
3527
+ id: number;
3528
+ benchmark_item_id: number;
3529
+ ordinal: number;
3530
+ source_trace_id: string | null;
3531
+ source_trace_url: string | null;
3532
+ prompt: TrainingMessage[];
3533
+ tools: unknown[] | null;
3534
+ reference: EvaluationReference | null;
3535
+ incumbent: BenchmarkRunItemSide;
3536
+ candidate: BenchmarkRunItemSide;
3537
+ winner: EvaluationWinner | null;
3538
+ status: EvaluationItemStatus;
3539
+ error: string | null;
3540
+ }
3541
+ /** Which conversations of a replay to read: the same three words a report's items take. */
3542
+ export interface BenchmarkRunItemListParams {
3543
+ winner?: EvaluationItemWinnerFilter;
3544
+ /** 50 when absent; at most 200. */
3545
+ limit?: number;
3546
+ offset?: number;
3547
+ }
3379
3548
  /**
3380
3549
  * Where the conversations are copied FROM. Read once, at creation, never again.
3381
3550
  * A benchmark pins conversations by id; to make one from a file, import it
@@ -3448,6 +3617,10 @@ export interface BenchmarkRetireParams {
3448
3617
  * monthly cap, so what this attempt trained could not be scored. The body
3449
3618
  * carries `resumes_at`, when the cap lifts (the next UTC month, or sooner
3450
3619
  * if the key's cap is raised).
3620
+ * - `LIVE_VERSION_STOPPED` (409): the deployment the pipeline's live version
3621
+ * answers from is stopped, paused until funds are added, deleted or failed,
3622
+ * so an attempt could not be compared against it. Resume it in Deployments,
3623
+ * or roll the version back, then train again.
3451
3624
  * - `AGENT_COULD_NOT_START` (503): the key every comparison is scored with is
3452
3625
  * missing or was refused, and train now could not renew it just then.
3453
3626
  * Nothing was started. Press train now again in a minute.
@@ -3460,13 +3633,17 @@ export interface BenchmarkRetireParams {
3460
3633
  * `MONTHLY_LIMIT_REACHED` and `SCORING_CAPPED` once their date has passed;
3461
3634
  * retrying any other one unchanged gets the same answer.
3462
3635
  */
3463
- export type TrainingRuleRunRefusalCode = 'NOT_ENOUGH_SAMPLES' | 'PIPELINE_NEEDS_SAVE' | 'RULE_PAUSED' | 'RUN_ACTIVE' | 'VERSION_LIMIT_REACHED' | 'MONTHLY_LIMIT_REACHED' | 'SCORING_CAPPED' | 'AGENT_COULD_NOT_START' | 'AGENT_OFF';
3636
+ export type TrainingRuleRunRefusalCode = 'NOT_ENOUGH_SAMPLES' | 'PIPELINE_NEEDS_SAVE' | 'RULE_PAUSED' | 'RUN_ACTIVE' | 'VERSION_LIMIT_REACHED' | 'MONTHLY_LIMIT_REACHED' | 'SCORING_CAPPED' | 'LIVE_VERSION_STOPPED' | 'AGENT_COULD_NOT_START' | 'AGENT_OFF';
3464
3637
  /**
3465
3638
  * The machine codes saving a pipeline (`createPipeline` or `updatePipeline`)
3466
3639
  * can be refused with: every one the two routes answer beyond a malformed
3467
3640
  * body (400, which names the field). The SDK's tests read them off the
3468
3641
  * service. Nothing is saved when any of them is answered.
3469
3642
  *
3643
+ * A `train_when.min_samples` is one of those 400s: the sample minimums are
3644
+ * fixed by the platform (`listModels` returns them as `floors`) and no body
3645
+ * sets them.
3646
+ *
3470
3647
  * The name and tags:
3471
3648
  * - `PIPELINE_NAME_TAKEN` (409): another pipeline in the workspace has the
3472
3649
  * name, a deleted one included. Choose another name.
@@ -3481,11 +3658,9 @@ export type TrainingRuleRunRefusalCode = 'NOT_ENOUGH_SAMPLES' | 'PIPELINE_NEEDS_
3481
3658
  * pipeline created before pipelines had them; its other settings can
3482
3659
  * still change.
3483
3660
  *
3484
- * The model and when to train:
3661
+ * The model and how it is promoted:
3485
3662
  * - `MODEL_NOT_TRAINABLE` (422): `model.id` or `challenger_model.id` is not a
3486
3663
  * model `listModels` offers, or the challenger is the model itself.
3487
- * - `MIN_SAMPLES_TOO_LOW` (422): `train_when.min_samples` is under the floor
3488
- * `listModels` returns as `floors.new_samples`.
3489
3664
  * - `NO_GPU_FITS` (422): no machines can train or serve the model right now.
3490
3665
  * - `MODEL_REVISION_UNAVAILABLE` (422): the model could not be pinned to an
3491
3666
  * exact revision because the training service did not answer. Try again
@@ -3513,15 +3688,15 @@ export type TrainingRuleRunRefusalCode = 'NOT_ENOUGH_SAMPLES' | 'PIPELINE_NEEDS_
3513
3688
  * the key every comparison is scored with) did not answer just then. Try
3514
3689
  * again in a minute.
3515
3690
  */
3516
- 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';
3691
+ 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';
3517
3692
  /**
3518
3693
  * The body of a manual run refused `409 MONTHLY_LIMIT_REACHED`, as
3519
3694
  * `ApiError.body` carries it.
3520
3695
  *
3521
3696
  * The test is the worst case, not the average: a run may start only if the
3522
3697
  * most the rule's runs this UTC calendar month can have cost
3523
- * (`month_spent_cents`), plus the most the run about to start may spend (its
3524
- * three ceilings added up), fits under the limit.
3698
+ * (`month_spent_cents`), plus the most the run about to start may spend
3699
+ * (`run_max_cents`), fits under the limit.
3525
3700
  */
3526
3701
  export interface TrainingRuleMonthlyLimitRefusal {
3527
3702
  error: {
@@ -3532,12 +3707,18 @@ export interface TrainingRuleMonthlyLimitRefusal {
3532
3707
  month_spent_cents: number;
3533
3708
  /** The rule's monthly limit. */
3534
3709
  monthly_ceiling_cents: number;
3535
- /** The most one run of this rule may spend: training + candidate + evaluation ceilings. */
3710
+ /**
3711
+ * The most one attempt of this rule may spend: its training, its comparison
3712
+ * machine and its judging. While no version is live that machine also
3713
+ * answers as the base model, so a pipeline's own attempt counts one; a
3714
+ * challenger's attempt also counts the base model's own machine beside it.
3715
+ */
3536
3716
  run_max_cents: number;
3537
3717
  /**
3538
3718
  * The first instant of the next UTC month, when the counted spend starts
3539
3719
  * again from nothing. When `run_max_cents` alone exceeds the limit, no month
3540
- * will ever fit and only raising the limit helps; `message` says which.
3720
+ * will ever fit: saving the pipeline sets the limit again from its model's
3721
+ * prices, and nothing else changes it; `message` says which.
3541
3722
  */
3542
3723
  resumes_at: string;
3543
3724
  }
@@ -3549,8 +3730,9 @@ export declare const PIPELINE_MAX_VERSIONS_CEILING = 100;
3549
3730
  * platform working on it.
3550
3731
  *
3551
3732
  * `paused` is a rule that is switched off, AND an enabled rule the platform
3552
- * has stopped firing (`paused_reason`) or whose terms changed and were never
3553
- * accepted (`needs_consent`). `complete` is a pipeline at its `max_versions`.
3733
+ * has stopped firing (`paused_reason`; `consent_invalid` when its settings
3734
+ * changed since it was last saved). `complete` is a pipeline at its
3735
+ * `max_versions`.
3554
3736
  */
3555
3737
  export type PipelineStatus = 'running' | 'needs_review' | 'needs_funds' | 'waiting' | 'paused' | 'complete';
3556
3738
  /**
@@ -3574,6 +3756,11 @@ export interface PipelineActiveRun {
3574
3756
  gpu_seconds: number | null;
3575
3757
  /** What it has been billed so far, in cents. */
3576
3758
  cost_cents: number;
3759
+ /**
3760
+ * True when a comparison machine was charged in `cost_cents`: the figure is
3761
+ * the most it can have cost, so show it as "up to".
3762
+ */
3763
+ cost_up_to: boolean;
3577
3764
  /** The version number it will take if it is put live. */
3578
3765
  will_be_version: number;
3579
3766
  /** Always null: nothing in flight is a version yet. */
@@ -3588,8 +3775,6 @@ export interface PipelineActiveRun {
3588
3775
  * not a version, and becomes one only if a member promotes it.
3589
3776
  */
3590
3777
  competed: boolean;
3591
- /** What recipe it is trying, when it is a recipe variant. See TrainingRun.recipe_note. */
3592
- recipe_note: string | null;
3593
3778
  }
3594
3779
  /**
3595
3780
  * One version: an attempt that was put live -- promoted by the pipeline's
@@ -3622,6 +3807,9 @@ export interface PipelineVersion {
3622
3807
  rows_scored: number | null;
3623
3808
  win_rate: number | null;
3624
3809
  mean_delta: number | null;
3810
+ /** The share of those conversations each side passed (score 0.70 or more). */
3811
+ candidate_pass_rate: number | null;
3812
+ incumbent_pass_rate: number | null;
3625
3813
  /**
3626
3814
  * The standing benchmark's replay of this version, when the rule has one.
3627
3815
  * Only scores with `benchmark_comparable` sit on one axis.
@@ -3648,6 +3836,14 @@ export interface PipelineVersion {
3648
3836
  * not what it did.
3649
3837
  */
3650
3838
  cost_includes_candidate_ceiling: boolean;
3839
+ /**
3840
+ * True when `cost_cents` is the most the version can have cost rather than
3841
+ * what it did: its comparison machines at their ceilings
3842
+ * (`cost_includes_candidate_ceiling`), or one charged (counted from its
3843
+ * first boot, where the platform bills from its first answer). Show it as
3844
+ * "up to".
3845
+ */
3846
+ cost_up_to: boolean;
3651
3847
  /** Machine time the attempt held (training and comparison); null when unknown. */
3652
3848
  gpu_seconds: number | null;
3653
3849
  created_at: string;
@@ -3659,18 +3855,10 @@ export interface PipelineVersion {
3659
3855
  */
3660
3856
  compared_at: string | null;
3661
3857
  /**
3662
- * Why the run that made it fired. `variant` is a version trained on the same
3663
- * conversations as the one before it with one setting changed; every other
3664
- * value is a version that learned from newly reviewed conversations (or a
3665
- * member's run now).
3858
+ * Why the attempt that made it was made, in the words `attempts[]` uses for
3859
+ * the same run; see {@link PipelineAttempt.trigger}.
3666
3860
  */
3667
- trigger: TrainingTrigger;
3668
- /** See TrainingRun.recipe_note. */
3669
- recipe_note: string | null;
3670
- /** See TrainingRun.recipe_of_version. */
3671
- recipe_of_version: number | null;
3672
- /** See TrainingRun.recipe. */
3673
- recipe: TrainingRecipe;
3861
+ trigger: PipelineAttemptTrigger;
3674
3862
  finished_at: string | null;
3675
3863
  }
3676
3864
  /**
@@ -3704,8 +3892,16 @@ export interface PipelineAttempt {
3704
3892
  gpu_seconds: number | null;
3705
3893
  /** As the versions are priced once it has ended; as recorded so far while it runs. */
3706
3894
  cost_cents: number;
3895
+ /** See {@link PipelineVersion.cost_up_to}. */
3896
+ cost_up_to: boolean;
3707
3897
  verdict: TrainingVerdict | null;
3708
3898
  win_rate: number | null;
3899
+ /**
3900
+ * The share of the held-back conversations the attempt and the version it
3901
+ * was compared with passed (score 0.70 or more); null until it is compared.
3902
+ */
3903
+ candidate_pass_rate: number | null;
3904
+ incumbent_pass_rate: number | null;
3709
3905
  evaluation_id: string | null;
3710
3906
  /** Its last sentence. */
3711
3907
  reason: string | null;
@@ -3732,24 +3928,28 @@ export interface PipelineSchedule {
3732
3928
  hour_utc: number;
3733
3929
  }
3734
3930
  /**
3735
- * When a pipeline trains: at least `min_samples` new samples AND, when there
3736
- * is one, at its scheduled slot. A null schedule trains as soon as the minimum
3737
- * is met.
3931
+ * When a pipeline trains: once it has the samples the platform's fixed
3932
+ * minimum asks for (`minimums` says how many, and how many it has) AND, when
3933
+ * there is a schedule, at its scheduled slot. A null schedule trains as soon
3934
+ * as the minimum is met. The minimum is not a setting: no body sets it.
3738
3935
  */
3739
3936
  export interface PipelineTrainWhen {
3740
- min_samples: number;
3741
3937
  schedule: PipelineSchedule | null;
3742
3938
  }
3743
3939
  /** What is held back beyond max(50, 5% of the data): a larger percent, or a count. */
3744
3940
  export interface PipelineHoldout {
3745
- percent: number;
3746
- count: number | null;
3747
3941
  min_rows: number;
3748
3942
  }
3749
3943
  /**
3750
- * How far the data is from the next version. `first_version`: `needed` usable
3751
- * rows v1 trains on. `new_rows`: `needed` usable rows the last version's set
3752
- * did not have. `have`, `short` and `message` are measured on the detail only.
3944
+ * How far the data is from the next attempt, by the platform's fixed
3945
+ * minimums (`floors` on `listModels`). READ-ONLY: no body changes them.
3946
+ *
3947
+ * `first_version`: `needed` usable samples the first attempt needs -- the
3948
+ * rows it trains on plus the ones held back to judge it. `new_rows`: `needed`
3949
+ * usable samples the last trained attempt did not have, which is
3950
+ * `floors.new_samples` or `floors.new_samples_percent` of the rows that
3951
+ * attempt trained on, whichever is more. `have`, `short` and `message` are
3952
+ * measured on the detail only.
3753
3953
  */
3754
3954
  export interface PipelineMinimums {
3755
3955
  basis: 'first_version' | 'new_rows';
@@ -3758,6 +3958,22 @@ export interface PipelineMinimums {
3758
3958
  short: number | null;
3759
3959
  message: string | null;
3760
3960
  }
3961
+ /**
3962
+ * The state of the live version's deployment:
3963
+ * - `serving`: it answers.
3964
+ * - `starting`: it is on its way up.
3965
+ * - `stopped`, `paused_for_funds` (the wallet ran out) and `deleted`: it does
3966
+ * not answer and is not billed.
3967
+ * - `paused_by_platform`: the platform paused it because billing could not be
3968
+ * reached; it does not answer.
3969
+ * - `failed`: it does not answer.
3970
+ */
3971
+ export type PipelineLiveDeploymentStatus = 'serving' | 'starting' | 'stopped' | 'paused_for_funds' | 'paused_by_platform' | 'failed' | 'deleted';
3972
+ /** The live version's deployment, as last checked (`checked_at`). */
3973
+ export interface PipelineLiveDeployment {
3974
+ status: PipelineLiveDeploymentStatus;
3975
+ checked_at: string;
3976
+ }
3761
3977
  export interface Pipeline {
3762
3978
  rule_id: string;
3763
3979
  rule_name: string;
@@ -3780,10 +3996,6 @@ export interface Pipeline {
3780
3996
  * commit the server pinned.
3781
3997
  */
3782
3998
  challenger_model: PipelineModelRef | null;
3783
- /** `sft` today; `kto`, `dpo` and `grpo` cannot be chosen yet. */
3784
- training_type: string;
3785
- /** How each version starts: `fresh`, a new adapter over the pinned base trained on all accepted data. */
3786
- version_base: string;
3787
3999
  train_when: PipelineTrainWhen;
3788
4000
  promotion: PipelinePromotion;
3789
4001
  holdout: PipelineHoldout;
@@ -3793,11 +4005,16 @@ export interface Pipeline {
3793
4005
  /** The pinned base every version is a fresh adapter over, which is what makes their scores comparable. */
3794
4006
  base_model_id: string;
3795
4007
  base_model_revision: string;
3796
- train_type: string;
3797
4008
  /** The version serving now; null when what serves is not a version of this pipeline. */
3798
4009
  live_version: number | null;
3799
4010
  /** The same number under its older name. */
3800
4011
  champion_version: number | null;
4012
+ /**
4013
+ * Whether the deployment the live version answers from is up, as the
4014
+ * platform last checked it. Null when there is no live version, when what
4015
+ * serves is not a deployment, or before the first check of that deployment.
4016
+ */
4017
+ live_deployment: PipelineLiveDeployment | null;
3801
4018
  /** The name the app calls. It does not change when a version is promoted. */
3802
4019
  serving_name: string;
3803
4020
  /**
@@ -3808,25 +4025,31 @@ export interface Pipeline {
3808
4025
  serving_taken_over_by: string | null;
3809
4026
  benchmark_id: string | null;
3810
4027
  benchmark_name: string | null;
3811
- benchmark_decides: boolean;
4028
+ /** The least a benchmark's score has to rise by to count as an improvement under a policy that reads benchmarks. */
3812
4029
  benchmark_min_delta: number;
3813
4030
  status: PipelineStatus;
3814
4031
  /**
3815
4032
  * The rule's own sentence about what it is waiting for or why it stopped,
3816
4033
  * verbatim. Only as fresh as the platform's last visit: when `status` is
3817
- * `paused`, `paused_reason` and `needs_consent` are what say why.
4034
+ * `paused`, `paused_reason` is what says why.
3818
4035
  */
3819
4036
  next_reason: string | null;
3820
4037
  last_checked_at: string | null;
3821
4038
  next_due_at: string | null;
3822
4039
  auto_promote: boolean;
3823
- /** Why the platform stopped firing this rule, or null. Same codes as the rule's. */
4040
+ /**
4041
+ * Why the platform stopped firing this rule, or null. `consent_invalid` is
4042
+ * a pipeline whose settings changed since it was last saved: saving it
4043
+ * again starts it.
4044
+ */
3824
4045
  paused_reason: TrainingRulePausedReason | null;
3825
4046
  /**
3826
- * The rule's terms changed and nobody has accepted them. It makes nothing
3827
- * until somebody does.
4047
+ * When this workspace's scoring key comes off its monthly cap (the start of
4048
+ * the next UTC month), or null when it is not capped. Until then Train now
4049
+ * answers 409 `SCORING_CAPPED` with this time as `resumes_at`, and nothing
4050
+ * trains on its own: an attempt would train and could not be compared.
3828
4051
  */
3829
- needs_consent: boolean;
4052
+ scoring_capped_until: string | null;
3830
4053
  /** The rule's monthly limit. Null means it has none. */
3831
4054
  monthly_ceiling_cents: number | null;
3832
4055
  /**
@@ -3834,10 +4057,11 @@ export interface Pipeline {
3834
4057
  * this UTC calendar month -- the figure the limit is enforced against. An
3835
4058
  * upper bound, not an exact spend. A run counts toward the month it was
3836
4059
  * created in, and a run still in progress also counts toward the current
3837
- * month, at its three ceilings or what it has been billed when that is
3838
- * more. A finished run counts what it was billed, and its comparison
3839
- * machine is billed at the most it could have cost (the hourly cap for the
3840
- * time it was up, never more than the candidate ceiling). A run created in
4060
+ * month, at the most it may cost (as `run_max_cents` counts it, a base
4061
+ * model's machine included where the attempt has one of its own) or what it
4062
+ * has been billed when that is more. A finished run counts what it was billed, and its comparison
4063
+ * machines are billed at the most they could have cost (each machine's
4064
+ * hourly cap for the time it was up, never more than its own amount). A run created in
3841
4065
  * an earlier month that finishes in this one counts here only while it is
3842
4066
  * still running.
3843
4067
  */
@@ -3852,10 +4076,10 @@ export interface TrainingRuleDeleteResponse {
3852
4076
  deleted: boolean;
3853
4077
  rule_id: string;
3854
4078
  /**
3855
- * The name this delete just spent. The delete is a soft delete and the name
3856
- * index carries no partial predicate, so the row goes on holding the name
3857
- * after it has left every list you can read, and no later rule in the
3858
- * workspace can be called that. There is no purge and no undelete.
4079
+ * The name this delete just spent. The pipeline's history is purged in the
4080
+ * background, but its record keeps the name after it has left every list
4081
+ * you can read, so no later pipeline in the workspace can be called that.
4082
+ * There is no undelete.
3859
4083
  */
3860
4084
  retained_name: string;
3861
4085
  cancelled_run_id: string | null;
@@ -3864,6 +4088,14 @@ export interface TrainingRunListResponse {
3864
4088
  runs: TrainingRunSummary[];
3865
4089
  total: number;
3866
4090
  }
4091
+ /** One replay of a run on one of its pipeline's benchmarks, to link its report by. */
4092
+ export interface TrainingRunBenchmarkRun {
4093
+ benchmark_id: string;
4094
+ name: string;
4095
+ /** The replay's id: what `getBenchmarkRun` and `listBenchmarkRunItems` take. */
4096
+ run_id: string;
4097
+ status: BenchmarkRunStatus;
4098
+ }
3867
4099
  export interface TrainingRunResponse {
3868
4100
  run: TrainingRun;
3869
4101
  timeline: TrainingRunEvent[];
@@ -3873,6 +4105,8 @@ export interface TrainingRunResponse {
3873
4105
  * attached to the rule.
3874
4106
  */
3875
4107
  benchmark: BenchmarkRun | null;
4108
+ /** Every benchmark this run was replayed on, the primary included. */
4109
+ benchmark_runs: TrainingRunBenchmarkRun[];
3876
4110
  links: TrainingRunLinks;
3877
4111
  available_actions: TrainingRunActions;
3878
4112
  }
@@ -3885,6 +4119,12 @@ export interface EvaluationItemsResponse {
3885
4119
  items: EvaluationItem[];
3886
4120
  total: number;
3887
4121
  }
4122
+ /** A page of one replay's conversations, in the benchmark's order. */
4123
+ export interface BenchmarkRunItemsResponse {
4124
+ items: BenchmarkRunItem[];
4125
+ /** Every conversation the filter matches, not only this page. */
4126
+ total: number;
4127
+ }
3888
4128
  export interface InferenceAliasListResponse {
3889
4129
  aliases: InferenceAlias[];
3890
4130
  }
@@ -3945,9 +4185,12 @@ export interface PipelineWriteRequest {
3945
4185
  } | null;
3946
4186
  /** More tags whose conversations the pipeline trains on. On an edit the list replaces the old one. */
3947
4187
  tags?: string[];
3948
- /** At least `min_samples` new samples (250 and up for SFT) AND, when set, the schedule. */
4188
+ /**
4189
+ * The schedule to wait for, beside the platform's fixed sample minimum.
4190
+ * There is no `min_samples`: the minimums are fixed, and a body that sends
4191
+ * one is refused 400 naming it.
4192
+ */
3949
4193
  train_when?: {
3950
- min_samples?: number;
3951
4194
  schedule?: {
3952
4195
  every: 'day' | 'week';
3953
4196
  weekday?: number;
@@ -3980,12 +4223,21 @@ export interface LoopModel {
3980
4223
  /** Verified end to end on the platform for training and serving. */
3981
4224
  recommended: boolean;
3982
4225
  }
3983
- /** The floors a new pipeline is held to, in samples (`GET /api/loop/models`). */
4226
+ /**
4227
+ * The fixed minimums a pipeline is held to, in samples
4228
+ * (`GET /api/loop/models`). READ-ONLY: they are the platform's, and no body
4229
+ * sets them.
4230
+ */
3984
4231
  export interface PipelineFloors {
3985
- /** Samples a new pipeline's first attempt needs: training rows plus the held-back set. */
4232
+ /** Samples a new pipeline's first attempt needs: the rows it trains on plus the held-back set. */
3986
4233
  first_version_samples: number;
3987
- /** `train_when.min_samples`' default and floor. */
4234
+ /** The fewest new samples any later attempt waits for. */
3988
4235
  new_samples: number;
4236
+ /**
4237
+ * The share, in percent, of the rows the last trained attempt trained on
4238
+ * that a later attempt must add when that is more than `new_samples`.
4239
+ */
4240
+ new_samples_percent: number;
3989
4241
  }
3990
4242
  export interface LoopModelsResponse {
3991
4243
  models: LoopModel[];
@@ -4060,6 +4312,9 @@ export interface VersionBenchmarkScore {
4060
4312
  items_digest: string | null;
4061
4313
  comparable: boolean;
4062
4314
  why: string | null;
4315
+ /** The share each side passed (score 0.70 or more); null when there is no score. */
4316
+ incumbent_pass_rate: number | null;
4317
+ candidate_pass_rate: number | null;
4063
4318
  }
4064
4319
  /** One measurement a promotion rule weighed. */
4065
4320
  export interface PromotionMeasurement {
@@ -4085,6 +4340,15 @@ export interface PromotionOutcome {
4085
4340
  weighted_delta: number | null;
4086
4341
  measurements: PromotionMeasurement[];
4087
4342
  }
4343
+ /** A version's head-to-head on the held-back conversations. */
4344
+ export interface VersionHoldout {
4345
+ rows_scored: number | null;
4346
+ win_rate: number | null;
4347
+ mean_delta: number | null;
4348
+ /** The share each side passed (score 0.70 or more). */
4349
+ incumbent_pass_rate: number | null;
4350
+ candidate_pass_rate: number | null;
4351
+ }
4088
4352
  /** One version with every measurement it has. */
4089
4353
  export interface VersionScores {
4090
4354
  version: number;
@@ -4097,11 +4361,7 @@ export interface VersionScores {
4097
4361
  verdict: string | null;
4098
4362
  decision: string | null;
4099
4363
  compared_at: string | null;
4100
- holdout: {
4101
- rows_scored: number | null;
4102
- win_rate: number | null;
4103
- mean_delta: number | null;
4104
- };
4364
+ holdout: VersionHoldout;
4105
4365
  /** One entry per entry of the response's `benchmarks`, in the same order. */
4106
4366
  benchmarks: VersionBenchmarkScore[];
4107
4367
  promotion: PromotionOutcome | null;