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

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/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.323";
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.323';
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 {
@@ -4502,6 +4567,15 @@ export interface Pipeline {
4502
4567
  own_tag: string | null;
4503
4568
  /** A conversation carrying ANY of these tags is this pipeline's data. */
4504
4569
  tags: string[];
4570
+ /**
4571
+ * The calls sent with `X-Loop-Pipeline` in the last `days` days that were
4572
+ * not recorded: under this pipeline's tags (an answer too large to keep, or
4573
+ * cut short), and under any tag no pipeline had (`no_pipeline`: a misspelt
4574
+ * tag, or a deleted pipeline's). One row per tag: a call naming two tags is
4575
+ * counted under each, so rows are not added up as calls. Null on the list,
4576
+ * and when it could not be read: only `pipelines.get` reads it.
4577
+ */
4578
+ capture: LoopCaptureHealth | null;
4505
4579
  /**
4506
4580
  * A second base model, trained from its own base on all samples after each
4507
4581
  * 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.323",
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",