runbios-sdk 0.2.1-rc.98 → 0.2.2-dev.171

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
@@ -239,17 +239,47 @@ const preview = await client.datasets.preview('ds_abc123', { pageSize: 5 });
239
239
 
240
240
  // Import from HuggingFace
241
241
  const imported = await client.datasets.importFromHuggingFace({
242
- repoId: 'databricks/dolly-15k',
242
+ repoId: 'HuggingFaceH4/ultrachat_200k',
243
243
  integrationId: 'int_abc123',
244
- name: 'Dolly 15k',
244
+ name: 'Ultrachat SFT',
245
+ subset: 'default',
246
+ split: 'train_sft',
245
247
  });
246
248
 
247
249
  // Validate before upload
248
250
  const validation = await client.datasets.validate('./data.jsonl');
249
251
  ```
250
252
 
253
+ #### Connected Hub search and exact source selection
254
+
255
+ Use `client.integrations.list()` to discover connected accounts, then select the
256
+ returned ID explicitly. `client.integrations.browse(integrationId, { query,
257
+ page, limit })` searches with that account's access. Discovery returns account
258
+ metadata, never stored credentials.
259
+
260
+ Pass the same `integrationId` to `datasets.previewHub` and
261
+ `datasets.importFromHuggingFace`. Preview returns `available_configs` and
262
+ `available_splits`; choose the actual subset/split rather than assuming `train`.
263
+ A missing or unauthorized integration is an error, not anonymous fallback.
264
+ Public imports without an integration use `datasets.registerHuggingFace` and
265
+ require `workspaceId` on the client or method call.
266
+
267
+ Both import methods accept `revision`, `maxSamples`, `sampleStrategy` and
268
+ `importMode`. The service records immutable source metadata for resume. A Hub
269
+ preview does not prove readiness or preview an arbitrary older revision: inspect
270
+ the registered dataset when importing an explicit revision. Poll
271
+ `datasets.getStatus(id)` until `ready` before selecting it for training; a client
272
+ polling timeout does not cancel the background import.
273
+
251
274
  ### Training
252
275
 
276
+ `datasetIds` preserves source order. Pass the same `mixing` object to preflight
277
+ and create: `{ mode: 'interleave', weights: [3, 1], seed: 42 }`. Weights match the
278
+ ordered IDs. Modes are `sequential`, `shuffle`, `interleave`, and `phased`; phased
279
+ plans contain ordered `phases` with `name`, `portion`, optional `weights`, and
280
+ `shuffle`. The default composition seed is 42. Resume reconstructs data from
281
+ source pins and the stored plan and verifies the checksum.
282
+
253
283
  ```typescript
254
284
  const request = {
255
285
  idempotencyKey: 'training-create-20260711-0001',
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { BiOSConfig, ApiErrorBody, AvailableGpuAlternative, CapacityMinimumRequirement } from './types.js';
1
+ import type { BiOSConfig, ApiErrorBody, AvailableGpuAlternative, CapacityMinimumRequirement, LoopImportResult } from './types.js';
2
2
  /**
3
3
  * Typed error thrown by every SDK method when the API returns a non-2xx status.
4
4
  *
@@ -135,6 +135,53 @@ export declare const COMING_SOON_CODES: readonly ["TRAINING_COMING_SOON", "DATAS
135
135
  export declare class ComingSoonError extends ApiError {
136
136
  constructor(status: number, body: ApiErrorBody);
137
137
  }
138
+ /** The code an import answers with when some rows were understood and then could not be stored. */
139
+ export declare const IMPORT_INCOMPLETE_CODE = "IMPORT_INCOMPLETE";
140
+ /**
141
+ * An import that did not finish: some rows could not be stored, or some
142
+ * verdicts that arrived with them could not be written.
143
+ *
144
+ * The rows it names were read and understood, so there is nothing to fix in
145
+ * the file: this is a storage failure, not a shape one. The full outcome is on
146
+ * {@link LoopImportIncompleteError.outcome} — what landed, which conversations
147
+ * it became, and which row positions did not — because a failure that reports
148
+ * only "it failed" leaves the caller with no move except sending everything
149
+ * again.
150
+ *
151
+ * HOW TO RECOVER. Send the same rows again with `importId`, the token this
152
+ * call was filed under. That is what makes the second call a RETRY: rows that
153
+ * already arrived come back under `already_present` instead of being stored
154
+ * twice, and a verdict that failed to write is attempted again. Repeat it
155
+ * exactly; a call that repeats nothing is a second import, on purpose, because
156
+ * a repeat is otherwise indistinguishable from the next page of a longer file.
157
+ *
158
+ * THE WHOLE FILE, not the rows this names, unless you sent `row_ids`. Without
159
+ * them a row is identified by its place in the call, so a shorter list moves
160
+ * every row after the gap and each is imported again.
161
+ */
162
+ export declare class LoopImportIncompleteError extends ApiError {
163
+ /** Counts, notes and ids for the import, in the same shape a success returns. */
164
+ readonly outcome: LoopImportResult;
165
+ constructor(status: number, body: ApiErrorBody);
166
+ /**
167
+ * The token to repeat as `import_id` to retry this call. Without it the retry
168
+ * is a second import rather than a retry, and what already landed is stored
169
+ * again.
170
+ */
171
+ get importId(): string | undefined;
172
+ /**
173
+ * Row positions that were not stored, counting from 1 in the order you sent
174
+ * them. They say what is missing; they are a smaller file to send back only
175
+ * if you sent `row_ids`.
176
+ */
177
+ get notSavedRows(): number[];
178
+ /**
179
+ * Row positions whose conversation stored and whose verdict did not. Those
180
+ * conversations are in the loop waiting for review; retrying records the
181
+ * verdict.
182
+ */
183
+ get verdictsNotSavedRows(): number[];
184
+ }
138
185
  /** Whether a machine code is one of the permanent GPU rejections. */
139
186
  export declare function isPermanentGpuCode(code: string | undefined): boolean;
140
187
  /**
package/dist/client.js CHANGED
@@ -191,6 +191,63 @@ export class ComingSoonError extends ApiError {
191
191
  this.name = 'ComingSoonError';
192
192
  }
193
193
  }
194
+ /** The code an import answers with when some rows were understood and then could not be stored. */
195
+ export const IMPORT_INCOMPLETE_CODE = 'IMPORT_INCOMPLETE';
196
+ /**
197
+ * An import that did not finish: some rows could not be stored, or some
198
+ * verdicts that arrived with them could not be written.
199
+ *
200
+ * The rows it names were read and understood, so there is nothing to fix in
201
+ * the file: this is a storage failure, not a shape one. The full outcome is on
202
+ * {@link LoopImportIncompleteError.outcome} — what landed, which conversations
203
+ * it became, and which row positions did not — because a failure that reports
204
+ * only "it failed" leaves the caller with no move except sending everything
205
+ * again.
206
+ *
207
+ * HOW TO RECOVER. Send the same rows again with `importId`, the token this
208
+ * call was filed under. That is what makes the second call a RETRY: rows that
209
+ * already arrived come back under `already_present` instead of being stored
210
+ * twice, and a verdict that failed to write is attempted again. Repeat it
211
+ * exactly; a call that repeats nothing is a second import, on purpose, because
212
+ * a repeat is otherwise indistinguishable from the next page of a longer file.
213
+ *
214
+ * THE WHOLE FILE, not the rows this names, unless you sent `row_ids`. Without
215
+ * them a row is identified by its place in the call, so a shorter list moves
216
+ * every row after the gap and each is imported again.
217
+ */
218
+ export class LoopImportIncompleteError extends ApiError {
219
+ /** Counts, notes and ids for the import, in the same shape a success returns. */
220
+ outcome;
221
+ constructor(status, body) {
222
+ super(status, body);
223
+ this.name = 'LoopImportIncompleteError';
224
+ this.outcome = body;
225
+ }
226
+ /**
227
+ * The token to repeat as `import_id` to retry this call. Without it the retry
228
+ * is a second import rather than a retry, and what already landed is stored
229
+ * again.
230
+ */
231
+ get importId() {
232
+ return this.outcome.import_id;
233
+ }
234
+ /**
235
+ * Row positions that were not stored, counting from 1 in the order you sent
236
+ * them. They say what is missing; they are a smaller file to send back only
237
+ * if you sent `row_ids`.
238
+ */
239
+ get notSavedRows() {
240
+ return this.outcome.not_saved_rows ?? [];
241
+ }
242
+ /**
243
+ * Row positions whose conversation stored and whose verdict did not. Those
244
+ * conversations are in the loop waiting for review; retrying records the
245
+ * verdict.
246
+ */
247
+ get verdictsNotSavedRows() {
248
+ return this.outcome.verdicts_not_saved_rows ?? [];
249
+ }
250
+ }
194
251
  /** Whether a machine code is one of the permanent GPU rejections. */
195
252
  export function isPermanentGpuCode(code) {
196
253
  return typeof code === 'string' && PERMANENT_GPU_CODES.includes(code);
@@ -225,6 +282,12 @@ export function buildApiError(status, body) {
225
282
  if (code && COMING_SOON_CODES.includes(code)) {
226
283
  return new ComingSoonError(status, body);
227
284
  }
285
+ // A half-finished import carries its whole outcome in the body. Leaving it as
286
+ // a plain ApiError makes the counts reachable only by casting `.body`, which
287
+ // is the same as not publishing them.
288
+ if (code === IMPORT_INCOMPLETE_CODE) {
289
+ return new LoopImportIncompleteError(status, body);
290
+ }
228
291
  return new ApiError(status, body);
229
292
  }
230
293
  // ============================================================================
@@ -276,7 +339,7 @@ export class HttpClient {
276
339
  constructor(config) {
277
340
  // Default host stays api.runbios.ai for now; cutover to api.runbios.ai is
278
341
  // planned once its DNS exists.
279
- this.baseUrl = (config.baseUrl || envBaseUrl() || 'https://api-staging.runbios.ai').replace(/\/+$/, '');
342
+ this.baseUrl = (config.baseUrl || envBaseUrl() || 'https://api-dev.runbios.ai').replace(/\/+$/, '');
280
343
  this.apiKey = config.apiKey ?? envApiKey();
281
344
  this.accessToken = config.accessToken;
282
345
  this.orgId = config.orgId;
package/dist/index.d.ts CHANGED
@@ -26,20 +26,23 @@
26
26
  import type { BiOSConfig, ApiKeyIntrospection } from './types.js';
27
27
  import { Models } from './resources/models.js';
28
28
  import { Datasets } from './resources/datasets.js';
29
+ import { Integrations } from './resources/integrations.js';
29
30
  import { Training } from './resources/training.js';
30
31
  import { Wallet } from './resources/wallet.js';
31
32
  import { GPU } from './resources/gpu.js';
32
33
  import { Inference } from './resources/inference.js';
34
+ import { Loop } from './resources/loop.js';
33
35
  /**
34
36
  * SDK version. Sent as part of the User-Agent header.
35
37
  * Must match package.json "version" -- enforced by a contract test.
36
38
  */
37
- export declare const VERSION = "0.2.1-rc.98";
39
+ export declare const VERSION = "0.2.2-dev.171";
38
40
  export declare class RunBiOS {
39
41
  /** Search models, fetch configs, check adapter compatibility. */
40
42
  readonly models: Models;
41
43
  /** Upload, import, preview, and manage training datasets. */
42
44
  readonly datasets: Datasets;
45
+ readonly integrations: Integrations;
43
46
  /** Create, monitor, stop, and resume fine-tuning jobs. */
44
47
  readonly training: Training;
45
48
  /** Check wallet balance. */
@@ -51,6 +54,12 @@ export declare class RunBiOS {
51
54
  * serving deployments, plus OpenAI-compatible non-streaming and SSE calls.
52
55
  */
53
56
  readonly inference: Inference;
57
+ /**
58
+ * The Conscious Loop. Capture what your model was asked and answered, record
59
+ * whether it was right, and turn those judgements into training data for
60
+ * SFT, DPO or GRPO. Nothing is captured until you turn it on for a source.
61
+ */
62
+ readonly loop: Loop;
54
63
  /** @internal */
55
64
  private readonly _http;
56
65
  constructor(config: BiOSConfig);
@@ -58,11 +67,14 @@ export declare class RunBiOS {
58
67
  }
59
68
  /** @deprecated Use {@link RunBiOS}. */
60
69
  export { RunBiOS as BiOS };
61
- export { ApiError, GpuRejectionError, CapacityUnavailableError, ComingSoonError, CAPACITY_UNAVAILABLE_CODE, COMING_SOON_CODES, PERMANENT_GPU_CODES, isPermanentGpuCode, gpuRejectionCodeForReason, } from './client.js';
70
+ export { ApiError, GpuRejectionError, CapacityUnavailableError, ComingSoonError, LoopImportIncompleteError, CAPACITY_UNAVAILABLE_CODE, COMING_SOON_CODES, IMPORT_INCOMPLETE_CODE, PERMANENT_GPU_CODES, isPermanentGpuCode, gpuRejectionCodeForReason, } from './client.js';
62
71
  export { Models } from './resources/models.js';
63
72
  export { Datasets } from './resources/datasets.js';
73
+ export { Integrations, type HuggingFaceIntegration, type IntegrationBrowseParams } from './resources/integrations.js';
64
74
  export { Training } from './resources/training.js';
65
75
  export { Wallet } from './resources/wallet.js';
66
76
  export { GPU, type GPURecommendation } from './resources/gpu.js';
67
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, } from './resources/inference.js';
68
- export type { BiOSConfig, PaginatedResponse, ApiErrorBody, AvailableGpuAlternative, CapacityMinimumRequirement, InferenceBookingAccepted, Model, ModelSearchParams, ModelSearchResponse, ModelDetailResponse, 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, MetricPoint, MetricGraphConfig, TrainingCheckpoint, TrainingLogs, TrainingLogEntry, TrainingStopResponse, TrainingResumeResponse, CanonicalTrainingRequest, TrainingPreflightDataset, TrainingPreflightWarning, TrainingPreflightResponse, TrainingCapabilityChoice, TrainingConfigFieldCapability, TrainingCapabilities, GPUChoice, WalletBalance, Transaction, TransactionListResponse, TransactionListParams, GPUInfo, GPUPricingResponse, GPUOptionsParams, 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, } from './types.js';
78
+ export type { BiOSConfig, PaginatedResponse, ApiErrorBody, AvailableGpuAlternative, CapacityMinimumRequirement, InferenceBookingAccepted, Model, ModelSearchParams, ModelSearchResponse, ModelDetailResponse, 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, TrainingCadence, TrainingCombinator, ServingKind, TrainingRulePausedReason, LoopTrainingMethod, TrainType, GradersScope, TrainingTrigger, TrainingRunState, TrainingVerdict, TrainingDecision, NotifyState, EvaluationStatus, EvaluationItemStatus, EvaluationWinner, EvaluationWarningCode, ConsentVia, TrainingToolCall, TrainingMessage, TrainingRuleServing, TrainingGPURung, TrainingRule, TrainingRuleConsent, TrainingRulePreflightRefusal, TrainingRuleKeyRef, TrainingRuleKeyCheck, TrainingRulePreflight, TrainingRuleBuildSpec, TrainingRuleTriggerInput, TrainingRuleTrainingInput, TrainingRuleDeployInput, TrainingRuleMoneyInput, TrainingRuleEvaluationInput, TrainingRulePromotionInput, TrainingRuleAcceptTerms, TrainingRulePreflightRequest, TrainingRuleCreateRequest, TrainingRuleUpdateRequest, TrainingRuleConsentRequest, TrainingRuleListParams, TrainingRunPromoteRequest, TrainingRunRejectRequest, TrainingRunRollbackRequest, TrainingRunCancelRequest, TrainingRunListParams, TrainingRun, TrainingRunSummary, TrainingRunEvent, TrainingRunLinks, TrainingRunActions, EvaluationRef, EvaluationDecoding, EvaluationJudgeDimension, EvaluationDimensionScore, EvaluationGraderScore, EvaluationWarning, EvaluationMargin, JudgeAgreementDimension, JudgeAgreement, Evaluation, EvaluationItemSide, EvaluationItem, EvaluationItemListParams, JudgeAgreementParams, AgentSettings, AgentSettingsRequest, BenchmarkStatus, BenchmarkSourceKind, BenchmarkRunStatus, BenchmarkScoring, BenchmarkDimensionScore, Benchmark, BenchmarkItem, BenchmarkRun, BenchmarkHistoryPoint, BenchmarkSource, BenchmarkCreateParams, BenchmarkListParams, BenchmarkItemListParams, BenchmarkHistoryParams, BenchmarkRetireParams, TrainingRuleBenchmarkRequest, InferenceAlias, InferenceAliasRequest, TrainingRuleListResponse, TrainingRuleResponse, TrainingRuleMutationResponse, TrainingRuleDeleteResponse, TrainingRunListResponse, TrainingRunResponse, TrainingRunActionResponse, EvaluationItemsResponse, AgentSettingsResponse, InferenceAliasListResponse, InferenceAliasResponse, InferenceAliasDeleteResponse, BenchmarkListResponse, BenchmarkItemsResponse, BenchmarkHistoryResponse, } from './types.js';
79
+ /** The closed set of run states a training run never leaves. */
80
+ export { TERMINAL_RUN_STATES } from './types.js';
package/dist/index.js CHANGED
@@ -26,20 +26,23 @@
26
26
  import { HttpClient, envInferenceKey } from './client.js';
27
27
  import { Models } from './resources/models.js';
28
28
  import { Datasets } from './resources/datasets.js';
29
+ import { Integrations } from './resources/integrations.js';
29
30
  import { Training } from './resources/training.js';
30
31
  import { Wallet } from './resources/wallet.js';
31
32
  import { GPU } from './resources/gpu.js';
32
33
  import { Inference } from './resources/inference.js';
34
+ import { Loop } from './resources/loop.js';
33
35
  /**
34
36
  * SDK version. Sent as part of the User-Agent header.
35
37
  * Must match package.json "version" -- enforced by a contract test.
36
38
  */
37
- export const VERSION = '0.2.1-rc.98';
39
+ export const VERSION = '0.2.2-dev.171';
38
40
  export class RunBiOS {
39
41
  /** Search models, fetch configs, check adapter compatibility. */
40
42
  models;
41
43
  /** Upload, import, preview, and manage training datasets. */
42
44
  datasets;
45
+ integrations;
43
46
  /** Create, monitor, stop, and resume fine-tuning jobs. */
44
47
  training;
45
48
  /** Check wallet balance. */
@@ -51,6 +54,12 @@ export class RunBiOS {
51
54
  * serving deployments, plus OpenAI-compatible non-streaming and SSE calls.
52
55
  */
53
56
  inference;
57
+ /**
58
+ * The Conscious Loop. Capture what your model was asked and answered, record
59
+ * whether it was right, and turn those judgements into training data for
60
+ * SFT, DPO or GRPO. Nothing is captured until you turn it on for a source.
61
+ */
62
+ loop;
54
63
  /** @internal */
55
64
  _http;
56
65
  constructor(config) {
@@ -58,9 +67,11 @@ export class RunBiOS {
58
67
  this._http = http;
59
68
  this.models = new Models(http);
60
69
  this.datasets = new Datasets(http);
70
+ this.integrations = new Integrations(http);
61
71
  this.training = new Training(http);
62
72
  this.wallet = new Wallet(http);
63
73
  this.gpu = new GPU(http);
74
+ this.loop = new Loop(http);
64
75
  // Inference-key resolution, most specific first:
65
76
  // 1. an explicit inferenceKey (a per-deployment sk-bios-... key)
66
77
  // 2. RUNBIOS_INFERENCE_KEY from the environment (legacy: BIOS_INFERENCE_KEY)
@@ -84,10 +95,13 @@ export { RunBiOS as BiOS };
84
95
  // ---------------------------------------------------------------------------
85
96
  // Re-exports
86
97
  // ---------------------------------------------------------------------------
87
- export { ApiError, GpuRejectionError, CapacityUnavailableError, ComingSoonError, CAPACITY_UNAVAILABLE_CODE, COMING_SOON_CODES, PERMANENT_GPU_CODES, isPermanentGpuCode, gpuRejectionCodeForReason, } from './client.js';
98
+ export { ApiError, GpuRejectionError, CapacityUnavailableError, ComingSoonError, LoopImportIncompleteError, CAPACITY_UNAVAILABLE_CODE, COMING_SOON_CODES, IMPORT_INCOMPLETE_CODE, PERMANENT_GPU_CODES, isPermanentGpuCode, gpuRejectionCodeForReason, } from './client.js';
88
99
  export { Models } from './resources/models.js';
89
100
  export { Datasets } from './resources/datasets.js';
101
+ export { Integrations } from './resources/integrations.js';
90
102
  export { Training } from './resources/training.js';
91
103
  export { Wallet } from './resources/wallet.js';
92
104
  export { GPU } from './resources/gpu.js';
93
105
  export { Inference, validateChatRequest, parseSSE, buildInferenceRequest, contextSizingBasis, CONTEXT_DEFAULT_CEILING, CONTEXT_EDITABLE_FLOOR, } from './resources/inference.js';
106
+ /** The closed set of run states a training run never leaves. */
107
+ export { TERMINAL_RUN_STATES } from './types.js';
@@ -84,10 +84,14 @@ export declare class Datasets {
84
84
  *
85
85
  * @example
86
86
  * ```ts
87
+ * The selected split must already expose canonical rows: a `messages` array
88
+ * for SFT or a `text` field for CPT. Legacy layouts are rejected with
89
+ * conversion guidance rather than remapped silently.
90
+ *
87
91
  * const imported = await client.datasets.importFromHuggingFace({
88
- * repoId: 'databricks/dolly-15k',
92
+ * repoId: 'your-org/dataset-with-messages',
89
93
  * integrationId: 'int_abc123',
90
- * name: 'Dolly 15k',
94
+ * name: 'Canonical SFT data',
91
95
  * });
92
96
  * console.log(`Imported: ${imported.id}`);
93
97
  * ```
@@ -99,8 +103,8 @@ export declare class Datasets {
99
103
  * @example
100
104
  * ```ts
101
105
  * const ds = await client.datasets.registerHuggingFace({
102
- * repo_id: 'databricks/dolly-15k',
103
- * name: 'Dolly 15k',
106
+ * repo_id: 'your-org/dataset-with-text',
107
+ * name: 'Canonical CPT corpus',
104
108
  * split: 'train',
105
109
  * });
106
110
  * ```
@@ -114,6 +114,9 @@ export class Datasets {
114
114
  const message = err instanceof Error ? err.message : String(err);
115
115
  throw new Error(`Failed to read file at "${params.filePath}": ${message}`);
116
116
  }
117
+ if (!fileName.toLowerCase().endsWith('.jsonl')) {
118
+ throw new Error('RunBiOS: dataset uploads accept .jsonl only — one JSON object per line, with "messages" for SFT or "text" for CPT');
119
+ }
117
120
  const blob = new Blob([fileData]);
118
121
  const formData = new FormData();
119
122
  formData.append('file', blob, fileName);
@@ -181,10 +184,14 @@ export class Datasets {
181
184
  *
182
185
  * @example
183
186
  * ```ts
187
+ * The selected split must already expose canonical rows: a `messages` array
188
+ * for SFT or a `text` field for CPT. Legacy layouts are rejected with
189
+ * conversion guidance rather than remapped silently.
190
+ *
184
191
  * const imported = await client.datasets.importFromHuggingFace({
185
- * repoId: 'databricks/dolly-15k',
192
+ * repoId: 'your-org/dataset-with-messages',
186
193
  * integrationId: 'int_abc123',
187
- * name: 'Dolly 15k',
194
+ * name: 'Canonical SFT data',
188
195
  * });
189
196
  * console.log(`Imported: ${imported.id}`);
190
197
  * ```
@@ -196,6 +203,7 @@ export class Datasets {
196
203
  return normalizeDataset(await this._http.fetchPost(`/api/datasets/integrations/${encodeURIComponent(params.integrationId)}/import`, {
197
204
  dataset_id: params.repoId,
198
205
  name: params.name || params.repoId.split('/').pop() || params.repoId,
206
+ revision: params.revision,
199
207
  subset: params.subset,
200
208
  split: params.split,
201
209
  max_samples: params.maxSamples,
@@ -210,8 +218,8 @@ export class Datasets {
210
218
  * @example
211
219
  * ```ts
212
220
  * const ds = await client.datasets.registerHuggingFace({
213
- * repo_id: 'databricks/dolly-15k',
214
- * name: 'Dolly 15k',
221
+ * repo_id: 'your-org/dataset-with-text',
222
+ * name: 'Canonical CPT corpus',
215
223
  * split: 'train',
216
224
  * });
217
225
  * ```
@@ -232,6 +240,7 @@ export class Datasets {
232
240
  description: raw.description,
233
241
  hf_subset: raw.subset ?? raw.hf_subset,
234
242
  hf_split: raw.split ?? raw.hf_split,
243
+ hf_revision: raw.revision ?? raw.hf_revision,
235
244
  max_samples: raw.maxSamples ?? raw.max_samples,
236
245
  sample_strategy: raw.sampleStrategy ?? raw.sample_strategy,
237
246
  column_mapping: raw.columnMapping ?? raw.column_mapping,
@@ -341,6 +350,8 @@ export class Datasets {
341
350
  q.set('subset', params.subset);
342
351
  if (params.limit !== undefined)
343
352
  q.set('limit', String(params.limit));
353
+ if (params.integrationId)
354
+ q.set('integration_id', params.integrationId);
344
355
  return this._http.fetchGet(`/api/datasets/hub-preview?${q}`);
345
356
  }
346
357
  /**
@@ -46,6 +46,13 @@ export class GPU {
46
46
  if (params.modelActiveParamsB !== undefined) {
47
47
  q.set('model_active_params_b', String(params.modelActiveParamsB));
48
48
  }
49
+ if (params.maxLength !== undefined)
50
+ q.set('max_length', String(params.maxLength));
51
+ if (params.effectiveBatch !== undefined)
52
+ q.set('effective_batch', String(params.effectiveBatch));
53
+ else if (params.perDeviceTrainBatchSize !== undefined) {
54
+ q.set('per_device_train_batch_size', String(params.perDeviceTrainBatchSize));
55
+ }
49
56
  return this._http.fetchGet(`/api/training/gpu-options?${q}`);
50
57
  }
51
58
  /**
@@ -1,5 +1,5 @@
1
1
  import type { HttpClient } from '../client.js';
2
- import type { InferenceDeployment, InferenceDeploymentSummary, InferenceBookingAccepted, InferenceCreateParams, InferenceCreateResponse, InferenceDeleteResponse, InferenceGPUOptionsParams, InferenceGPUOptionsResponse, InferenceLifecycleResponse, InferenceListParams, InferenceListResponse, InferenceNotificationListResponse, InferencePreflightResponse, InferenceUpdateResponse, InferenceUpdateParams } from '../types.js';
2
+ import type { InferenceDeployment, InferenceDeploymentSummary, InferenceBookingAccepted, InferenceCreateParams, InferenceCreateResponse, InferenceDeleteResponse, InferenceGPUOptionsParams, InferenceGPUOptionsResponse, InferenceLifecycleResponse, InferenceListParams, InferenceListResponse, InferenceNotificationListResponse, InferencePreflightResponse, InferenceUpdateResponse, InferenceUpdateParams, InferenceAlias, InferenceAliasRequest, InferenceAliasDeleteResponse } from '../types.js';
3
3
  /**
4
4
  * Serving context-length policy, owned and enforced by the server. Mirrored
5
5
  * here for documentation only -- never to pre-empt a server verdict.
@@ -62,7 +62,13 @@ export interface ChatCompletionParams extends Record<string, unknown> {
62
62
  /**
63
63
  * Standardized reasoning effort. Forwarded to `/v1/chat/completions` as
64
64
  * `reasoning_effort`. Use `'none'` to disable reasoning where the model
65
- * allows it.
65
+ * allows it — with reasoning off, no thinking tokens are generated or billed.
66
+ *
67
+ * `'low'` and `'medium'` minimise or skip thinking. `'high'`, `'xhigh'` and
68
+ * `'max'` think, and thinking tokens are billed as output tokens AND count
69
+ * against `max_tokens` — so a small `max_tokens` at those levels can be spent
70
+ * entirely on thinking and return an empty `content` with
71
+ * `finish_reason: "length"`. Budget generously at `'xhigh'`/`'max'`.
66
72
  */
67
73
  reasoningEffort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
68
74
  inferenceKey?: string;
@@ -207,6 +213,31 @@ export declare class Inference {
207
213
  restart(id: string): Promise<InferenceLifecycleResponse>;
208
214
  update(id: string, params: InferenceUpdateParams): Promise<InferenceUpdateResponse>;
209
215
  delete(id: string): Promise<InferenceDeleteResponse>;
216
+ /**
217
+ * Point a name at a deployment, creating the alias or moving an existing one.
218
+ *
219
+ * THIS CHANGES WHAT ANSWERS YOUR TRAFFIC the moment it returns. The reply
220
+ * carries `previous_target_inference_id`, which is what to put back if the
221
+ * new target turns out to be wrong.
222
+ *
223
+ * `origin` records why the handle moved -- a run id, a person, a script --
224
+ * and is worth setting: an alias that changed with no reason recorded is an
225
+ * incident nobody can reconstruct.
226
+ *
227
+ * Refused when the name already belongs to a live deployment
228
+ * (`ALIAS_NAME_IS_A_DEPLOYMENT`), when the target is not running, degraded or
229
+ * provisioning (`TARGET_NOT_SERVABLE`), and with `404` when the target is not
230
+ * in this workspace.
231
+ */
232
+ setAlias(name: string, params: InferenceAliasRequest): Promise<InferenceAlias>;
233
+ /** Every alias in the workspace, with what each one points at today. */
234
+ listAliases(): Promise<InferenceAlias[]>;
235
+ /**
236
+ * Remove an alias. The name goes back to the deployment that owns it, if one
237
+ * does; callers still using the alias stop resolving, so move it rather than
238
+ * delete it when something is still calling it.
239
+ */
240
+ deleteAlias(name: string): Promise<InferenceAliasDeleteResponse>;
210
241
  /**
211
242
  * Model-fit GPU choices joined to the authoritative deployment market
212
243
  * snapshot. MODEL-ADDRESSED (recommended, book-first §2): pass `model` (or
@@ -326,7 +326,7 @@ export class Inference {
326
326
  this.key = config.inferenceKey || envInferenceKey() || envApiKey();
327
327
  // Same default host as HttpClient (api.runbios.ai); api.runbios.ai cutover
328
328
  // is planned once its DNS exists — update both call sites together.
329
- this.baseUrl = (config.baseUrl || envBaseUrl() || 'https://api-staging.runbios.ai').replace(/\/+$/, '');
329
+ this.baseUrl = (config.baseUrl || envBaseUrl() || 'https://api-dev.runbios.ai').replace(/\/+$/, '');
330
330
  this.timeout = config.timeout ?? 900_000;
331
331
  this._http = http;
332
332
  }
@@ -629,6 +629,51 @@ export class Inference {
629
629
  delete(id) {
630
630
  return this.http.fetchDelete(`/api/inference/${encodeURIComponent(id)}`);
631
631
  }
632
+ // --------------------------------------------------------------------------
633
+ // Aliases -- re-pointable public handles
634
+ // --------------------------------------------------------------------------
635
+ //
636
+ // An alias is a name your callers use that you can move to a different
637
+ // deployment without them changing anything. It is what the automatic
638
+ // training loop re-points when it promotes a candidate, and it is what makes
639
+ // a rollback one row write rather than a redeployment.
640
+ //
641
+ // Reads carry `deployments:read` and writes `deployments:write`: an alias
642
+ // decides which model answers a customer's traffic, so it is fenced like the
643
+ // deployment it points at rather than like a label.
644
+ /**
645
+ * Point a name at a deployment, creating the alias or moving an existing one.
646
+ *
647
+ * THIS CHANGES WHAT ANSWERS YOUR TRAFFIC the moment it returns. The reply
648
+ * carries `previous_target_inference_id`, which is what to put back if the
649
+ * new target turns out to be wrong.
650
+ *
651
+ * `origin` records why the handle moved -- a run id, a person, a script --
652
+ * and is worth setting: an alias that changed with no reason recorded is an
653
+ * incident nobody can reconstruct.
654
+ *
655
+ * Refused when the name already belongs to a live deployment
656
+ * (`ALIAS_NAME_IS_A_DEPLOYMENT`), when the target is not running, degraded or
657
+ * provisioning (`TARGET_NOT_SERVABLE`), and with `404` when the target is not
658
+ * in this workspace.
659
+ */
660
+ async setAlias(name, params) {
661
+ const res = await this.http.fetchPut(`/api/inference/aliases/${encodeURIComponent(name)}`, params);
662
+ return res.alias;
663
+ }
664
+ /** Every alias in the workspace, with what each one points at today. */
665
+ async listAliases() {
666
+ const res = await this.http.fetchGet('/api/inference/aliases');
667
+ return res.aliases || [];
668
+ }
669
+ /**
670
+ * Remove an alias. The name goes back to the deployment that owns it, if one
671
+ * does; callers still using the alias stop resolving, so move it rather than
672
+ * delete it when something is still calling it.
673
+ */
674
+ async deleteAlias(name) {
675
+ return this.http.fetchDelete(`/api/inference/aliases/${encodeURIComponent(name)}`);
676
+ }
632
677
  /**
633
678
  * Model-fit GPU choices joined to the authoritative deployment market
634
679
  * snapshot. MODEL-ADDRESSED (recommended, book-first §2): pass `model` (or
@@ -0,0 +1,21 @@
1
+ import type { HttpClient } from '../client.js';
2
+ export interface HuggingFaceIntegration {
3
+ id: string;
4
+ label: string;
5
+ provider: string;
6
+ status: string;
7
+ hf_username?: string;
8
+ scope?: string;
9
+ }
10
+ export interface IntegrationBrowseParams {
11
+ query?: string;
12
+ page?: number;
13
+ limit?: number;
14
+ sort?: 'downloads' | 'likes' | 'modified';
15
+ }
16
+ export declare class Integrations {
17
+ private readonly _http;
18
+ constructor(_http: HttpClient);
19
+ list(): Promise<HuggingFaceIntegration[]>;
20
+ browse(id: string, params?: IntegrationBrowseParams): Promise<Record<string, unknown>>;
21
+ }
@@ -0,0 +1,20 @@
1
+ export class Integrations {
2
+ _http;
3
+ constructor(_http) {
4
+ this._http = _http;
5
+ }
6
+ async list() {
7
+ const result = await this._http.fetchGet('/api/datasets/integrations');
8
+ if (!Array.isArray(result.integrations))
9
+ throw new Error('The integration service did not return an account list');
10
+ return result.integrations;
11
+ }
12
+ async browse(id, params = {}) {
13
+ const query = new URLSearchParams({ page: String(params.page ?? 1), limit: String(params.limit ?? 20) });
14
+ if (params.query !== undefined)
15
+ query.set('search', params.query);
16
+ if (params.sort !== undefined)
17
+ query.set('sort', params.sort);
18
+ return this._http.fetchGet(`/api/datasets/integrations/${encodeURIComponent(id)}/browse?${query}`);
19
+ }
20
+ }