runbios-sdk 0.3.0-dev.322 → 0.3.0-dev.324

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/README.md CHANGED
@@ -225,8 +225,15 @@ more header, `X-Loop-Pipeline: <tag>` (several tags: `pipeline: ['a', 'b']`).
225
225
  The gateway records the exchange -- what was asked, what the model answered and
226
226
  its tool calls -- as a sample of the pipelines those tags feed (a pipeline's
227
227
  `own_tag`), even where recording is off for that model: the header is your
228
- consent for that one exchange. It works for serverless models and dedicated
229
- deployments, including the pipeline's own `loop-<tag>` model.
228
+ consent for that one exchange. With `chatCompletions` and `streamChatCompletions`
229
+ it works for serverless models and dedicated deployments, including the
230
+ pipeline's own `loop-<tag>` model. `messages` and `streamMessages` (the
231
+ Anthropic shape) work for serverless models; a dedicated deployment, and so a
232
+ pipeline's `loop-<tag>` model, serves the OpenAI shape and refuses
233
+ `/v1/messages` with 400, so call it with `chatCompletions`. Only the tags of a
234
+ pipeline that exists are recorded: a call naming a misspelt tag, or a deleted
235
+ pipeline's, is not recorded under it, and `client.loop.stats()` lists such
236
+ calls under `capture`.
230
237
 
231
238
  The gateway answers with the sample's id in `X-Loop-Sample-Id`. A non-streaming
232
239
  result carries it as `loop_sample_id` (non-enumerable: it is never part of the
@@ -260,10 +267,29 @@ Feedback sent before the sample is recorded is refused `409
260
267
  SAMPLE_NOT_YET_RECORDED`, and nothing is stored. `upvote`, `downvote`,
261
268
  `correct`, `gold` and `signal` send it again after the `Retry-After` seconds (2
262
269
  when none is given), at most 6 times in all, then throw that error. A stream
263
- that was cut short is never recorded, so its id stays unknown. If you send
270
+ that was cut short is never recorded, so its id stays unknown (it is counted in
271
+ `client.loop.stats()` under `capture`). If you send
264
272
  `X-Request-ID`, keep it unique per call: a repeated one is recorded once.
265
273
  `completions`, `embeddings` and `rerank` are not recorded and refuse the option.
266
274
 
275
+ Many feedback items at once: `signalMany` sends each as `signal` does, the same
276
+ retry included, with up to 8 in flight (`{ concurrency }`, at most 32), and
277
+ returns every item in order with its `signal` or its `error`:
278
+
279
+ ```typescript
280
+ const results = await client.loop.signalMany([
281
+ { trace_id: idA, verdict: 'good' },
282
+ { trace_id: idB, verdict: 'corrected', correction: 'Refunds take five working days.' },
283
+ ]);
284
+ const failed = results.filter((r) => r.error);
285
+ ```
286
+
287
+ Sending a sample yourself with `client.loop.capture` and already know the
288
+ verdict? Pass `feedback: { verdict: 'good' | 'bad' | 'corrected', correction }`
289
+ and it is written with the sample, in one transaction: both are stored or
290
+ neither is. `good`, `bad` and `corrected` work in `signal` and `signalMany` too,
291
+ stored as `accepted`, `rejected` and `edited`.
292
+
267
293
  #### Workspace serverless usage and limits (read-only)
268
294
 
269
295
  A workspace-bound platform key or hosted OAuth grant with `analytics:read` can
package/dist/client.d.ts CHANGED
@@ -130,17 +130,25 @@ export type CapacityUnavailableError = GpuRejectionError;
130
130
  * (HTTP 403): TRAINING_COMING_SOON from POST /api/training/jobs,
131
131
  * DATASETS_COMING_SOON from the dataset creation endpoints (upload,
132
132
  * uploads/initiate, register-hf, integration import), and LOOP_COMING_SOON
133
- * from EVERY Conscious Loop route (`client.loop.*`) where the loop is not
134
- * offered — it is offered on the development environment only.
133
+ * from the Conscious Loop routes (`client.loop.*`) where the platform has the
134
+ * loop switched off — every one of them but the five that let a member stop
135
+ * paying (see {@link ComingSoonError}).
135
136
  */
136
137
  export declare const COMING_SOON_CODES: readonly ["TRAINING_COMING_SOON", "DATASETS_COMING_SOON", "LOOP_COMING_SOON"];
137
138
  /**
138
139
  * Raised when a pre-launch surface rejects a call: fine-tuning and datasets
139
140
  * launch soon, so training.create and dataset upload/import/register answer 403
140
141
  * with one of {@link COMING_SOON_CODES}, and their read and lifecycle methods
141
- * (list, get, status, stop, resume, delete, preview) are unaffected. The
142
- * Conscious Loop is offered on the development environment only; everywhere
143
- * else EVERY `client.loop.*` method, reads included, answers LOOP_COMING_SOON.
142
+ * (list, get, status, stop, resume, delete, preview) are unaffected. Where
143
+ * the platform has the Conscious Loop switched off, every `client.loop.*`
144
+ * method answers LOOP_COMING_SOON, reads included, except the five a member
145
+ * needs to stop paying, which answer as usual: listing pipelines
146
+ * (GET /api/loop/pipelines), reading one (GET /api/loop/pipelines/{id}),
147
+ * switching one off (PUT /api/loop/pipelines/{id} whose body is only
148
+ * `{"enabled": false}`, with at most `expected_revision` and `workspace_id`),
149
+ * deleting one, which stops its live version and removes its data
150
+ * (DELETE /api/loop/pipelines/{id}), and cancelling an attempt
151
+ * (POST /api/loop/training-runs/{id}/cancel).
144
152
  *
145
153
  * The service is the authority: the SDK never blocks client-side, so when the
146
154
  * gate lifts at launch every SDK version works again without an upgrade. This
package/dist/client.js CHANGED
@@ -198,17 +198,25 @@ export const CapacityUnavailableError = GpuRejectionError;
198
198
  * (HTTP 403): TRAINING_COMING_SOON from POST /api/training/jobs,
199
199
  * DATASETS_COMING_SOON from the dataset creation endpoints (upload,
200
200
  * uploads/initiate, register-hf, integration import), and LOOP_COMING_SOON
201
- * from EVERY Conscious Loop route (`client.loop.*`) where the loop is not
202
- * offered — it is offered on the development environment only.
201
+ * from the Conscious Loop routes (`client.loop.*`) where the platform has the
202
+ * loop switched off — every one of them but the five that let a member stop
203
+ * paying (see {@link ComingSoonError}).
203
204
  */
204
205
  export const COMING_SOON_CODES = ['TRAINING_COMING_SOON', 'DATASETS_COMING_SOON', 'LOOP_COMING_SOON'];
205
206
  /**
206
207
  * Raised when a pre-launch surface rejects a call: fine-tuning and datasets
207
208
  * launch soon, so training.create and dataset upload/import/register answer 403
208
209
  * with one of {@link COMING_SOON_CODES}, and their read and lifecycle methods
209
- * (list, get, status, stop, resume, delete, preview) are unaffected. The
210
- * Conscious Loop is offered on the development environment only; everywhere
211
- * else EVERY `client.loop.*` method, reads included, answers LOOP_COMING_SOON.
210
+ * (list, get, status, stop, resume, delete, preview) are unaffected. Where
211
+ * the platform has the Conscious Loop switched off, every `client.loop.*`
212
+ * method answers LOOP_COMING_SOON, reads included, except the five a member
213
+ * needs to stop paying, which answer as usual: listing pipelines
214
+ * (GET /api/loop/pipelines), reading one (GET /api/loop/pipelines/{id}),
215
+ * switching one off (PUT /api/loop/pipelines/{id} whose body is only
216
+ * `{"enabled": false}`, with at most `expected_revision` and `workspace_id`),
217
+ * deleting one, which stops its live version and removes its data
218
+ * (DELETE /api/loop/pipelines/{id}), and cancelling an attempt
219
+ * (POST /api/loop/training-runs/{id}/cancel).
212
220
  *
213
221
  * The service is the authority: the SDK never blocks client-side, so when the
214
222
  * gate lifts at launch every SDK version works again without an upgrade. This
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.3.0-dev.322";
39
+ export declare const VERSION = "0.3.0-dev.324";
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 AnthropicMessageResponse, type LoopCaptureOption, type LoopSampleIdOnResult, LOOP_PIPELINE_HEADER, LOOP_SAMPLE_ID_HEADER, 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, TrainingStartFromParams, TrainingStartFrom, TrainingExportStep, TrainingListParams, TrainingListResponse, TrainingJob, TrainingMetrics, TrainingResourceMetrics, TrainingDeviceMetrics, MetricPoint, MetricGraphConfig, TrainingCheckpoint, TrainingLogs, TrainingLogEntry, TrainingStopResponse, TrainingResumeResponse, CanonicalTrainingRequest, TrainingPreflightDataset, TrainingPreflightWarning, TrainingPreflightResponse, TrainingCapabilityChoice, TrainingConfigFieldCapability, TrainingCapabilities, TrainingFeature, 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, AttemptExplanation, PipelineAttemptListParams, PipelineAttemptListResponse, PipelineAttemptModelFilter, PipelineAttemptResultFilter, PipelineAttemptTrigger, Lineage, PipelineChain, PipelineChainRebuild, TrainingRunRollbackRefusalCode, LoopTraceRebuild, LoopTraceDeleteResponse, PipelineAttemptOutcome, PipelineLiveDeploymentStatus, PipelineLiveDeployment, LoopStorageWhere, LoopStorage, Pipeline, PipelineListParams, PipelineListStatus, PipelineListResponse, PipelineTrainingSettings, PipelineTrainingDefaults, PipelineTrainingRequest, PipelineResponse, PipelineTrainWhen, PipelineSchedule, PipelineWriteRequest, PipelineMutationResponse, PipelineImportParams, PipelineFloors, HeldBackFloors, LoopModel, LoopModelsResponse, LoopUnavailableModel, LoopUnavailableReasonCode, 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';
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, TrainingStartFromParams, TrainingStartFrom, TrainingExportStep, TrainingListParams, TrainingListResponse, TrainingJob, TrainingMetrics, TrainingResourceMetrics, TrainingDeviceMetrics, MetricPoint, MetricGraphConfig, TrainingCheckpoint, TrainingLogs, TrainingLogEntry, TrainingStopResponse, TrainingResumeResponse, CanonicalTrainingRequest, TrainingPreflightDataset, TrainingPreflightWarning, TrainingPreflightResponse, TrainingCapabilityChoice, TrainingConfigFieldCapability, TrainingCapabilities, TrainingFeature, 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, AttemptExplanation, PipelineAttemptListParams, PipelineAttemptListResponse, PipelineAttemptModelFilter, PipelineAttemptResultFilter, PipelineAttemptTrigger, Lineage, PipelineChain, PipelineChainRebuild, TrainingRunRollbackRefusalCode, LoopTraceRebuild, LoopTraceDeleteResponse, PipelineAttemptOutcome, PipelineLiveDeploymentStatus, PipelineLiveDeployment, LoopStorageWhere, LoopStorage, Pipeline, PipelineListParams, PipelineListStatus, PipelineListResponse, PipelineTrainingSettings, PipelineTrainingDefaults, PipelineTrainingRequest, PipelineResponse, PipelineTrainWhen, PipelineSchedule, PipelineWriteRequest, PipelineMutationResponse, PipelineImportParams, PipelineFloors, HeldBackFloors, LoopModel, LoopModelsResponse, LoopUnavailableModel, LoopUnavailableReasonCode, LoopTracePipeline, LoopTracePipelinesResponse, LoopMetricsHistoryParams, LoopMetricPoint, LoopSignalDay, LoopMetricsHistory, LoopCaptureFeedback, LoopFeedbackWord, LoopCaptureHealth, LoopCaptureMiss, LoopSignalManyItem, LoopSignalManyResult, 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.3.0-dev.322';
39
+ export const VERSION = '0.3.0-dev.324';
40
40
  export class RunBiOS {
41
41
  /** Search models, fetch configs, check adapter compatibility. */
42
42
  models;
@@ -66,8 +66,12 @@ export interface FunctionTool extends Record<string, unknown> {
66
66
  * refused 409 `SAMPLE_NOT_YET_RECORDED`; send it again after the
67
67
  * `Retry-After` seconds.
68
68
  *
69
- * Works for serverless models and dedicated deployments, on
70
- * `/v1/chat/completions` and `/v1/messages` only.
69
+ * Works on `/v1/chat/completions` for serverless models and dedicated
70
+ * deployments, a pipeline's own `loop-<tag>` model included, and on
71
+ * `/v1/messages` for serverless models: a dedicated deployment serves the
72
+ * OpenAI shape and refuses an Anthropic body with 400. Only the tags of a
73
+ * pipeline that exists are recorded; `client.loop.stats()` lists the calls
74
+ * that were not, under `capture`.
71
75
  */
72
76
  export interface LoopCaptureOption {
73
77
  /** One pipeline tag, or several; each a non-empty tag with no comma. */
@@ -412,7 +416,9 @@ export declare class Inference {
412
416
  /**
413
417
  * Anthropic Messages (`/v1/messages`). With `loop: { pipeline }` the
414
418
  * exchange is recorded into those pipelines and the result carries
415
- * `loop_sample_id` (see {@link LoopCaptureOption}).
419
+ * `loop_sample_id` (see {@link LoopCaptureOption}). For serverless models:
420
+ * a dedicated deployment, a pipeline's `loop-<tag>` model included, serves
421
+ * the OpenAI shape and refuses this with 400; call it with `chatCompletions`.
416
422
  */
417
423
  messages(params: AnthropicMessageParams): Promise<AnthropicMessageResponse>;
418
424
  streamCompletions(params: CompletionParams): AsyncGenerator<Record<string, unknown>>;
@@ -1027,7 +1027,9 @@ export class Inference {
1027
1027
  /**
1028
1028
  * Anthropic Messages (`/v1/messages`). With `loop: { pipeline }` the
1029
1029
  * exchange is recorded into those pipelines and the result carries
1030
- * `loop_sample_id` (see {@link LoopCaptureOption}).
1030
+ * `loop_sample_id` (see {@link LoopCaptureOption}). For serverless models:
1031
+ * a dedicated deployment, a pipeline's `loop-<tag>` model included, serves
1032
+ * the OpenAI shape and refuses this with 400; call it with `chatCompletions`.
1031
1033
  */
1032
1034
  messages(params) {
1033
1035
  return this.sendVerb('/v1/messages', params, true);
@@ -1,5 +1,5 @@
1
1
  import { type HttpClient } from '../client.js';
2
- import type { LoopTrace, LoopTraceDeleteResponse, 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, PipelineAttemptListParams, PipelineAttemptListResponse, PipelineListParams, PipelineListResponse, PipelineWriteRequest, PipelineMutationResponse, LoopModelsResponse, PipelineImportParams, PipelineBenchmarksResponse, PipelineBenchmarkAttachParams, PipelineBenchmarkMoveParams, VersionCompareResponse, VersionCompareParams, AttemptCompareResponse, AttemptCompareParams } from '../types.js';
2
+ import type { LoopTrace, LoopTraceDeleteResponse, LoopTraceListResponse, LoopTraceListParams, LoopCaptureParams, LoopCaptureResult, LoopImportParams, LoopImportResult, LoopSignal, LoopSignalParams, LoopSignalManyItem, LoopSignalManyResult, 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, PipelineAttemptListParams, PipelineAttemptListResponse, PipelineListParams, PipelineListResponse, PipelineWriteRequest, PipelineMutationResponse, LoopModelsResponse, PipelineImportParams, PipelineBenchmarksResponse, PipelineBenchmarkAttachParams, PipelineBenchmarkMoveParams, VersionCompareResponse, VersionCompareParams, AttemptCompareResponse, AttemptCompareParams } from '../types.js';
3
3
  export declare class Loop {
4
4
  private readonly _http;
5
5
  /** @internal */
@@ -27,6 +27,10 @@ export declare class Loop {
27
27
  * When the source is not switched on this resolves with `captured: false`
28
28
  * and a reason instead of throwing -- capture must never be the thing that
29
29
  * breaks your application.
30
+ *
31
+ * Already know the answer was good, bad or wrong? Pass `feedback` and it is
32
+ * written with the exchange, so no second call is needed:
33
+ * `feedback: { verdict: 'corrected', correction: 'Thirty days from delivery.' }`.
30
34
  */
31
35
  capture(params: LoopCaptureParams): Promise<LoopCaptureResult>;
32
36
  /**
@@ -140,6 +144,27 @@ export declare class Loop {
140
144
  * that error. No other error is retried.
141
145
  */
142
146
  signal(traceId: string, params: LoopSignalParams): Promise<LoopSignal>;
147
+ /**
148
+ * Send many feedback items at once, several in flight together.
149
+ *
150
+ * Each item is `signal(item.trace_id, item)`: the same call, the same
151
+ * `SAMPLE_NOT_YET_RECORDED` retry. At most `concurrency` calls are in flight
152
+ * (8 by default, at most 32). It never throws for one item: every item
153
+ * comes back, in the order given, with its `signal` or the `error` it ended
154
+ * with, so one refused item costs no other.
155
+ *
156
+ * @example
157
+ * ```ts
158
+ * const results = await client.loop.signalMany([
159
+ * { trace_id: idA, verdict: 'good' },
160
+ * { trace_id: idB, verdict: 'corrected', correction: 'Refunds take five working days.' },
161
+ * ]);
162
+ * const failed = results.filter((r) => r.error);
163
+ * ```
164
+ */
165
+ signalMany(items: LoopSignalManyItem[], options?: {
166
+ concurrency?: number;
167
+ }): Promise<LoopSignalManyResult[]>;
143
168
  /**
144
169
  * Thumbs up: this answer was good. Shorthand for `signal(id, { verdict:
145
170
  * 'accepted' })` — there is one stored vocabulary behind both, so a thumbs-up
@@ -260,6 +285,13 @@ export declare class Loop {
260
285
  *
261
286
  * `ready.sft` is an upper bound: duplicates, the held-back set and
262
287
  * conversations too long to train on come out of it when an attempt trains.
288
+ *
289
+ * `capture` is what the one-header capture did not record over the last
290
+ * `capture.days` days: per tag, `no_pipeline` (no pipeline has the tag),
291
+ * `too_large` or `incomplete` (the answer could not be kept). Empty when
292
+ * every call was recorded. Rows are per tag: a call naming two tags is
293
+ * counted under each, so never add them up as calls. One pipeline's share
294
+ * is `capture` on its detail.
263
295
  */
264
296
  stats(): Promise<LoopStats>;
265
297
  /**
@@ -64,6 +64,9 @@ const FEEDBACK_TRIES = 6;
64
64
  /** The wait when the 409 names none, and the longest wait honoured. */
65
65
  const FEEDBACK_RETRY_DEFAULT_SECONDS = 2;
66
66
  const FEEDBACK_RETRY_MAX_SECONDS = 30;
67
+ /** How many feedback calls `signalMany` keeps in flight, by default and at most. */
68
+ const SIGNAL_MANY_CONCURRENCY = 8;
69
+ const SIGNAL_MANY_CONCURRENCY_MAX = 32;
67
70
  export class Loop {
68
71
  _http;
69
72
  /** @internal */
@@ -94,6 +97,10 @@ export class Loop {
94
97
  * When the source is not switched on this resolves with `captured: false`
95
98
  * and a reason instead of throwing -- capture must never be the thing that
96
99
  * breaks your application.
100
+ *
101
+ * Already know the answer was good, bad or wrong? Pass `feedback` and it is
102
+ * written with the exchange, so no second call is needed:
103
+ * `feedback: { verdict: 'corrected', correction: 'Thirty days from delivery.' }`.
97
104
  */
98
105
  async capture(params) {
99
106
  return this._http.fetchPost('/api/loop/traces', params);
@@ -273,6 +280,48 @@ export class Loop {
273
280
  }
274
281
  }
275
282
  }
283
+ /**
284
+ * Send many feedback items at once, several in flight together.
285
+ *
286
+ * Each item is `signal(item.trace_id, item)`: the same call, the same
287
+ * `SAMPLE_NOT_YET_RECORDED` retry. At most `concurrency` calls are in flight
288
+ * (8 by default, at most 32). It never throws for one item: every item
289
+ * comes back, in the order given, with its `signal` or the `error` it ended
290
+ * with, so one refused item costs no other.
291
+ *
292
+ * @example
293
+ * ```ts
294
+ * const results = await client.loop.signalMany([
295
+ * { trace_id: idA, verdict: 'good' },
296
+ * { trace_id: idB, verdict: 'corrected', correction: 'Refunds take five working days.' },
297
+ * ]);
298
+ * const failed = results.filter((r) => r.error);
299
+ * ```
300
+ */
301
+ async signalMany(items, options = {}) {
302
+ const asked = Math.trunc(options.concurrency ?? SIGNAL_MANY_CONCURRENCY);
303
+ const limit = Math.max(1, Math.min(Number.isFinite(asked) ? asked : SIGNAL_MANY_CONCURRENCY, SIGNAL_MANY_CONCURRENCY_MAX));
304
+ const out = new Array(items.length);
305
+ let next = 0;
306
+ const worker = async () => {
307
+ for (;;) {
308
+ const i = next++;
309
+ if (i >= items.length)
310
+ return;
311
+ const { trace_id, ...params } = items[i];
312
+ try {
313
+ if (!trace_id)
314
+ throw new Error('each feedback item needs its trace_id');
315
+ out[i] = { trace_id, signal: await this.signal(trace_id, params) };
316
+ }
317
+ catch (error) {
318
+ out[i] = { trace_id, error };
319
+ }
320
+ }
321
+ };
322
+ await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
323
+ return out;
324
+ }
276
325
  /**
277
326
  * Thumbs up: this answer was good. Shorthand for `signal(id, { verdict:
278
327
  * 'accepted' })` — there is one stored vocabulary behind both, so a thumbs-up
@@ -425,6 +474,13 @@ export class Loop {
425
474
  *
426
475
  * `ready.sft` is an upper bound: duplicates, the held-back set and
427
476
  * conversations too long to train on come out of it when an attempt trains.
477
+ *
478
+ * `capture` is what the one-header capture did not record over the last
479
+ * `capture.days` days: per tag, `no_pipeline` (no pipeline has the tag),
480
+ * `too_large` or `incomplete` (the answer could not be kept). Empty when
481
+ * every call was recorded. Rows are per tag: a call naming two tags is
482
+ * counted under each, so never add them up as calls. One pipeline's share
483
+ * is `capture` on its detail.
428
484
  */
429
485
  async stats() {
430
486
  const res = await this._http.fetchGet('/api/loop/stats');
package/dist/types.d.ts CHANGED
@@ -1740,6 +1740,14 @@ export interface InferenceDeploymentSummary {
1740
1740
  * unreachable or slow (a money read never blocks the list).
1741
1741
  */
1742
1742
  charged_cents?: number | null;
1743
+ /**
1744
+ * A Conscious Loop comparison machine that no model name points at: the
1745
+ * loop's own machine for comparing an attempt, listed and billed like any
1746
+ * other, but never a model to offer. Leave it out of a model picker; the
1747
+ * pipeline's own name (`loop-<tag>`) is the one to call. Absent from a
1748
+ * service from before it was sent.
1749
+ */
1750
+ loop_comparison?: boolean;
1743
1751
  /** History view (`include_terminated`) only: how the lifecycle closed, and when. */
1744
1752
  disposition?: string;
1745
1753
  deleted_at?: string | null;
@@ -2436,6 +2444,13 @@ export type LoopSource = 'human' | 'verifier' | 'judge' | 'behavioural';
2436
2444
  export type LoopVerdict = 'accepted' | 'rejected' | 'edited' | 'scored' | 'gold';
2437
2445
  /** The verdicts feedback can send: a person's good, bad, correction or reference answer. */
2438
2446
  export type LoopFeedbackVerdict = 'accepted' | 'rejected' | 'edited' | 'gold';
2447
+ /**
2448
+ * The plain words for the three common verdicts: `good` is `accepted`, `bad`
2449
+ * is `rejected` and `corrected` is `edited` (with its `correction`). A capture's
2450
+ * `feedback` takes them, and so does `signal`; the stored verdict, and the one
2451
+ * a signal answers with, is the `LoopVerdict` word.
2452
+ */
2453
+ export type LoopFeedbackWord = 'good' | 'bad' | 'corrected';
2439
2454
  /** A function an assistant turn asked to invoke. `arguments` is JSON-encoded. */
2440
2455
  export interface LoopToolCall {
2441
2456
  id?: string;
@@ -2483,6 +2498,19 @@ export interface LoopCaptureParams {
2483
2498
  * one conversation reaches another pipeline too. At most 32 in all.
2484
2499
  */
2485
2500
  labels?: string[];
2501
+ /**
2502
+ * The feedback you already have for this exchange, written with it, so no
2503
+ * second call is needed. Refused (400) before anything is stored when it is
2504
+ * unusable. Send `request_id` too: a retry under it records the feedback
2505
+ * once.
2506
+ */
2507
+ feedback?: LoopCaptureFeedback;
2508
+ }
2509
+ /** Feedback sent with a capture: good, bad, or corrected with the right answer. */
2510
+ export interface LoopCaptureFeedback {
2511
+ verdict: LoopFeedbackWord;
2512
+ /** Required with `corrected`, and read only then: the answer that should have been given. */
2513
+ correction?: string;
2486
2514
  }
2487
2515
  export interface LoopCaptureResult {
2488
2516
  captured: boolean;
@@ -2661,11 +2689,22 @@ export interface LoopSignal {
2661
2689
  metadata: Record<string, unknown> | null;
2662
2690
  created_at: string;
2663
2691
  }
2692
+ /** One feedback item for `loop.signalMany`: the sample's id and its feedback. */
2693
+ export interface LoopSignalManyItem extends LoopSignalParams {
2694
+ trace_id: string;
2695
+ }
2696
+ /** What became of one `signalMany` item: its signal, or the error it ended with. */
2697
+ export interface LoopSignalManyResult {
2698
+ trace_id: string;
2699
+ signal?: LoopSignal;
2700
+ error?: unknown;
2701
+ }
2664
2702
  export interface LoopSignalParams {
2665
- verdict: LoopFeedbackVerdict;
2703
+ /** A `LoopFeedbackVerdict`, or its plain word (`good`, `bad`, `corrected`: see `LoopFeedbackWord`). */
2704
+ verdict: LoopFeedbackVerdict | LoopFeedbackWord;
2666
2705
  /** Always `human` when sent: feedback is a person's. Other sources are refused 400. */
2667
2706
  source?: 'human';
2668
- /** Required when verdict is `edited` or `gold`. The answer the model should have given. */
2707
+ /** Required when verdict is `edited`, `corrected` or `gold`. The answer the model should have given. */
2669
2708
  correction?: string;
2670
2709
  /** A value or fact the answer can be checked against. Kept with the verdict; a pipeline trains on `correction`, not on this. */
2671
2710
  ground_truth?: string;
@@ -2847,6 +2886,32 @@ export interface LoopStats {
2847
2886
  ready: {
2848
2887
  sft: number;
2849
2888
  };
2889
+ /**
2890
+ * The calls sent with `X-Loop-Pipeline` in the last `days` days (UTC) that
2891
+ * were not recorded under a tag, most first. Empty when every one was.
2892
+ */
2893
+ capture: LoopCaptureHealth;
2894
+ }
2895
+ /** `LoopStats.capture` and `Pipeline.capture`: what the one-header capture did not record. */
2896
+ export interface LoopCaptureHealth {
2897
+ /** The window, in days, today included. */
2898
+ days: number;
2899
+ not_recorded: LoopCaptureMiss[];
2900
+ }
2901
+ /**
2902
+ * Calls under ONE tag that were not recorded, and why. A call naming two tags
2903
+ * is counted under each, so rows are not added up as calls.
2904
+ */
2905
+ export interface LoopCaptureMiss {
2906
+ tag: string;
2907
+ /**
2908
+ * `no_pipeline`: no pipeline has the tag (misspelt, never made, or deleted).
2909
+ * `too_large`: the answer was larger than the platform keeps for a sample.
2910
+ * `incomplete`: the answer was cut short, or had no text and no tool call.
2911
+ */
2912
+ reason: 'no_pipeline' | 'too_large' | 'incomplete';
2913
+ calls: number;
2914
+ last_at: string;
2850
2915
  }
2851
2916
  /** One pipeline a conversation falls inside (GET /api/loop/traces/{id}/pipelines). */
2852
2917
  export interface LoopTracePipeline {
@@ -2977,9 +3042,10 @@ export type TrainingRulePausedReason = 'consent_invalid' | 'insufficient_funds'
2977
3042
  /** A peer was unreachable when the rule was saved, so it has not been validated yet. */
2978
3043
  | 'validation_pending'
2979
3044
  /**
2980
- * Training is in beta and the rule's organisation does not hold the grant: a
2981
- * run was refused with the platform's pre-launch gate. Nothing on the rule is
2982
- * wrong; the platform team enables training, then a member saves the rule.
3045
+ * The platform's training service refused an attempt with its pre-launch
3046
+ * gate while the platform's services were being updated (the Conscious Loop
3047
+ * trains for every organisation, so nothing else gives this). Nothing on the
3048
+ * pipeline is wrong; switching it back on starts it again.
2983
3049
  */
2984
3050
  | 'training_not_enabled';
2985
3051
  /**
@@ -3212,11 +3278,20 @@ export interface TrainingRun {
3212
3278
  next_poll_at: string | null;
3213
3279
  last_reason: string | null;
3214
3280
  /**
3215
- * Why it failed or was set aside, as a code. Two belong to a pipeline that
3281
+ * Why it failed or was set aside, as a code. Three belong to a pipeline that
3216
3282
  * builds on its live version: `CHAIN_MOVED` (it was built on a version that
3217
3283
  * was rolled back while it trained; it is superseded, no comparison was
3218
- * paid for, and its samples go to the next attempt) and `NO_MERGED_EXPORT`
3219
- * (its training finished without the merged model it is served as).
3284
+ * paid for, and its samples go to the next attempt), `NO_MERGED_EXPORT`
3285
+ * (its training finished without the merged model it is served as) and
3286
+ * `TRAINING_SERVICE_BEHIND` (the platform's training service was being
3287
+ * updated when it asked for its training, so it stopped before any
3288
+ * training started; nothing was charged and the next attempt asks again).
3289
+ * `STEP_STALLED:TRAINING_SERVICE_BEHIND` is the same for one that waited
3290
+ * six hours for that update; the pipeline tries again on its own.
3291
+ * `ENV_GATED:SWITCHED_OFF`: the Conscious Loop was switched off on the
3292
+ * platform before its training started, so it stopped there; no GPU time
3293
+ * was charged, and the pipeline trains again on its own once the loop is
3294
+ * back.
3220
3295
  */
3221
3296
  error_code: string | null;
3222
3297
  last_error: string | null;
@@ -3295,6 +3370,12 @@ export interface TrainingRun {
3295
3370
  * machine bills beside it), so the attempt can stay in candidate_booking
3296
3371
  * past this time, by at most one more window. An attempt that ran out
3297
3372
  * gives the deadline it was held to on its expiry event (deadline_at).
3373
+ * Null while the machine has never had a GPU: that wait is free and its
3374
+ * `last_reason` says since when. A day after the machine was booked with no
3375
+ * GPU it is stopped (never started, not charged) and the attempt waits for
3376
+ * GPUs (`waiting_gpus`) keeping its trained model, then books the machine
3377
+ * again; if no GPU is free by that wait's end too, the attempt ends
3378
+ * (`expired`, `CANDIDATE_NOT_STARTED:NO_GPU`).
3298
3379
  */
3299
3380
  candidate_deadline_at: string | null;
3300
3381
  candidate_cleanup_at: string | null;
@@ -4065,11 +4146,14 @@ export type TrainingRuleRunRefusalCode = 'NOT_ENOUGH_SAMPLES' | 'PIPELINE_NEEDS_
4065
4146
  * benchmark the pipeline does not have yet.
4066
4147
  *
4067
4148
  * The platform:
4068
- * - `TRAINING_NOT_ENABLED` (409): training is in beta and this organisation
4069
- * does not hold the grant. Nothing in the request can lift it, so do not
4070
- * retry: ask the platform team to enable training for the organisation. A
4071
- * pipeline that meets it at fire time is paused `training_not_enabled`
4072
- * instead (see {@link TrainingRulePausedReason}).
4149
+ * - `TRAINING_NOT_ENABLED` (409): the platform's training service would not
4150
+ * take the pipeline's training while the platform was being updated (the
4151
+ * Conscious Loop trains for every organisation; this answer only appears
4152
+ * while the platform's services are being updated). Nothing was saved and
4153
+ * nothing in the request is wrong: try again in a few minutes. A pipeline
4154
+ * that meets it at fire time is paused `training_not_enabled` instead (see
4155
+ * {@link TrainingRulePausedReason}); switching it back on later starts it
4156
+ * again.
4073
4157
  * - `METHOD_NOT_ENABLED` (422): the platform has switched off the training
4074
4158
  * method pipelines train with.
4075
4159
  * - `CEILING_TOO_LOW` (422): the platform's own runaway limits cannot cover
@@ -4502,6 +4586,15 @@ export interface Pipeline {
4502
4586
  own_tag: string | null;
4503
4587
  /** A conversation carrying ANY of these tags is this pipeline's data. */
4504
4588
  tags: string[];
4589
+ /**
4590
+ * The calls sent with `X-Loop-Pipeline` in the last `days` days that were
4591
+ * not recorded: under this pipeline's tags (an answer too large to keep, or
4592
+ * cut short), and under any tag no pipeline had (`no_pipeline`: a misspelt
4593
+ * tag, or a deleted pipeline's). One row per tag: a call naming two tags is
4594
+ * counted under each, so rows are not added up as calls. Null on the list,
4595
+ * and when it could not be read: only `pipelines.get` reads it.
4596
+ */
4597
+ capture: LoopCaptureHealth | null;
4505
4598
  /**
4506
4599
  * A second base model, trained from its own base on all samples after each
4507
4600
  * attempt (it never builds on this pipeline's versions, which are another
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runbios-sdk",
3
- "version": "0.3.0-dev.322",
3
+ "version": "0.3.0-dev.324",
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",