runbios-sdk 0.2.20-dev.290 → 0.2.20-dev.293

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/index.d.ts CHANGED
@@ -36,7 +36,7 @@ import { Loop } from './resources/loop.js';
36
36
  * SDK version. Sent as part of the User-Agent header.
37
37
  * Must match package.json "version" -- enforced by a contract test.
38
38
  */
39
- export declare const VERSION = "0.2.20-dev.290";
39
+ export declare const VERSION = "0.2.20-dev.293";
40
40
  export declare class RunBiOS {
41
41
  /** Search models, fetch configs, check adapter compatibility. */
42
42
  readonly models: Models;
@@ -75,7 +75,7 @@ export { Training } from './resources/training.js';
75
75
  export { Wallet } from './resources/wallet.js';
76
76
  export { GPU, type GPURecommendation } from './resources/gpu.js';
77
77
  export { Inference, validateChatRequest, parseSSE, buildInferenceRequest, contextSizingBasis, type ContextSizingBasis, CONTEXT_DEFAULT_CEILING, CONTEXT_EDITABLE_FLOOR, type ChatMessage, type FunctionTool, type ChatCompletionParams, type ChatCompletionResponse, type ChatCompletionChunk, type InferenceVerbParams, type CompletionParams, type EmbeddingParams, type RerankParams, type AnthropicMessageParams, type ServerlessUsageWindow, type ServerlessTimeseriesMetric, type ServerlessWorkspaceLimits, type ServerlessUsageEnvelope, type ServerlessUsageOverviewResponse, type ServerlessUsageRowsResponse, type ServerlessUsageTimeseriesResponse, type ServerlessUsageDailyResponse, type ServerlessSavingsTotals, type ServerlessSavingsPeriod, type ServerlessUsageSavingsResponse, } from './resources/inference.js';
78
- export type { BiOSConfig, PaginatedResponse, ApiErrorBody, AvailableGpuAlternative, CapacityMinimumRequirement, InferenceBookingAccepted, Model, ModelSearchParams, ModelSearchResponse, ModelDetailResponse, InferenceModel, InferenceModelListResponse, ModelConfig, Dataset, DatasetListParams, DatasetListResponse, DatasetUploadParams, DatasetPreview, DatasetPreviewParams, DatasetImportHFParams, DatasetRegisterHFParams, DatasetHubSearchParams, DatasetHubPreviewParams, DatasetValidation, DatasetFormatVariant, DatasetFormatSpec, DatasetFormatSpecs, DatasetStorageUsage, TrainingMethod, RLHFAlgorithm, AdapterType, TrainingJobStatus, TrainingStatusFilter, TrainingCreateParams, TrainingListParams, TrainingListResponse, TrainingJob, TrainingMetrics, TrainingResourceMetrics, TrainingDeviceMetrics, MetricPoint, MetricGraphConfig, TrainingCheckpoint, TrainingLogs, TrainingLogEntry, TrainingStopResponse, TrainingResumeResponse, CanonicalTrainingRequest, TrainingPreflightDataset, TrainingPreflightWarning, TrainingPreflightResponse, TrainingCapabilityChoice, TrainingConfigFieldCapability, TrainingCapabilities, GPUChoice, WalletBalance, Transaction, TransactionListResponse, TransactionListParams, GPUInfo, GPUPricingResponse, GPUOptionsParams, TrainingRecommendParams, TrainingAdvisorVerdict, TrainingAdvisorRecommendation, TrainingAdvisorUserShape, TrainingAdvisorJustification, TrainingAdvisorBasis, GPUOption, GPUOptionSuggestion, GPUOptionsResponse, InferenceStatus, InferenceCreateParams, InferenceUpdateParams, InferenceDeployment, InferenceDeploymentSummary, InferenceCreateResponse, InferenceListResponse, InferenceUpdateResponse, InferenceLifecycleResponse, InferenceDeleteResponse, InferenceGPUOptionMarket, InferenceGPUOption, InferenceGPUAlternative, InferenceGPUOptionsParams, InferenceGPUOptionsResponse, InferenceCanonicalRequest, InferencePreflightWarning, InferencePreflightResponse, AdapterCompatibility, AdapterCompatibilityResponse, AdapterCompatibilityParams, SupportedArchitecture, ArchitectureScope, SupportedArchitecturesResponse, ApiKey, ApiKeyScope, ApiKeyIntrospection, Organization, OrgMember, OrgInvite, Workspace, Integration, IntegrationCreateParams, StorageUsage, StorageObject, PromptTokensDetails, ChatCompletionUsage, ServingKind, TrainingRulePausedReason, TrainingTrigger, TrainingRecipe, TrainingRunState, TrainingVerdict, TrainingDecision, EvaluationStatus, EvaluationItemStatus, EvaluationWinner, EvaluationItemWinnerFilter, EvaluationWarningCode, TrainingToolCall, TrainingMessage, TrainingRuleServing, TrainingRunPromoteRequest, TrainingRunRejectRequest, TrainingRunRollbackRequest, TrainingRunCancelRequest, TrainingRunListParams, TrainingRun, TrainingRunSummary, TrainingRunEvent, TrainingRunLinks, TrainingRunActions, EvaluationRef, EvaluationDecoding, EvaluationJudgeDimension, EvaluationDimensionScore, EvaluationWarning, EvaluationMargin, Evaluation, EvaluationItemJudge, EvaluationReferenceKind, EvaluationReference, EvaluationPairwiseOrder, EvaluationItemPairwise, EvaluationItemSide, EvaluationItem, EvaluationItemListParams, BenchmarkStatus, BenchmarkSourceKind, BenchmarkRunStatus, BenchmarkScoring, BenchmarkDimensionScore, Benchmark, BenchmarkItem, BenchmarkRun, BenchmarkRunItemSide, BenchmarkRunItem, BenchmarkRunItemListParams, BenchmarkHistoryPoint, BenchmarkSource, BenchmarkCreateParams, BenchmarkListParams, BenchmarkItemListParams, BenchmarkHistoryParams, BenchmarkRetireParams, InferenceAlias, InferenceAliasRequest, TrainingRuleDeleteResponse, TrainingRunListResponse, TrainingRunBenchmarkRun, TrainingRunResponse, TrainingRunActionResponse, EvaluationItemsResponse, BenchmarkRunItemsResponse, InferenceAliasListResponse, InferenceAliasResponse, InferenceAliasDeleteResponse, BenchmarkListResponse, BenchmarkItemsResponse, BenchmarkHistoryResponse, TrainingRuleRunRefusalCode, TrainingRuleSaveRefusalCode, TrainingRuleMonthlyLimitRefusal, PipelineStatus, PipelineActiveRun, PipelineVersion, PipelineAttempt, PipelineAttemptTrigger, PipelineAttemptOutcome, PipelineLiveDeploymentStatus, PipelineLiveDeployment, Pipeline, PipelineListParams, PipelineListResponse, PipelineResponse, PipelineTrainWhen, PipelineSchedule, PipelineWriteRequest, PipelineMutationResponse, PipelineImportParams, PipelineFloors, LoopModel, LoopModelsResponse, LoopTracePipeline, LoopTracePipelinesResponse, LoopMetricsHistoryParams, LoopMetricPoint, LoopSignalDay, LoopMetricsHistory, PromotionPolicyState, RuleBenchmark, PipelineBenchmarksResponse, PipelineBenchmarkAttachParams, PipelineBenchmarkMoveParams, CompareBenchmark, VersionBenchmarkScore, PromotionMeasurement, PromotionOutcome, VersionHoldout, VersionScores, VersionScoreDifference, VersionCompareResponse, VersionCompareParams, } from './types.js';
78
+ export type { BiOSConfig, PaginatedResponse, ApiErrorBody, AvailableGpuAlternative, CapacityMinimumRequirement, InferenceBookingAccepted, Model, ModelSearchParams, ModelSearchResponse, ModelDetailResponse, InferenceModel, InferenceModelListResponse, ModelConfig, Dataset, DatasetListParams, DatasetListResponse, DatasetUploadParams, DatasetPreview, DatasetPreviewParams, DatasetImportHFParams, DatasetRegisterHFParams, DatasetHubSearchParams, DatasetHubPreviewParams, DatasetValidation, DatasetFormatVariant, DatasetFormatSpec, DatasetFormatSpecs, DatasetStorageUsage, TrainingMethod, RLHFAlgorithm, AdapterType, TrainingJobStatus, TrainingStatusFilter, TrainingCreateParams, TrainingListParams, TrainingListResponse, TrainingJob, TrainingMetrics, TrainingResourceMetrics, TrainingDeviceMetrics, MetricPoint, MetricGraphConfig, TrainingCheckpoint, TrainingLogs, TrainingLogEntry, TrainingStopResponse, TrainingResumeResponse, CanonicalTrainingRequest, TrainingPreflightDataset, TrainingPreflightWarning, TrainingPreflightResponse, TrainingCapabilityChoice, TrainingConfigFieldCapability, TrainingCapabilities, GPUChoice, WalletBalance, Transaction, TransactionListResponse, TransactionListParams, GPUInfo, GPUPricingResponse, GPUOptionsParams, TrainingRecommendParams, TrainingAdvisorVerdict, TrainingAdvisorRecommendation, TrainingAdvisorUserShape, TrainingAdvisorJustification, TrainingAdvisorBasis, GPUOption, GPUOptionSuggestion, GPUOptionsResponse, InferenceStatus, InferenceCreateParams, InferenceUpdateParams, InferenceDeployment, InferenceDeploymentSummary, InferenceCreateResponse, InferenceListResponse, InferenceUpdateResponse, InferenceLifecycleResponse, InferenceDeleteResponse, InferenceGPUOptionMarket, InferenceGPUOption, InferenceGPUAlternative, InferenceGPUOptionsParams, InferenceGPUOptionsResponse, InferenceCanonicalRequest, InferencePreflightWarning, InferencePreflightResponse, AdapterCompatibility, AdapterCompatibilityResponse, AdapterCompatibilityParams, SupportedArchitecture, ArchitectureScope, SupportedArchitecturesResponse, ApiKey, ApiKeyScope, ApiKeyIntrospection, Organization, OrgMember, OrgInvite, Workspace, Integration, IntegrationCreateParams, StorageUsage, StorageObject, PromptTokensDetails, ChatCompletionUsage, ServingKind, TrainingRulePausedReason, TrainingTrigger, TrainingRecipe, TrainingRunState, TrainingVerdict, TrainingDecision, EvaluationStatus, EvaluationItemStatus, ItemErrorCode, EvaluationWinner, EvaluationItemWinnerFilter, ReportStatusFilter, ReportSort, EvaluationWarningCode, TrainingToolCall, TrainingMessage, TrainingRuleServing, TrainingRunPromoteRequest, TrainingRunRejectRequest, TrainingRunRollbackRequest, TrainingRunCancelRequest, TrainingRunListParams, TrainingRun, TrainingRunSummary, TrainingRunEvent, TrainingRunLinks, TrainingRunActions, EvaluationRef, EvaluationDecoding, EvaluationJudgeDimension, EvaluationDimensionScore, EvaluationWarning, EvaluationMargin, Evaluation, EvaluationItemJudge, EvaluationReferenceKind, EvaluationReference, EvaluationPairwiseOrder, EvaluationItemPairwise, EvaluationItemSide, EvaluationItem, EvaluationItemListParams, BenchmarkStatus, BenchmarkSourceKind, BenchmarkRunStatus, BenchmarkScoring, BenchmarkCheck, BenchmarkDimensionScore, Benchmark, BenchmarkItem, BenchmarkRun, BenchmarkRunItemSide, BenchmarkRunItem, BenchmarkRunItemListParams, BenchmarkHistoryPoint, BenchmarkSource, BenchmarkCreateParams, BenchmarkListParams, BenchmarkItemListParams, BenchmarkHistoryParams, BenchmarkRetireParams, InferenceAlias, InferenceAliasRequest, TrainingRuleDeleteResponse, TrainingRunListResponse, TrainingRunBenchmarkRun, TrainingRunResponse, TrainingRunActionResponse, EvaluationItemsResponse, BenchmarkRunItemsResponse, InferenceAliasListResponse, InferenceAliasResponse, InferenceAliasDeleteResponse, BenchmarkListResponse, BenchmarkItemsResponse, BenchmarkHistoryResponse, TrainingRuleRunRefusalCode, TrainingRuleSaveRefusalCode, TrainingRuleMonthlyLimitRefusal, PipelineStatus, PipelineActiveRun, PipelineVersion, PipelineAttempt, PipelineAttemptTrigger, PipelineAttemptOutcome, PipelineLiveDeploymentStatus, PipelineLiveDeployment, LoopStorageWhere, LoopStorage, Pipeline, PipelineListParams, PipelineListResponse, PipelineResponse, PipelineTrainWhen, PipelineSchedule, PipelineWriteRequest, PipelineMutationResponse, PipelineImportParams, PipelineFloors, HeldBackFloors, LoopModel, LoopModelsResponse, LoopTracePipeline, LoopTracePipelinesResponse, LoopMetricsHistoryParams, LoopMetricPoint, LoopSignalDay, LoopMetricsHistory, PromotionPolicyState, RuleBenchmark, PipelineBenchmarksResponse, PipelineBenchmarkAttachParams, PipelineBenchmarkMoveParams, CompareBenchmark, VersionBenchmarkScore, PromotionMeasurement, PromotionOutcome, VersionHoldout, VersionScores, VersionScoreDifference, VersionCompareResponse, VersionCompareParams, TrainingRunPromotion, VerdictCheck, VerdictCheckKey, VerdictChecksWithheld, TrainingRunCost, AttemptDirection, AttemptHoldout, AttemptCompareSide, AttemptSharedSample, AttemptSharedFigures, AttemptBenchmarkSide, AttemptCompareBenchmark, AttemptCompareItemSide, AttemptCompareItem, AttemptCompareResponse, AttemptCompareParams, } from './types.js';
79
79
  /** The closed set of run states a training run never leaves. */
80
80
  export { TERMINAL_RUN_STATES } from './types.js';
81
81
  /** The most versions a pipeline may be set to make. */
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ import { Loop } from './resources/loop.js';
36
36
  * SDK version. Sent as part of the User-Agent header.
37
37
  * Must match package.json "version" -- enforced by a contract test.
38
38
  */
39
- export const VERSION = '0.2.20-dev.290';
39
+ export const VERSION = '0.2.20-dev.293';
40
40
  export class RunBiOS {
41
41
  /** Search models, fetch configs, check adapter compatibility. */
42
42
  models;
@@ -1,5 +1,5 @@
1
1
  import type { HttpClient } from '../client.js';
2
- import type { LoopTrace, LoopTraceListResponse, LoopTraceListParams, LoopCaptureParams, LoopCaptureResult, LoopImportParams, LoopImportResult, LoopSignal, LoopSignalParams, LoopLabel, LoopLabelCount, LoopConfig, LoopConfigParams, LoopStats, LoopTracePipelinesResponse, LoopMetricsHistory, LoopMetricsHistoryParams, TrainingRuleDeleteResponse, TrainingRunListParams, TrainingRunListResponse, TrainingRunResponse, TrainingRunActionResponse, TrainingRunPromoteRequest, TrainingRunRejectRequest, TrainingRunRollbackRequest, TrainingRunCancelRequest, Evaluation, EvaluationItemListParams, EvaluationItemsResponse, Benchmark, BenchmarkCreateParams, BenchmarkHistoryParams, BenchmarkHistoryResponse, BenchmarkItemListParams, BenchmarkItemsResponse, BenchmarkListParams, BenchmarkListResponse, BenchmarkRetireParams, BenchmarkRun, BenchmarkRunItemListParams, BenchmarkRunItemsResponse, Pipeline, PipelineListParams, PipelineListResponse, PipelineWriteRequest, PipelineMutationResponse, LoopModelsResponse, PipelineImportParams, PipelineBenchmarksResponse, PipelineBenchmarkAttachParams, PipelineBenchmarkMoveParams, VersionCompareResponse, VersionCompareParams } from '../types.js';
2
+ import type { LoopTrace, LoopTraceListResponse, LoopTraceListParams, LoopCaptureParams, LoopCaptureResult, LoopImportParams, LoopImportResult, LoopSignal, LoopSignalParams, LoopLabel, LoopLabelCount, LoopConfig, LoopConfigParams, LoopStats, LoopTracePipelinesResponse, LoopMetricsHistory, LoopMetricsHistoryParams, TrainingRuleDeleteResponse, TrainingRunListParams, TrainingRunListResponse, TrainingRunResponse, TrainingRunActionResponse, TrainingRunPromoteRequest, TrainingRunRejectRequest, TrainingRunRollbackRequest, TrainingRunCancelRequest, Evaluation, EvaluationItemListParams, EvaluationItemsResponse, Benchmark, BenchmarkCreateParams, BenchmarkHistoryParams, BenchmarkHistoryResponse, BenchmarkItemListParams, BenchmarkItemsResponse, BenchmarkListParams, BenchmarkListResponse, BenchmarkRetireParams, BenchmarkRun, BenchmarkRunItemListParams, BenchmarkRunItemsResponse, Pipeline, PipelineListParams, PipelineListResponse, PipelineWriteRequest, PipelineMutationResponse, LoopModelsResponse, PipelineImportParams, PipelineBenchmarksResponse, PipelineBenchmarkAttachParams, PipelineBenchmarkMoveParams, VersionCompareResponse, VersionCompareParams, AttemptCompareResponse, AttemptCompareParams } from '../types.js';
3
3
  /**
4
4
  * The Conscious Loop -- pipelines that keep improving a model from the
5
5
  * conversations you send them.
@@ -371,7 +371,12 @@ export declare class Loop {
371
371
  * fixed `floors` a pipeline is held to: the samples its first attempt
372
372
  * needs, and the new samples each later attempt waits for
373
373
  * (`new_samples`, or `new_samples_percent` of the rows the last trained
374
- * attempt trained on when that is more). They are read-only.
374
+ * attempt trained on when that is more), and the held-back rule
375
+ * (`held_back`: at least `min_rows`, or the share a pipeline chooses from
376
+ * `default_percent` to `max_percent` if that is more, and each attempt is
377
+ * judged on at most `scored_rows` of them). They are read-only.
378
+ * When the list cannot be read it throws `ApiError` 503
379
+ * `MODELS_UNAVAILABLE`, whose `body.floors` still carries the floors.
375
380
  */
376
381
  listModels(): Promise<LoopModelsResponse>;
377
382
  /**
@@ -382,14 +387,17 @@ export declare class Loop {
382
387
  * the platform trains a new version on GPUs it chooses, compares it with what
383
388
  * serves your traffic, and promotes it by the pipeline's promotion policy.
384
389
  * What is charged is the GPU time the runs actually use; the platform's own
385
- * per-run and monthly limits stop a run that goes wrong.
390
+ * per-run and monthly limits stop a run that goes wrong. `holdout.percent`
391
+ * (5 to 20, default 5) is the share of its samples held back to judge each
392
+ * attempt and never trained on.
386
393
  */
387
394
  createPipeline(params: PipelineWriteRequest): Promise<PipelineMutationResponse>;
388
395
  /**
389
396
  * Edit a pipeline. Only the fields sent change; `max_versions: null` removes
390
397
  * the limit and `challenger_model: null` removes the challenger. `promotion`
391
- * is how the promotion policy is set. Saving is the authorization, as on a
392
- * create.
398
+ * is how the promotion policy is set. A new `holdout.percent` is a new
399
+ * revision: lowering it keeps every sample already held back, and raising it
400
+ * holds back only new samples. Saving is the authorization, as on a create.
393
401
  */
394
402
  updatePipeline(id: string, params: PipelineWriteRequest): Promise<PipelineMutationResponse>;
395
403
  /**
@@ -438,6 +446,23 @@ export declare class Loop {
438
446
  * VERSION numbers; with both, `differences` says b minus a per benchmark.
439
447
  */
440
448
  compareVersions(id: string, params?: VersionCompareParams): Promise<VersionCompareResponse>;
449
+ /**
450
+ * Any two attempts of a pipeline side by side, put live or not. `a` and `b`
451
+ * are RUN ids. Each side's held-back numbers (never subtracted: each was
452
+ * compared with its own opponent), every benchmark both replayed with b
453
+ * minus a where comparable, and a page of the held-back conversations both
454
+ * were scored on, each side's score and whether it passed, and whether b
455
+ * scored higher, lower or the same (`tie_band` or more above counts as
456
+ * higher; less than `tie_band` apart is about the same). `shared_sample.a`
457
+ * and `.b` are each attempt's mean and pass rate over those same
458
+ * conversations -- the like-for-like figures; each side's `holdout` is over
459
+ * its own, possibly larger, set. When the two were scored differently
460
+ * (another scoring model or rubric), `shared_sample.comparable` is false,
461
+ * `why` says so, no direction is given and `filter` is refused (400); a
462
+ * conversation whose right answer changed between them has no direction
463
+ * either. Numbers and ids only: read an answer with `listEvaluationItems`.
464
+ */
465
+ compareAttempts(id: string, params: AttemptCompareParams): Promise<AttemptCompareResponse>;
441
466
  /**
442
467
  * The comparison behind a verdict: both models on the same held-out rows,
443
468
  * with identical decoding, scored by the same judge.
@@ -462,6 +487,16 @@ export declare class Loop {
462
487
  * serving today won; the item itself says `incumbent`) or `tie` -- and read
463
488
  * `serving` first: the pairs the attempt lost are where a verdict is actually
464
489
  * checked. `limit` is 50 when absent and at most 200.
490
+ *
491
+ * Narrow further by `candidate_passed` and `incumbent_passed` (each `true`
492
+ * or `false`, one side each and composable: `false` is scored below 0.70,
493
+ * so `candidate_passed: false, incumbent_passed: true` is the regressions),
494
+ * `orders` (the two side-by-side orders
495
+ * `agreed` or `disagreed`), `has_reference`, `status` (`scored`, `failed`),
496
+ * order by `sort` (`score_change`: the attempt's score less the other's,
497
+ * largest first), and search with `q` (2 to 200 characters) over each
498
+ * conversation, its right answer, both answers and every reason; `searched`
499
+ * says how many rows were searched.
465
500
  */
466
501
  listEvaluationItems(id: string, params?: EvaluationItemListParams): Promise<EvaluationItemsResponse>;
467
502
  /**
@@ -475,14 +510,24 @@ export declare class Loop {
475
510
  * replayed against both models on every run that finishes its comparison,
476
511
  * and reported as two absolute numbers on a scale that does not move.
477
512
  *
478
- * 20 to 200 conversations. A named conversation with nothing to ask a model
479
- * is refused rather than skipped, because pinning 47 of the 50 you chose is
480
- * the set being wrong from the first day and you would never find out.
513
+ * 20 to 200 conversations. A named conversation with nothing to ask a model,
514
+ * or too large to keep in storage, is refused 422 `BENCHMARK_ROW_UNUSABLE`
515
+ * rather than skipped, because pinning 47 of the 50 you chose is the set
516
+ * being wrong from the first day and you would never find out. The set is
517
+ * kept in storage and nowhere else: when it cannot be stored just then the
518
+ * create is refused 409 `CONFLICT` and nothing is saved; try again in a
519
+ * minute.
481
520
  *
482
521
  * The platform freezes the judge and the model it scores on (the ones every
483
522
  * pipeline comparison uses), gives both models the comparison's own answer
484
523
  * length, and sets what one replay may spend, inside the attempt's own
485
524
  * scoring limit; none of that is sent.
525
+ *
526
+ * `check: 'exact'` scores it by the exact check instead: the answer or the
527
+ * tool call must match the right answer pinned with each conversation, and
528
+ * no model is asked. Every conversation then needs a right answer (one a
529
+ * person marked good, or a correction); the ones without are refused 422
530
+ * `BENCHMARK_ROW_HAS_NO_ANSWER`, named, and nothing is saved.
486
531
  */
487
532
  createBenchmark(params: BenchmarkCreateParams): Promise<Benchmark>;
488
533
  /** Your benchmarks, newest first. Filter by `status` to hide retired ones. */
@@ -551,6 +596,10 @@ export declare class Loop {
551
596
  * exactly as on a comparison report's items. `limit` is 50 when absent and
552
597
  * at most 200. A replay that stopped before it began has no conversations:
553
598
  * its `status_reason` says why.
599
+ *
600
+ * The same `candidate_passed`, `incumbent_passed`, `has_reference`,
601
+ * `status`, `sort` and `q` as a
602
+ * comparison's items; there is no `orders`.
554
603
  */
555
604
  listBenchmarkRunItems(id: string, params?: BenchmarkRunItemListParams): Promise<BenchmarkRunItemsResponse>;
556
605
  }
@@ -515,7 +515,12 @@ export class Loop {
515
515
  * fixed `floors` a pipeline is held to: the samples its first attempt
516
516
  * needs, and the new samples each later attempt waits for
517
517
  * (`new_samples`, or `new_samples_percent` of the rows the last trained
518
- * attempt trained on when that is more). They are read-only.
518
+ * attempt trained on when that is more), and the held-back rule
519
+ * (`held_back`: at least `min_rows`, or the share a pipeline chooses from
520
+ * `default_percent` to `max_percent` if that is more, and each attempt is
521
+ * judged on at most `scored_rows` of them). They are read-only.
522
+ * When the list cannot be read it throws `ApiError` 503
523
+ * `MODELS_UNAVAILABLE`, whose `body.floors` still carries the floors.
519
524
  */
520
525
  async listModels() {
521
526
  const res = await this._http.fetchGet('/api/loop/models');
@@ -529,7 +534,9 @@ export class Loop {
529
534
  * the platform trains a new version on GPUs it chooses, compares it with what
530
535
  * serves your traffic, and promotes it by the pipeline's promotion policy.
531
536
  * What is charged is the GPU time the runs actually use; the platform's own
532
- * per-run and monthly limits stop a run that goes wrong.
537
+ * per-run and monthly limits stop a run that goes wrong. `holdout.percent`
538
+ * (5 to 20, default 5) is the share of its samples held back to judge each
539
+ * attempt and never trained on.
533
540
  */
534
541
  async createPipeline(params) {
535
542
  return this._http.fetchPost('/api/loop/pipelines', params);
@@ -537,8 +544,9 @@ export class Loop {
537
544
  /**
538
545
  * Edit a pipeline. Only the fields sent change; `max_versions: null` removes
539
546
  * the limit and `challenger_model: null` removes the challenger. `promotion`
540
- * is how the promotion policy is set. Saving is the authorization, as on a
541
- * create.
547
+ * is how the promotion policy is set. A new `holdout.percent` is a new
548
+ * revision: lowering it keeps every sample already held back, and raising it
549
+ * holds back only new samples. Saving is the authorization, as on a create.
542
550
  */
543
551
  async updatePipeline(id, params) {
544
552
  return this._http.fetchPut(`/api/loop/pipelines/${encodeURIComponent(id)}`, params);
@@ -612,6 +620,34 @@ export class Loop {
612
620
  const qs = q.toString();
613
621
  return this._http.fetchGet(`/api/loop/pipelines/${encodeURIComponent(id)}/versions/compare${qs ? `?${qs}` : ''}`);
614
622
  }
623
+ /**
624
+ * Any two attempts of a pipeline side by side, put live or not. `a` and `b`
625
+ * are RUN ids. Each side's held-back numbers (never subtracted: each was
626
+ * compared with its own opponent), every benchmark both replayed with b
627
+ * minus a where comparable, and a page of the held-back conversations both
628
+ * were scored on, each side's score and whether it passed, and whether b
629
+ * scored higher, lower or the same (`tie_band` or more above counts as
630
+ * higher; less than `tie_band` apart is about the same). `shared_sample.a`
631
+ * and `.b` are each attempt's mean and pass rate over those same
632
+ * conversations -- the like-for-like figures; each side's `holdout` is over
633
+ * its own, possibly larger, set. When the two were scored differently
634
+ * (another scoring model or rubric), `shared_sample.comparable` is false,
635
+ * `why` says so, no direction is given and `filter` is refused (400); a
636
+ * conversation whose right answer changed between them has no direction
637
+ * either. Numbers and ids only: read an answer with `listEvaluationItems`.
638
+ */
639
+ async compareAttempts(id, params) {
640
+ const q = new URLSearchParams();
641
+ q.set('a', params.a);
642
+ q.set('b', params.b);
643
+ if (params.filter != null)
644
+ q.set('filter', params.filter);
645
+ if (params.limit != null)
646
+ q.set('limit', String(params.limit));
647
+ if (params.offset != null)
648
+ q.set('offset', String(params.offset));
649
+ return this._http.fetchGet(`/api/loop/pipelines/${encodeURIComponent(id)}/attempts/compare?${q.toString()}`);
650
+ }
615
651
  // ── the comparison report ─────────────────────────────────────────────
616
652
  /**
617
653
  * The comparison behind a verdict: both models on the same held-out rows,
@@ -639,11 +675,21 @@ export class Loop {
639
675
  * serving today won; the item itself says `incumbent`) or `tie` -- and read
640
676
  * `serving` first: the pairs the attempt lost are where a verdict is actually
641
677
  * checked. `limit` is 50 when absent and at most 200.
678
+ *
679
+ * Narrow further by `candidate_passed` and `incumbent_passed` (each `true`
680
+ * or `false`, one side each and composable: `false` is scored below 0.70,
681
+ * so `candidate_passed: false, incumbent_passed: true` is the regressions),
682
+ * `orders` (the two side-by-side orders
683
+ * `agreed` or `disagreed`), `has_reference`, `status` (`scored`, `failed`),
684
+ * order by `sort` (`score_change`: the attempt's score less the other's,
685
+ * largest first), and search with `q` (2 to 200 characters) over each
686
+ * conversation, its right answer, both answers and every reason; `searched`
687
+ * says how many rows were searched.
642
688
  */
643
689
  async listEvaluationItems(id, params = {}) {
644
- const q = new URLSearchParams();
645
- if (params.winner)
646
- q.set('winner', params.winner);
690
+ const q = reportRowQuery(params);
691
+ if (params.orders)
692
+ q.set('orders', params.orders);
647
693
  if (params.limit != null)
648
694
  q.set('limit', String(params.limit));
649
695
  if (params.offset != null)
@@ -663,14 +709,24 @@ export class Loop {
663
709
  * replayed against both models on every run that finishes its comparison,
664
710
  * and reported as two absolute numbers on a scale that does not move.
665
711
  *
666
- * 20 to 200 conversations. A named conversation with nothing to ask a model
667
- * is refused rather than skipped, because pinning 47 of the 50 you chose is
668
- * the set being wrong from the first day and you would never find out.
712
+ * 20 to 200 conversations. A named conversation with nothing to ask a model,
713
+ * or too large to keep in storage, is refused 422 `BENCHMARK_ROW_UNUSABLE`
714
+ * rather than skipped, because pinning 47 of the 50 you chose is the set
715
+ * being wrong from the first day and you would never find out. The set is
716
+ * kept in storage and nowhere else: when it cannot be stored just then the
717
+ * create is refused 409 `CONFLICT` and nothing is saved; try again in a
718
+ * minute.
669
719
  *
670
720
  * The platform freezes the judge and the model it scores on (the ones every
671
721
  * pipeline comparison uses), gives both models the comparison's own answer
672
722
  * length, and sets what one replay may spend, inside the attempt's own
673
723
  * scoring limit; none of that is sent.
724
+ *
725
+ * `check: 'exact'` scores it by the exact check instead: the answer or the
726
+ * tool call must match the right answer pinned with each conversation, and
727
+ * no model is asked. Every conversation then needs a right answer (one a
728
+ * person marked good, or a correction); the ones without are refused 422
729
+ * `BENCHMARK_ROW_HAS_NO_ANSWER`, named, and nothing is saved.
674
730
  */
675
731
  async createBenchmark(params) {
676
732
  const res = await this._http.fetchPost('/api/loop/benchmarks', params);
@@ -777,11 +833,13 @@ export class Loop {
777
833
  * exactly as on a comparison report's items. `limit` is 50 when absent and
778
834
  * at most 200. A replay that stopped before it began has no conversations:
779
835
  * its `status_reason` says why.
836
+ *
837
+ * The same `candidate_passed`, `incumbent_passed`, `has_reference`,
838
+ * `status`, `sort` and `q` as a
839
+ * comparison's items; there is no `orders`.
780
840
  */
781
841
  async listBenchmarkRunItems(id, params = {}) {
782
- const q = new URLSearchParams();
783
- if (params.winner)
784
- q.set('winner', params.winner);
842
+ const q = reportRowQuery(params);
785
843
  if (params.limit != null)
786
844
  q.set('limit', String(params.limit));
787
845
  if (params.offset != null)
@@ -790,3 +848,22 @@ export class Loop {
790
848
  return this._http.fetchGet(`/api/loop/benchmark-runs/${encodeURIComponent(id)}/items${qs ? `?${qs}` : ''}`);
791
849
  }
792
850
  }
851
+ /** The row filters both report item routes take, in the service's own words. */
852
+ function reportRowQuery(params) {
853
+ const q = new URLSearchParams();
854
+ if (params.winner)
855
+ q.set('winner', params.winner);
856
+ if (params.candidate_passed != null)
857
+ q.set('candidate_passed', String(params.candidate_passed));
858
+ if (params.incumbent_passed != null)
859
+ q.set('incumbent_passed', String(params.incumbent_passed));
860
+ if (params.has_reference != null)
861
+ q.set('has_reference', String(params.has_reference));
862
+ if (params.status)
863
+ q.set('status', params.status);
864
+ if (params.sort)
865
+ q.set('sort', params.sort);
866
+ if (params.q)
867
+ q.set('q', params.q);
868
+ return q;
869
+ }
package/dist/types.d.ts CHANGED
@@ -2894,9 +2894,34 @@ export type TrainingRunState = 'built' | 'registering' | 'dataset_validating' |
2894
2894
  /** The closed set a run never leaves. */
2895
2895
  export declare const TERMINAL_RUN_STATES: readonly TrainingRunState[];
2896
2896
  export type TrainingVerdict = 'better' | 'not_better' | 'inconclusive' | 'not_evaluated';
2897
- export type TrainingDecision = 'auto_promoted' | 'promoted' | 'rejected' | 'auto_rejected' | 'rolled_back';
2897
+ /**
2898
+ * What was decided about a compared attempt, and who decided: `promoted` (a
2899
+ * member put it live), `auto_promoted`, `rejected` (a member chose not to
2900
+ * publish it), `auto_rejected` (the pipeline's rule turned it down on its
2901
+ * own), `expired` (nobody decided before the review deadline, so it was
2902
+ * retired; its verdict, `better` included, stands) or `rolled_back`.
2903
+ */
2904
+ export type TrainingDecision = 'auto_promoted' | 'promoted' | 'rejected' | 'auto_rejected' | 'expired' | 'rolled_back';
2898
2905
  export type EvaluationStatus = 'open' | 'done' | 'failed' | 'budget_stopped';
2899
2906
  export type EvaluationItemStatus = 'pending' | 'working' | 'done' | 'failed';
2907
+ /**
2908
+ * Why a failed conversation of a report failed (`error_code` on both items
2909
+ * routes), from a closed set; the row's `error` is the sentence for a person.
2910
+ * unreadable / unprepared: the conversation could not be read or prepared to
2911
+ * be asked. too_large_to_keep: too large to keep in storage. no_right_answer:
2912
+ * an exact-check benchmark's conversation with no right answer.
2913
+ * incumbent_unanswered / candidate_unanswered / scorer_failed: on its last
2914
+ * try the other side, or the new model, could not answer, or an answer could
2915
+ * not be scored. ended_outage / ended_deployment_stopped / ended_unscorable:
2916
+ * the comparison ended before it (an outage on the platform's side, a
2917
+ * stopped deployment, nothing able to score it). run_ended / replay_ended: its
2918
+ * attempt or replay ended first. answers_not_kept: replayed, its answers
2919
+ * held until storage could keep them, and storage could not before the
2920
+ * replay ended (a conversation never asked is replay_ended). not_finished:
2921
+ * its tries (or the comparison's money) ran out with nothing more particular
2922
+ * recorded.
2923
+ */
2924
+ 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';
2900
2925
  export type EvaluationWinner = 'candidate' | 'incumbent' | 'tie';
2901
2926
  /** Typed warning codes. Each surface renders its own plain sentence. */
2902
2927
  export type EvaluationWarningCode = 'holdout_too_small' | 'judge_unreliable' | 'graders_not_applied' | 'many_failures' | 'no_judge' | 'judge_labelled_training_rows' | 'capture_source_moved';
@@ -3237,10 +3262,15 @@ export type EvaluationReferenceKind = 'good' | 'correction' | 'gold';
3237
3262
  /**
3238
3263
  * What a person said the right answer is, frozen with the report and shown
3239
3264
  * to the judge beside both answers. Null on a conversation nobody gave one.
3265
+ *
3266
+ * A right answer is its text AND the tool calls it makes: an answer marked
3267
+ * good that only calls a tool has `answer` `""` and its calls.
3268
+ * `tool_calls` is null when it makes none.
3240
3269
  */
3241
3270
  export interface EvaluationReference {
3242
3271
  answer: string;
3243
3272
  kind: EvaluationReferenceKind;
3273
+ tool_calls: TrainingToolCall[] | null;
3244
3274
  }
3245
3275
  /** Which answer the judge preferred in one order of showing them, and why. */
3246
3276
  export interface EvaluationPairwiseOrder {
@@ -3291,6 +3321,8 @@ export interface EvaluationItem {
3291
3321
  winner: EvaluationWinner | null;
3292
3322
  status: EvaluationItemStatus;
3293
3323
  error: string | null;
3324
+ /** Why the row failed; null unless it failed, and on a row failed before causes were kept. */
3325
+ error_code: ItemErrorCode | null;
3294
3326
  }
3295
3327
  /**
3296
3328
  * Which pairs to read: the ones the attempt won (`candidate`), the ones the
@@ -3298,8 +3330,39 @@ export interface EvaluationItem {
3298
3330
  * or the ties.
3299
3331
  */
3300
3332
  export type EvaluationItemWinnerFilter = 'candidate' | 'serving' | 'tie';
3333
+ /** A row's status: scored, or failed (could not be scored). */
3334
+ export type ReportStatusFilter = 'scored' | 'failed';
3335
+ /**
3336
+ * The order of a report's rows: its own (`ordinal`, the default), or the new
3337
+ * model's score less the other's, largest first (`score_change`).
3338
+ */
3339
+ export type ReportSort = 'ordinal' | 'score_change';
3340
+ /**
3341
+ * Which rows of a report to read, and in what order. Every filter narrows the
3342
+ * page and `total` alike; a value the service does not take is refused 400
3343
+ * naming it. `candidate_passed` and `incumbent_passed` are one side each and
3344
+ * compose: `true` is that side's answer passed (score 0.70 or more), `false`
3345
+ * that it was scored below 0.70, and a side with no score matches neither --
3346
+ * `candidate_passed: false, incumbent_passed: true` is the regressions,
3347
+ * `candidate_passed: false` alone every row the new model did not pass.
3348
+ * `q` (2 to 200 characters) searches, case-insensitively, what a
3349
+ * reader of each row sees -- the conversation, the right answer, both answers
3350
+ * and their tool calls, every reason -- read from storage by the service; the
3351
+ * answer's `searched` says how many rows it searched. A search can be refused
3352
+ * 429 `RATE_LIMITED`, with `Retry-After`, while this workspace already has a
3353
+ * search running or while the service is running as many searches as it can
3354
+ * at once; try again after `Retry-After` seconds (the message says how many).
3355
+ */
3301
3356
  export interface EvaluationItemListParams {
3302
3357
  winner?: EvaluationItemWinnerFilter;
3358
+ candidate_passed?: boolean;
3359
+ incumbent_passed?: boolean;
3360
+ /** Whether the two side-by-side orders picked the same side. */
3361
+ orders?: 'agreed' | 'disagreed';
3362
+ has_reference?: boolean;
3363
+ status?: ReportStatusFilter;
3364
+ sort?: ReportSort;
3365
+ q?: string;
3303
3366
  /** 50 when absent; at most 200. */
3304
3367
  limit?: number;
3305
3368
  offset?: number;
@@ -3350,11 +3413,31 @@ export type BenchmarkRunStatus = 'open' | 'done' | 'failed' | 'budget_stopped' |
3350
3413
  * is a missing number, never a lower one.
3351
3414
  */
3352
3415
  export interface BenchmarkScoring {
3416
+ /** `judge_overall` (a scoring model) or `exact_match` (the exact check). */
3353
3417
  metric: string;
3354
3418
  scale: string;
3355
3419
  aggregate: string;
3356
3420
  require_all_rows: boolean;
3357
3421
  }
3422
+ /**
3423
+ * How a benchmark's answers are scored, chosen when it is made and frozen:
3424
+ *
3425
+ * - `judge` (the default): a scoring model reads both answers against the
3426
+ * right answer, as for the held-back set.
3427
+ * - `exact`: the answer or the tool call must match the right answer, and no
3428
+ * model is asked. When the right answer calls tools, the answer must make
3429
+ * the same calls (the same tools with JSON-equal arguments, in any order,
3430
+ * none left out and none extra; its text is not read); otherwise its text
3431
+ * must be the right answer's ignoring case and spacing, or both the same
3432
+ * number (a currency or percent sign on one side only is ignored; `$20` is
3433
+ * not `20%` or `€20`). 1 or 0, and each side's `judge` is
3434
+ * `{overall, dimensions: {match}, reason}`, the reason saying what matched
3435
+ * or what differed. Every conversation needs a right answer. A value hidden
3436
+ * when the conversation was captured (an email, a long number, an IP
3437
+ * address or a key, kept as `[redacted:...]`) cannot be checked: an answer
3438
+ * that matches everywhere else still scores 0, and the reason says so.
3439
+ */
3440
+ export type BenchmarkCheck = 'judge' | 'exact';
3358
3441
  /**
3359
3442
  * One rubric dimension of one replay, for both models.
3360
3443
  *
@@ -3367,6 +3450,19 @@ export interface BenchmarkDimensionScore {
3367
3450
  candidate: number;
3368
3451
  delta: number;
3369
3452
  }
3453
+ /**
3454
+ * What a pipeline's history, or a benchmark's pinned set, takes up in storage
3455
+ * right now. Conversations, answers and scoring, and the training rows of a
3456
+ * pipeline's curated sets, are kept in storage only, never in the database. Not billed; it counts toward the workspace's storage
3457
+ * quota and is deleted with the pipeline (a benchmark's with the workspace).
3458
+ * `where` is null while nothing is stored.
3459
+ */
3460
+ export type LoopStorageWhere = 'platform' | 'your_storage' | 'both';
3461
+ export interface LoopStorage {
3462
+ bytes: number;
3463
+ objects: number;
3464
+ where: LoopStorageWhere | null;
3465
+ }
3370
3466
  /**
3371
3467
  * The frozen definition: the oracle, the scoring rule and the fingerprint of
3372
3468
  * the set. The conversations themselves are their own paged route.
@@ -3376,6 +3472,11 @@ export interface Benchmark {
3376
3472
  workspace_id: string;
3377
3473
  name: string;
3378
3474
  status: BenchmarkStatus;
3475
+ /**
3476
+ * How its answers are scored (`scoring.metric` read out). On an `exact`
3477
+ * benchmark `judge_model` is `""` and the judge fields describe the check.
3478
+ */
3479
+ check: BenchmarkCheck;
3379
3480
  /** Provenance only: everything needed from the judge is copied below it. */
3380
3481
  judge_id: string | null;
3381
3482
  judge_name: string;
@@ -3391,6 +3492,8 @@ export interface Benchmark {
3391
3492
  created_at: string;
3392
3493
  retired_at: string | null;
3393
3494
  retired_by: string | null;
3495
+ /** What the pinned set takes up in storage. */
3496
+ storage: LoopStorage;
3394
3497
  }
3395
3498
  /**
3396
3499
  * One pinned conversation.
@@ -3407,6 +3510,8 @@ export interface BenchmarkItem {
3407
3510
  source_trace_url: string | null;
3408
3511
  prompt: TrainingMessage[];
3409
3512
  tools: unknown[] | null;
3513
+ /** The right answer pinned with it, calls and all; null when nobody gave one. */
3514
+ reference: EvaluationReference | null;
3410
3515
  }
3411
3516
  /**
3412
3517
  * One replay: this benchmark, on this training run, against both models.
@@ -3453,7 +3558,9 @@ export interface BenchmarkRun {
3453
3558
  candidate_pass_rate: number | null;
3454
3559
  /**
3455
3560
  * Conversations the attempt scored higher on (`wins`), lower on (`losses`),
3456
- * or within the tie band promotion uses of the serving version (`ties`).
3561
+ * or about the same on (`ties`) as the serving version, by the tie band
3562
+ * promotion uses: 0.02 or more above counts as higher; less than 0.02 apart
3563
+ * is about the same.
3457
3564
  * Null unless `status` is `done`.
3458
3565
  */
3459
3566
  wins: number | null;
@@ -3498,9 +3605,15 @@ export interface BenchmarkHistoryPoint {
3498
3605
  status: BenchmarkRunStatus;
3499
3606
  status_reason: string | null;
3500
3607
  }
3501
- /** One model's answer to one pinned conversation in a replay, and its score. */
3608
+ /**
3609
+ * One model's answer to one pinned conversation in a replay -- its text and
3610
+ * the tool calls it made (null when none, and on a replay scored before they
3611
+ * were kept) -- and its score. On an exact benchmark `judge` is the exact
3612
+ * check's verdict.
3613
+ */
3502
3614
  export interface BenchmarkRunItemSide {
3503
3615
  completion: string | null;
3616
+ tool_calls: TrainingToolCall[] | null;
3504
3617
  judge: EvaluationItemJudge | null;
3505
3618
  score: number | null;
3506
3619
  /** True when it passed (score 0.70 or more); null when it has no score. */
@@ -3510,8 +3623,9 @@ export interface BenchmarkRunItemSide {
3510
3623
  * One pinned conversation of one replay: the prompt, both answers, what the
3511
3624
  * judge made of each, and which side won it.
3512
3625
  *
3513
- * `winner` compares the two scores: the side scoring higher by more than the
3514
- * tie band promotion uses, `tie` inside it, and null until both are scored.
3626
+ * `winner` compares the two scores by the tie band promotion uses: the side
3627
+ * scoring 0.02 or more above the other, `tie` when they are less than 0.02
3628
+ * apart, and null until both are scored.
3515
3629
  * `source_trace_id` goes null once the conversation it was pinned from is
3516
3630
  * deleted; the pinned copy stays.
3517
3631
  */
@@ -3529,10 +3643,21 @@ export interface BenchmarkRunItem {
3529
3643
  winner: EvaluationWinner | null;
3530
3644
  status: EvaluationItemStatus;
3531
3645
  error: string | null;
3646
+ /** Why the row failed; null unless it failed, and on a row failed before causes were kept. */
3647
+ error_code: ItemErrorCode | null;
3532
3648
  }
3533
- /** Which conversations of a replay to read: the same three words a report's items take. */
3649
+ /**
3650
+ * Which conversations of a replay to read: the filters a report's items take,
3651
+ * but `orders` -- a replay has no side-by-side reading.
3652
+ */
3534
3653
  export interface BenchmarkRunItemListParams {
3535
3654
  winner?: EvaluationItemWinnerFilter;
3655
+ candidate_passed?: boolean;
3656
+ incumbent_passed?: boolean;
3657
+ has_reference?: boolean;
3658
+ status?: ReportStatusFilter;
3659
+ sort?: ReportSort;
3660
+ q?: string;
3536
3661
  /** 50 when absent; at most 200. */
3537
3662
  limit?: number;
3538
3663
  offset?: number;
@@ -3550,20 +3675,30 @@ export interface BenchmarkSource {
3550
3675
  /**
3551
3676
  * The pin: 20 to 200 conversations, and a judge with a rubric to measure them.
3552
3677
  *
3553
- * A conversation with nothing to ask a model is refused rather than skipped.
3678
+ * A conversation with nothing to ask a model, or too large to keep in
3679
+ * storage, is refused (422 `BENCHMARK_ROW_UNUSABLE`) rather than skipped.
3554
3680
  * Pinning 47 of the 50 somebody chose is the set being wrong from the first
3555
3681
  * day, and they would never find out.
3556
3682
  */
3557
3683
  /**
3558
- * A name and the conversations, nothing else. The platform freezes the judge
3559
- * and the model it scores on, gives both models the comparison's own answer
3560
- * length, and sets what one replay may spend; none of that is sent (the
3561
- * service refuses `judge_id`, `judge_model`, `max_tokens` and
3562
- * `per_run_ceiling_cents` by name).
3684
+ * A name, the conversations and how they are scored, nothing else. The
3685
+ * platform freezes the judge and the model it scores on, gives both models
3686
+ * the comparison's own answer length, and sets what one replay may spend;
3687
+ * none of that is sent (the service refuses `judge_id`, `judge_model`,
3688
+ * `max_tokens` and `per_run_ceiling_cents` by name).
3689
+ *
3690
+ * `check` is `judge` when absent. An `exact` benchmark needs a right answer
3691
+ * on every conversation: one without is refused 422
3692
+ * `BENCHMARK_ROW_HAS_NO_ANSWER`, naming it, and nothing is saved. One with
3693
+ * nothing to ask a model, or too large to keep in storage, is refused 422
3694
+ * `BENCHMARK_ROW_UNUSABLE`, naming it; and when the conversations cannot be
3695
+ * stored just then the create is refused 409 `CONFLICT` with nothing saved
3696
+ * (try again in a minute).
3563
3697
  */
3564
3698
  export interface BenchmarkCreateParams {
3565
3699
  name: string;
3566
3700
  source: BenchmarkSource;
3701
+ check?: BenchmarkCheck;
3567
3702
  }
3568
3703
  export interface BenchmarkListParams {
3569
3704
  status?: BenchmarkStatus;
@@ -3644,7 +3779,9 @@ export type TrainingRuleRunRefusalCode = 'NOT_ENOUGH_SAMPLES' | 'PIPELINE_NEEDS_
3644
3779
  *
3645
3780
  * An edit only:
3646
3781
  * - `REVISION_MISMATCH` (409): `expected_revision` is not the pipeline's
3647
- * revision any more. Read it again and resend.
3782
+ * revision any more, or the pipeline changed while the edit was being saved
3783
+ * (a version went live, which can change its models). Nothing was saved.
3784
+ * Read it again and resend.
3648
3785
  * - `RUN_ACTIVE` (409): the model cannot change while an attempt is running.
3649
3786
  * - `NOT_A_SIMPLE_PIPELINE` (409): a tag, use case or challenger edit on a
3650
3787
  * pipeline created before pipelines had them; its other settings can
@@ -3652,7 +3789,10 @@ export type TrainingRuleRunRefusalCode = 'NOT_ENOUGH_SAMPLES' | 'PIPELINE_NEEDS_
3652
3789
  *
3653
3790
  * The model and how it is promoted:
3654
3791
  * - `MODEL_NOT_TRAINABLE` (422): `model.id` or `challenger_model.id` is not a
3655
- * model `listModels` offers, or the challenger is the model itself.
3792
+ * model `listModels` offers, or the challenger is the model itself. On an
3793
+ * edit only a changed id is checked against the list: an id equal to the
3794
+ * pipeline's current one (ignoring case) is kept, and whether it can still
3795
+ * be trained is checked when an attempt starts.
3656
3796
  * - `NO_GPU_FITS` (422): no machines can train or serve the model right now.
3657
3797
  * - `MODEL_REVISION_UNAVAILABLE` (422): the model could not be pinned to an
3658
3798
  * exact revision because the training service did not answer. Try again
@@ -3877,6 +4017,14 @@ export interface PipelineAttempt {
3877
4017
  base_model_id: string | null;
3878
4018
  model_family: string | null;
3879
4019
  outcome: PipelineAttemptOutcome;
4020
+ /**
4021
+ * What was decided about it once it was compared; null while nothing has
4022
+ * been. A member's rejection is `rejected` where the outcome says `stopped`.
4023
+ */
4024
+ decision: TrainingDecision | null;
4025
+ /** The samples its set trained on and held back; null until its set was built. */
4026
+ train_rows: number | null;
4027
+ holdout_rows: number | null;
3880
4028
  /** The version it became, when it became one. */
3881
4029
  version: number | null;
3882
4030
  created_at: string;
@@ -3928,9 +4076,27 @@ export interface PipelineSchedule {
3928
4076
  export interface PipelineTrainWhen {
3929
4077
  schedule: PipelineSchedule | null;
3930
4078
  }
3931
- /** What is held back beyond max(50, 5% of the data): a larger percent, or a count. */
4079
+ /**
4080
+ * What is held back to judge each attempt by, and never trained on:
4081
+ * max(`min_rows`, `percent`% of the pipeline's samples). The set is sticky:
4082
+ * lowering the percent releases no sample already held back, and raising it
4083
+ * holds back only samples no attempt trained on.
4084
+ */
3932
4085
  export interface PipelineHoldout {
4086
+ /** The pipeline's share, 5 to 20 (5 unless a member chose more); set with `holdout.percent`. */
4087
+ percent: number;
4088
+ /** The floor, 100, held back whatever the share says. */
3933
4089
  min_rows: number;
4090
+ /** How many samples it holds back today (= `holdout_size`). Detail only; null on the list. */
4091
+ rows: number | null;
4092
+ /**
4093
+ * How many of `rows` are held back because an earlier run of the pipeline
4094
+ * held them back: they stay held back whatever became of that run and
4095
+ * whatever the share says; the rest are the share's. Before the first
4096
+ * version it is what raises `minimums.needed` above the share's own (these
4097
+ * rows plus the 1,000 to train on). Detail only; null on the list.
4098
+ */
4099
+ held_before: number | null;
3934
4100
  }
3935
4101
  /**
3936
4102
  * How far the data is from the next attempt, by the platform's fixed
@@ -3941,7 +4107,13 @@ export interface PipelineHoldout {
3941
4107
  * usable samples the last trained attempt did not have, which is
3942
4108
  * `floors.new_samples` or `floors.new_samples_percent` of the rows that
3943
4109
  * attempt trained on, whichever is more. `have`, `short` and `message` are
3944
- * measured on the detail only.
4110
+ * measured on the detail only. There, after an attempt has trained, `short`
4111
+ * is how many more new samples have to arrive: new samples fill the held-back
4112
+ * set first, so after the held-back share is raised it can be more than
4113
+ * `needed` - `have`; and `have` is the new samples the next attempt would
4114
+ * train on, or the samples since that attempt when that count is what it
4115
+ * waits for. Train now's 422 NOT_ENOUGH_SAMPLES carries the same `have` and
4116
+ * `need`.
3945
4117
  */
3946
4118
  export interface PipelineMinimums {
3947
4119
  basis: 'first_version' | 'new_rows';
@@ -3984,8 +4156,9 @@ export interface Pipeline {
3984
4156
  tags: string[];
3985
4157
  /**
3986
4158
  * A second base model trained on the same data after each attempt; it
3987
- * becomes the next version only if it beats the live one. `revision` is the
3988
- * commit the server pinned.
4159
+ * becomes the next version only if it beats the live one, and then it
4160
+ * becomes the pipeline's model (`base_model_id`) while the model it replaced
4161
+ * becomes this one. `revision` is the commit the server pinned.
3989
4162
  */
3990
4163
  challenger_model: PipelineModelRef | null;
3991
4164
  train_when: PipelineTrainWhen;
@@ -4007,6 +4180,8 @@ export interface Pipeline {
4007
4180
  * serves is not a deployment, or before the first check of that deployment.
4008
4181
  */
4009
4182
  live_deployment: PipelineLiveDeployment | null;
4183
+ /** What the pipeline's history takes up in storage. */
4184
+ storage: LoopStorage;
4010
4185
  /** The name the app calls. It does not change when a version is promoted. */
4011
4186
  serving_name: string;
4012
4187
  /**
@@ -4101,6 +4276,80 @@ export interface TrainingRunResponse {
4101
4276
  benchmark_runs: TrainingRunBenchmarkRun[];
4102
4277
  links: TrainingRunLinks;
4103
4278
  available_actions: TrainingRunActions;
4279
+ /** What became of the attempt and why, measurement by measurement. */
4280
+ promotion: TrainingRunPromotion;
4281
+ /**
4282
+ * Every bar the held-back verdict applied, with what it needed, what it got
4283
+ * and whether it was met: the rule itself, which the verdict is read off.
4284
+ * Null until the comparison is finished, when no thresholds were recorded,
4285
+ * and for a report decided under an earlier rule that this list would read
4286
+ * differently from its verdict (`verdict_checks_withheld` says so).
4287
+ */
4288
+ verdict_checks: VerdictCheck[] | null;
4289
+ /**
4290
+ * Why a finished report's `verdict_checks` is null although its thresholds
4291
+ * were recorded: `decided_under_earlier_rule` when an earlier version of
4292
+ * the rule decided it, so today's bars would not explain its verdict. Null
4293
+ * for every other null (not finished, no thresholds recorded) and when the
4294
+ * list is shown. Never rebuild the bars from today's rule for such a report.
4295
+ */
4296
+ verdict_checks_withheld: VerdictChecksWithheld | null;
4297
+ /** What the attempt has cost, part by part, from the charges recorded on it. */
4298
+ cost: TrainingRunCost;
4299
+ }
4300
+ /** Why a run detail's `verdict_checks` is withheld. */
4301
+ export type VerdictChecksWithheld = 'decided_under_earlier_rule';
4302
+ /**
4303
+ * What became of an attempt and why. `decision` is what was done, and who
4304
+ * did it: `rejected` is a member choosing not to publish it, beside a
4305
+ * `verdict` that may say `better`; `auto_rejected` is the pipeline's rule
4306
+ * turning it down; `expired` is nobody deciding before the review deadline,
4307
+ * with `outcome` `stopped` when it was better. `policy` to `measurements` are the promotion rule's record, null
4308
+ * (and `[]`) when it recorded none: an attempt still being compared, one that
4309
+ * ended before it was, or one decided before the record was kept.
4310
+ */
4311
+ export interface TrainingRunPromotion {
4312
+ /** As the pipeline's attempts list says it (`PipelineAttempt.outcome`). */
4313
+ outcome: PipelineAttemptOutcome;
4314
+ decision: TrainingDecision | null;
4315
+ policy: string | null;
4316
+ k: number | null;
4317
+ verdict: string | null;
4318
+ reason: string | null;
4319
+ weighted_delta: number | null;
4320
+ /** The held-back comparison first, then each benchmark, each with its outcome and reason. */
4321
+ measurements: PromotionMeasurement[];
4322
+ }
4323
+ /** The bars a held-back verdict applies. */
4324
+ export type VerdictCheckKey = 'rows_scored' | 'failures' | 'rubric' | 'mean_change' | 'win_rate' | 'beyond_chance';
4325
+ /**
4326
+ * One bar of the held-back verdict. `needed` and `got` are on the bar's own
4327
+ * scale -- conversations for `rows_scored` (at least) and `failures` (at
4328
+ * most), the score change for `mean_change` (at least), a share for
4329
+ * `win_rate` (at least), a probability for `beyond_chance` (at most) -- and
4330
+ * null where the bar has no number (`rubric`) or nothing produced one.
4331
+ */
4332
+ export interface VerdictCheck {
4333
+ key: VerdictCheckKey;
4334
+ /** The bar in plain words, its direction included. */
4335
+ label: string;
4336
+ needed: number | null;
4337
+ got: number | null;
4338
+ met: boolean;
4339
+ }
4340
+ /**
4341
+ * An attempt's cost in cents, part by part. `total_cents` is the attempt's
4342
+ * `cost_cents` on the pipeline. `up_to` says `comparison_cents` (and so the
4343
+ * total) is the most the comparison machines can have cost rather than what
4344
+ * they did; the other three parts are always charges.
4345
+ */
4346
+ export interface TrainingRunCost {
4347
+ training_cents: number;
4348
+ comparison_cents: number;
4349
+ scoring_cents: number;
4350
+ benchmark_cents: number;
4351
+ total_cents: number;
4352
+ up_to: boolean;
4104
4353
  }
4105
4354
  export interface TrainingRunActionResponse {
4106
4355
  run: TrainingRun;
@@ -4110,12 +4359,16 @@ export interface TrainingRunActionResponse {
4110
4359
  export interface EvaluationItemsResponse {
4111
4360
  items: EvaluationItem[];
4112
4361
  total: number;
4362
+ /** How many rows a `q` search read and searched; null without `q`. */
4363
+ searched: number | null;
4113
4364
  }
4114
4365
  /** A page of one replay's conversations, in the benchmark's order. */
4115
4366
  export interface BenchmarkRunItemsResponse {
4116
4367
  items: BenchmarkRunItem[];
4117
4368
  /** Every conversation the filter matches, not only this page. */
4118
4369
  total: number;
4370
+ /** How many rows a `q` search read and searched; null without `q`. */
4371
+ searched: number | null;
4119
4372
  }
4120
4373
  export interface InferenceAliasListResponse {
4121
4374
  aliases: InferenceAlias[];
@@ -4193,6 +4446,21 @@ export interface PipelineWriteRequest {
4193
4446
  policy: PipelinePromotion['policy'];
4194
4447
  k?: number;
4195
4448
  };
4449
+ /**
4450
+ * The share of the pipeline's samples held back to judge each attempt and
4451
+ * never trained on: a whole number from 5 to 20 (5 when absent on a
4452
+ * create; unchanged when absent on an edit). At least 100 are held back
4453
+ * whatever it says. Anything else is 400 naming `holdout.percent`, and
4454
+ * null is 400. It does not change what the pipeline may spend and nothing
4455
+ * is asked again: a new share is a new revision, saved at once. But a
4456
+ * larger share means more held-back samples are scored on each attempt (at
4457
+ * most `floors.held_back.scored_rows`), and scoring is paid from the
4458
+ * wallet. Lowering it keeps every sample already held back; raising it
4459
+ * holds back only new samples, which then do not count as new work.
4460
+ */
4461
+ holdout?: {
4462
+ percent: number;
4463
+ };
4196
4464
  /** 1 to 100, or null for no limit (the default). Counts versions, not attempts. */
4197
4465
  max_versions?: number | null;
4198
4466
  enabled?: boolean;
@@ -4221,7 +4489,11 @@ export interface LoopModel {
4221
4489
  * sets them.
4222
4490
  */
4223
4491
  export interface PipelineFloors {
4224
- /** Samples a new pipeline's first attempt needs: the rows it trains on plus the held-back set. */
4492
+ /**
4493
+ * Samples a new pipeline's first attempt needs at the default held-back
4494
+ * share: the rows it trains on plus the held-back set (a pipeline holding
4495
+ * back more needs more; its own `minimums` says how many).
4496
+ */
4225
4497
  first_version_samples: number;
4226
4498
  /** The fewest new samples any later attempt waits for. */
4227
4499
  new_samples: number;
@@ -4230,6 +4502,21 @@ export interface PipelineFloors {
4230
4502
  * that a later attempt must add when that is more than `new_samples`.
4231
4503
  */
4232
4504
  new_samples_percent: number;
4505
+ /** The held-back rule a pipeline chooses its share within. */
4506
+ held_back: HeldBackFloors;
4507
+ }
4508
+ /**
4509
+ * The held-back rule: a pipeline holds back max(`min_rows`, its percent of its
4510
+ * samples), and chooses the percent from `default_percent` to `max_percent`
4511
+ * (the body's `holdout.percent`). Each attempt is judged on at most
4512
+ * `scored_rows` of them (the same ones every time); a share that holds back
4513
+ * more than that only keeps samples out of training.
4514
+ */
4515
+ export interface HeldBackFloors {
4516
+ min_rows: number;
4517
+ default_percent: number;
4518
+ max_percent: number;
4519
+ scored_rows: number;
4233
4520
  }
4234
4521
  export interface LoopModelsResponse {
4235
4522
  models: LoopModel[];
@@ -4250,6 +4537,10 @@ export interface RuleBenchmark {
4250
4537
  benchmark_status: string;
4251
4538
  item_count: number;
4252
4539
  items_digest: string;
4540
+ /** How it scores an answer: a scoring model reading its rubric (`judge`) or an exact check against its right answer (`exact`). */
4541
+ check: BenchmarkCheck;
4542
+ /** What its pinned set takes up in storage now: the figure the benchmark itself carries, this workspace's alone. */
4543
+ storage: LoopStorage;
4253
4544
  /** False for a benchmark this pipeline stopped using; its history stays. */
4254
4545
  attached: boolean;
4255
4546
  /** 1 is the primary; null once removed. */
@@ -4284,6 +4575,8 @@ export interface CompareBenchmark {
4284
4575
  name: string;
4285
4576
  benchmark_status: string;
4286
4577
  items_digest: string;
4578
+ /** How it scores an answer: `judge` or `exact`. */
4579
+ check: BenchmarkCheck;
4287
4580
  attached: boolean;
4288
4581
  priority: number | null;
4289
4582
  added_at: string | null;
@@ -4382,6 +4675,165 @@ export interface VersionCompareParams {
4382
4675
  a?: number;
4383
4676
  b?: number;
4384
4677
  }
4678
+ /**
4679
+ * b's score against a's on one held-back conversation, by the tie band:
4680
+ * 0.02 or more above counts as higher; less than 0.02 apart is about the same.
4681
+ */
4682
+ export type AttemptDirection = 'higher' | 'lower' | 'same';
4683
+ /**
4684
+ * One attempt's held-back comparison against what it was compared with on its
4685
+ * day, over ITS OWN held-back set (the set grows between attempts: the
4686
+ * like-for-like figures are `shared_sample.a` and `.b`). Every number is null
4687
+ * until the comparison is finished; two attempts' win rates are never
4688
+ * subtracted, since their opponents differ.
4689
+ */
4690
+ export interface AttemptHoldout {
4691
+ evaluation_id: string | null;
4692
+ status: EvaluationStatus | null;
4693
+ /** The scoring model its comparison froze when it opened; null for an attempt never compared. */
4694
+ judge_model: string | null;
4695
+ rows_scored: number | null;
4696
+ wins: number | null;
4697
+ losses: number | null;
4698
+ ties: number | null;
4699
+ win_rate: number | null;
4700
+ mean_delta: number | null;
4701
+ incumbent_mean: number | null;
4702
+ candidate_mean: number | null;
4703
+ /** The share each side passed (score 0.70 or more). */
4704
+ incumbent_pass_rate: number | null;
4705
+ candidate_pass_rate: number | null;
4706
+ }
4707
+ /** One side of an attempt comparison. */
4708
+ export interface AttemptCompareSide {
4709
+ run_id: string;
4710
+ attempt: number | null;
4711
+ version: number | null;
4712
+ trigger: PipelineAttemptTrigger;
4713
+ base_model_id: string | null;
4714
+ model_family: string | null;
4715
+ outcome: PipelineAttemptOutcome;
4716
+ verdict: TrainingVerdict | null;
4717
+ decision: TrainingDecision | null;
4718
+ train_rows: number | null;
4719
+ holdout_rows: number | null;
4720
+ finished_at: string | null;
4721
+ holdout: AttemptHoldout;
4722
+ }
4723
+ /**
4724
+ * The held-back conversations both attempts were scored on (`rows`), matched
4725
+ * by the conversation they came from.
4726
+ *
4727
+ * `comparable` says both were scored the same way: the same scoring model and
4728
+ * the same rubric, both recorded. When not, `why` says so, naming both scoring
4729
+ * models, and `higher`, `lower`, `same`, `a` and `b` are null: the two scores
4730
+ * are not on one scale. `answer_changed` counts the conversations whose right
4731
+ * answer a member changed between the two attempts; they have no direction
4732
+ * and are left out of `a` and `b`. `answer_unknown` counts the ones whose
4733
+ * right answer one of the two comparisons did not record which it was (it was
4734
+ * compared before that was kept), so whether both were scored against the same
4735
+ * answer is not known: no direction either, left out of `a` and `b`, and
4736
+ * never counted as changed. When comparable, rows = higher + lower + same +
4737
+ * answer_changed + answer_unknown.
4738
+ */
4739
+ export interface AttemptSharedSample {
4740
+ rows: number;
4741
+ comparable: boolean;
4742
+ why: string | null;
4743
+ answer_changed: number;
4744
+ answer_unknown: number;
4745
+ higher: number | null;
4746
+ lower: number | null;
4747
+ same: number | null;
4748
+ /**
4749
+ * Each attempt over the same conversations (`rows` less `answer_changed`
4750
+ * and `answer_unknown`):
4751
+ * the like-for-like figures, which may be subtracted. Null when there are
4752
+ * none, when the two were not scored the same way, and while either
4753
+ * comparison is still being scored.
4754
+ */
4755
+ a: AttemptSharedFigures | null;
4756
+ b: AttemptSharedFigures | null;
4757
+ }
4758
+ /** One attempt over the shared conversations: its mean score and how many passed (score 0.70 or more) of `rows`. */
4759
+ export interface AttemptSharedFigures {
4760
+ rows: number;
4761
+ mean: number;
4762
+ passed: number;
4763
+ pass_rate: number;
4764
+ }
4765
+ /** One attempt's replay of a benchmark. `score` and `pass_rate` are null unless it published a score. */
4766
+ export interface AttemptBenchmarkSide {
4767
+ benchmark_run_id: string;
4768
+ status: BenchmarkRunStatus;
4769
+ rows_scored: number;
4770
+ rows_total: number;
4771
+ score: number | null;
4772
+ pass_rate: number | null;
4773
+ }
4774
+ /**
4775
+ * A benchmark both attempts replayed. `delta` is b minus a, null unless
4776
+ * `comparable` (both scored on the same revision of it, every conversation);
4777
+ * `why` says why not.
4778
+ */
4779
+ export interface AttemptCompareBenchmark {
4780
+ benchmark_id: string;
4781
+ name: string;
4782
+ /** How it scores an answer: a rubric (`judge`) or an exact check (`exact`). */
4783
+ check: 'judge' | 'exact';
4784
+ a: AttemptBenchmarkSide;
4785
+ b: AttemptBenchmarkSide;
4786
+ delta: number | null;
4787
+ comparable: boolean;
4788
+ why: string | null;
4789
+ }
4790
+ /**
4791
+ * One attempt's own answer on a shared conversation, as its comparison scored
4792
+ * it. The answer itself is the `evaluation_item_id` row of
4793
+ * `listEvaluationItems(holdout.evaluation_id)`.
4794
+ */
4795
+ export interface AttemptCompareItemSide {
4796
+ evaluation_item_id: number;
4797
+ score: number;
4798
+ passed: boolean;
4799
+ }
4800
+ /**
4801
+ * One held-back conversation both attempts were scored on. `direction` is null
4802
+ * when the two scores are not on one scale, and `why` then says why (the two
4803
+ * attempts were scored differently, this conversation's right answer
4804
+ * changed between them, or which right answer one of them was scored against
4805
+ * was not recorded); both scores are listed either way.
4806
+ */
4807
+ export interface AttemptCompareItem {
4808
+ trace_id: string;
4809
+ a: AttemptCompareItemSide;
4810
+ b: AttemptCompareItemSide;
4811
+ direction: AttemptDirection | null;
4812
+ why: string | null;
4813
+ }
4814
+ /** `GET /api/loop/pipelines/{id}/attempts/compare`: numbers and ids only. */
4815
+ export interface AttemptCompareResponse {
4816
+ rule_id: string;
4817
+ a: AttemptCompareSide;
4818
+ b: AttemptCompareSide;
4819
+ /** Closer than this on one conversation is `same`. */
4820
+ tie_band: number;
4821
+ shared_sample: AttemptSharedSample;
4822
+ benchmarks: AttemptCompareBenchmark[];
4823
+ /** One page of the shared sample, in a's order, narrowed by `filter`. */
4824
+ items: AttemptCompareItem[];
4825
+ /** Every conversation the filter matches, not only this page. */
4826
+ total: number;
4827
+ }
4828
+ /** Which two attempts to set side by side, by RUN id, and which page of their shared conversations. */
4829
+ export interface AttemptCompareParams {
4830
+ a: string;
4831
+ b: string;
4832
+ filter?: AttemptDirection;
4833
+ /** 1 to 200; 50 when absent. */
4834
+ limit?: number;
4835
+ offset?: number;
4836
+ }
4385
4837
  /**
4386
4838
  * `POST /api/loop/pipelines/{id}/import`: the import body, `source` optional.
4387
4839
  * `default_feedback: 'good'` records every answered row without a verdict of
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runbios-sdk",
3
- "version": "0.2.20-dev.290",
3
+ "version": "0.2.20-dev.293",
4
4
  "description": "Official TypeScript SDK for the Run BiOS training and deployment platform API",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",