runbios-sdk 0.2.5 → 0.2.6-dev.198
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 +15 -3
- package/dist/client.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/resources/datasets.d.ts +33 -1
- package/dist/resources/datasets.js +55 -0
- package/dist/resources/inference.js +1 -1
- package/dist/resources/training.js +4 -0
- package/dist/types.d.ts +36 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -248,6 +248,12 @@ const imported = await client.datasets.importFromHuggingFace({
|
|
|
248
248
|
|
|
249
249
|
// Validate before upload
|
|
250
250
|
const validation = await client.datasets.validate('./data.jsonl');
|
|
251
|
+
|
|
252
|
+
// Maintain an existing dataset explicitly
|
|
253
|
+
await client.datasets.updateColumnMapping('ds_abc123', { conversation: 'messages' });
|
|
254
|
+
await client.datasets.revalidate('ds_abc123');
|
|
255
|
+
await client.datasets.updateSource('ds_abc123'); // reference-mode Hub datasets only
|
|
256
|
+
await client.datasets.setIntegration('ds_abc123', 'int_replacement'); // null detaches
|
|
251
257
|
```
|
|
252
258
|
|
|
253
259
|
#### Connected Hub search and exact source selection
|
|
@@ -273,9 +279,14 @@ polling timeout does not cancel the background import.
|
|
|
273
279
|
|
|
274
280
|
### Training
|
|
275
281
|
|
|
276
|
-
`datasetIds` preserves source order.
|
|
277
|
-
and
|
|
278
|
-
|
|
282
|
+
`datasetIds` preserves source order. `evalDatasetIds` selects separate held-out
|
|
283
|
+
datasets and is mutually exclusive with `evalSplit`; evaluation datasets are
|
|
284
|
+
composed sequentially and are never optimization rows. Both sets are frozen at
|
|
285
|
+
job creation—launch a new job to change them; an active run cannot accept more
|
|
286
|
+
data. Pass the same `mixing`
|
|
287
|
+
object to preflight and create: `{ mode: 'interleave', weights: [3, 1], seed: 42 }`.
|
|
288
|
+
Weights match the ordered training IDs. Modes are `sequential`, `shuffle`,
|
|
289
|
+
`interleave`, and `phased`; phased
|
|
279
290
|
plans contain ordered `phases` with `name`, `portion`, optional `weights`, and
|
|
280
291
|
`shuffle`. The default composition seed is 42. Resume reconstructs data from
|
|
281
292
|
source pins and the stored plan and verifies the checksum.
|
|
@@ -285,6 +296,7 @@ const request = {
|
|
|
285
296
|
idempotencyKey: 'training-create-20260711-0001',
|
|
286
297
|
model: 'meta-llama/Llama-3.1-8B-Instruct',
|
|
287
298
|
datasetIds: ['ds_abc123', 'ds_def456'],
|
|
299
|
+
evalDatasetIds: ['ds_holdout'],
|
|
288
300
|
method: 'sft' as const,
|
|
289
301
|
adapter: 'lora' as const,
|
|
290
302
|
queueIfUnavailable: true,
|
package/dist/client.js
CHANGED
|
@@ -340,7 +340,7 @@ export class HttpClient {
|
|
|
340
340
|
constructor(config) {
|
|
341
341
|
// Default host stays api.runbios.ai for now; cutover to api.runbios.ai is
|
|
342
342
|
// planned once its DNS exists.
|
|
343
|
-
this.baseUrl = (config.baseUrl || envBaseUrl() || 'https://api.runbios.ai').replace(/\/+$/, '');
|
|
343
|
+
this.baseUrl = (config.baseUrl || envBaseUrl() || 'https://api-dev.runbios.ai').replace(/\/+$/, '');
|
|
344
344
|
this.apiKey = config.apiKey ?? envApiKey();
|
|
345
345
|
this.accessToken = config.accessToken;
|
|
346
346
|
this.orgId = config.orgId;
|
package/dist/index.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ import { Loop } from './resources/loop.js';
|
|
|
36
36
|
* SDK version. Sent as part of the User-Agent header.
|
|
37
37
|
* Must match package.json "version" -- enforced by a contract test.
|
|
38
38
|
*/
|
|
39
|
-
export declare const VERSION = "0.2.
|
|
39
|
+
export declare const VERSION = "0.2.6-dev.198";
|
|
40
40
|
export declare class RunBiOS {
|
|
41
41
|
/** Search models, fetch configs, check adapter compatibility. */
|
|
42
42
|
readonly models: Models;
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ import { Loop } from './resources/loop.js';
|
|
|
36
36
|
* SDK version. Sent as part of the User-Agent header.
|
|
37
37
|
* Must match package.json "version" -- enforced by a contract test.
|
|
38
38
|
*/
|
|
39
|
-
export const VERSION = '0.2.
|
|
39
|
+
export const VERSION = '0.2.6-dev.198';
|
|
40
40
|
export class RunBiOS {
|
|
41
41
|
/** Search models, fetch configs, check adapter compatibility. */
|
|
42
42
|
models;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HttpClient } from '../client.js';
|
|
2
|
-
import type { Dataset, DatasetListParams, DatasetListResponse, DatasetUploadParams, DatasetPreview, DatasetPreviewParams, DatasetImportHFParams, DatasetRegisterHFParams, DatasetHubSearchParams, DatasetHubPreviewParams, DatasetValidation, DatasetFormatSpecs, DatasetStorageUsage } from '../types.js';
|
|
2
|
+
import type { Dataset, DatasetListParams, DatasetListResponse, DatasetUploadParams, DatasetPreview, DatasetPreviewParams, DatasetImportHFParams, DatasetRegisterHFParams, DatasetRegisterLoopParams, DatasetHubSearchParams, DatasetHubPreviewParams, DatasetValidation, DatasetFormatSpecs, DatasetStorageUsage } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Manage training datasets -- upload files, import from HuggingFace,
|
|
5
5
|
* preview contents, and manage storage.
|
|
@@ -76,6 +76,14 @@ export declare class Datasets {
|
|
|
76
76
|
* ```
|
|
77
77
|
*/
|
|
78
78
|
delete(id: string): Promise<void>;
|
|
79
|
+
/** Replace the source mapping and immediately revalidate the dataset. */
|
|
80
|
+
updateColumnMapping(id: string, columnMapping: Record<string, string>): Promise<Record<string, unknown>>;
|
|
81
|
+
/** Revalidate an existing dataset against its pinned source. */
|
|
82
|
+
revalidate(id: string): Promise<Record<string, unknown>>;
|
|
83
|
+
/** Adopt a compatible newer revision of a reference-mode Hub dataset. */
|
|
84
|
+
updateSource(id: string): Promise<Record<string, unknown>>;
|
|
85
|
+
/** Attach another connected Hub integration, or detach it with null. */
|
|
86
|
+
setIntegration(id: string, integrationId: string | null): Promise<Record<string, unknown>>;
|
|
79
87
|
/**
|
|
80
88
|
* Import a dataset from HuggingFace Hub via a connected integration.
|
|
81
89
|
*
|
|
@@ -110,6 +118,30 @@ export declare class Datasets {
|
|
|
110
118
|
* ```
|
|
111
119
|
*/
|
|
112
120
|
registerHuggingFace(params: DatasetRegisterHFParams | Record<string, unknown>): Promise<Dataset>;
|
|
121
|
+
/**
|
|
122
|
+
* Turn a curated Conscious Loop set into a dataset training can use.
|
|
123
|
+
*
|
|
124
|
+
* Without this, using a loop set from code meant downloading the JSONL and
|
|
125
|
+
* uploading it again as an unrelated dataset. That works, and it throws away
|
|
126
|
+
* the one thing that made the set worth having: which conversations, which
|
|
127
|
+
* verdicts and which judges produced it. Registering keeps that link.
|
|
128
|
+
*
|
|
129
|
+
* The set is then put through the SAME validation every uploaded dataset
|
|
130
|
+
* gets, so it comes back `processing` rather than ready -- poll
|
|
131
|
+
* {@link getStatus} before training on it. Registering the same set and split
|
|
132
|
+
* twice is refused rather than billed twice, and an empty set is refused
|
|
133
|
+
* rather than registered as something that would fail inside the trainer.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* const train = await client.datasets.registerLoop({
|
|
138
|
+
* loopDatasetId: 'd244894c-7ab4-4b3d-bfda-e0bb4c563ceb',
|
|
139
|
+
* name: 'extract-v1 distill SFT',
|
|
140
|
+
* split: 'train',
|
|
141
|
+
* });
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
registerLoop(params: DatasetRegisterLoopParams | Record<string, unknown>): Promise<Dataset>;
|
|
113
145
|
/**
|
|
114
146
|
* Get the processing status of a dataset.
|
|
115
147
|
*
|
|
@@ -173,6 +173,22 @@ export class Datasets {
|
|
|
173
173
|
async delete(id) {
|
|
174
174
|
await this._http.fetchDelete(`/api/datasets/${encodeURIComponent(id)}`);
|
|
175
175
|
}
|
|
176
|
+
/** Replace the source mapping and immediately revalidate the dataset. */
|
|
177
|
+
async updateColumnMapping(id, columnMapping) {
|
|
178
|
+
return this._http.fetchPatch(`/api/datasets/${encodeURIComponent(id)}/column-mapping`, columnMapping);
|
|
179
|
+
}
|
|
180
|
+
/** Revalidate an existing dataset against its pinned source. */
|
|
181
|
+
async revalidate(id) {
|
|
182
|
+
return this._http.fetchPost(`/api/datasets/${encodeURIComponent(id)}/revalidate`, {});
|
|
183
|
+
}
|
|
184
|
+
/** Adopt a compatible newer revision of a reference-mode Hub dataset. */
|
|
185
|
+
async updateSource(id) {
|
|
186
|
+
return this._http.fetchPost(`/api/datasets/${encodeURIComponent(id)}/update-source`, {});
|
|
187
|
+
}
|
|
188
|
+
/** Attach another connected Hub integration, or detach it with null. */
|
|
189
|
+
async setIntegration(id, integrationId) {
|
|
190
|
+
return this._http.fetchPost(`/api/datasets/${encodeURIComponent(id)}/integration`, { integration_id: integrationId });
|
|
191
|
+
}
|
|
176
192
|
/**
|
|
177
193
|
* Import a dataset from HuggingFace Hub via a connected integration.
|
|
178
194
|
*
|
|
@@ -244,6 +260,45 @@ export class Datasets {
|
|
|
244
260
|
});
|
|
245
261
|
return normalizeDataset(result);
|
|
246
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Turn a curated Conscious Loop set into a dataset training can use.
|
|
265
|
+
*
|
|
266
|
+
* Without this, using a loop set from code meant downloading the JSONL and
|
|
267
|
+
* uploading it again as an unrelated dataset. That works, and it throws away
|
|
268
|
+
* the one thing that made the set worth having: which conversations, which
|
|
269
|
+
* verdicts and which judges produced it. Registering keeps that link.
|
|
270
|
+
*
|
|
271
|
+
* The set is then put through the SAME validation every uploaded dataset
|
|
272
|
+
* gets, so it comes back `processing` rather than ready -- poll
|
|
273
|
+
* {@link getStatus} before training on it. Registering the same set and split
|
|
274
|
+
* twice is refused rather than billed twice, and an empty set is refused
|
|
275
|
+
* rather than registered as something that would fail inside the trainer.
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```ts
|
|
279
|
+
* const train = await client.datasets.registerLoop({
|
|
280
|
+
* loopDatasetId: 'd244894c-7ab4-4b3d-bfda-e0bb4c563ceb',
|
|
281
|
+
* name: 'extract-v1 distill SFT',
|
|
282
|
+
* split: 'train',
|
|
283
|
+
* });
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
async registerLoop(params) {
|
|
287
|
+
const raw = params;
|
|
288
|
+
const loopDatasetId = String(raw.loopDatasetId || raw.loop_dataset_id || '');
|
|
289
|
+
if (!loopDatasetId)
|
|
290
|
+
throw new Error('RunBiOS: loopDatasetId is required');
|
|
291
|
+
const workspaceId = String(raw.workspaceId || raw.workspace_id || '')
|
|
292
|
+
|| this._http.workspaceId
|
|
293
|
+
|| await this._http.resolveWorkspaceId();
|
|
294
|
+
const result = await this._http.fetchPost('/api/datasets/register-loop', {
|
|
295
|
+
loop_dataset_id: loopDatasetId,
|
|
296
|
+
workspace_id: workspaceId,
|
|
297
|
+
split: raw.split ?? 'all',
|
|
298
|
+
...(raw.name !== undefined && { name: raw.name }),
|
|
299
|
+
});
|
|
300
|
+
return normalizeDataset(result);
|
|
301
|
+
}
|
|
247
302
|
/**
|
|
248
303
|
* Get the processing status of a dataset.
|
|
249
304
|
*
|
|
@@ -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.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
|
}
|
|
@@ -19,12 +19,15 @@ function buildTrainingRequest(params) {
|
|
|
19
19
|
if (datasetIds.length === 0) {
|
|
20
20
|
throw new Error('RunBiOS: datasetId or datasetIds must contain at least one dataset');
|
|
21
21
|
}
|
|
22
|
+
const evalDatasetIds = [...new Set((params.evalDatasetIds || []).map((id) => id.trim()).filter(Boolean))];
|
|
22
23
|
const body = {
|
|
23
24
|
model_id: params.model,
|
|
24
25
|
dataset_ids: datasetIds,
|
|
25
26
|
training_method: trainingMethod,
|
|
26
27
|
train_type: params.adapter,
|
|
27
28
|
};
|
|
29
|
+
if (evalDatasetIds.length > 0)
|
|
30
|
+
body.eval_dataset_ids = evalDatasetIds;
|
|
28
31
|
if (params.modelRevision !== undefined)
|
|
29
32
|
body.model_revision = params.modelRevision;
|
|
30
33
|
const queueEnabled = params.queueIfUnavailable ?? false;
|
|
@@ -238,6 +241,7 @@ export class Training {
|
|
|
238
241
|
training_method: trainingMethod,
|
|
239
242
|
train_type: params.adapter,
|
|
240
243
|
dataset_ids: datasetIds,
|
|
244
|
+
eval_dataset_ids: [...new Set((params.evalDatasetIds || []).map((id) => id.trim()).filter(Boolean))],
|
|
241
245
|
gpu_type: params.gpuType,
|
|
242
246
|
gpu_count: params.gpuCount,
|
|
243
247
|
status: 'pending',
|
package/dist/types.d.ts
CHANGED
|
@@ -8,13 +8,13 @@ export interface BiOSConfig {
|
|
|
8
8
|
orgId?: string;
|
|
9
9
|
/** Workspace ID. Optional when using API keys (resolved from the key). Can override for multi-workspace keys. */
|
|
10
10
|
workspaceId?: string;
|
|
11
|
-
/** Base URL for the API. Falls back to the RUNBIOS_BASE_URL environment variable (legacy: BIOS_BASE_URL), then the canonical https://api.runbios.ai hostname. */
|
|
11
|
+
/** Base URL for the API. Falls back to the RUNBIOS_BASE_URL environment variable (legacy: BIOS_BASE_URL), then the canonical https://api-dev.runbios.ai hostname. */
|
|
12
12
|
baseUrl?: string;
|
|
13
13
|
/** Request timeout in milliseconds. Defaults to 30000. */
|
|
14
14
|
timeout?: number;
|
|
15
15
|
/** Default per-deployment inference key. Can be overridden per inference call. */
|
|
16
16
|
inferenceKey?: string;
|
|
17
|
-
/** Inference base URL. Defaults to baseUrl, then https://api.runbios.ai. */
|
|
17
|
+
/** Inference base URL. Defaults to baseUrl, then https://api-dev.runbios.ai. */
|
|
18
18
|
inferenceBaseUrl?: string;
|
|
19
19
|
/** End-to-end inference timeout in milliseconds. Defaults to 15 minutes. */
|
|
20
20
|
inferenceTimeout?: number;
|
|
@@ -286,12 +286,26 @@ export interface ModelConfig {
|
|
|
286
286
|
/** Whether config was successfully resolved. */
|
|
287
287
|
resolved: boolean;
|
|
288
288
|
}
|
|
289
|
+
export interface DatasetCatalog {
|
|
290
|
+
slug: string;
|
|
291
|
+
version: number;
|
|
292
|
+
access_mode: 'everyone' | 'organizations' | 'tiers';
|
|
293
|
+
license: string;
|
|
294
|
+
attribution: string;
|
|
295
|
+
source_url: string;
|
|
296
|
+
source_revision: string;
|
|
297
|
+
}
|
|
289
298
|
/** A dataset in the user's workspace. */
|
|
290
299
|
export interface Dataset {
|
|
291
300
|
id: string;
|
|
292
301
|
name: string;
|
|
293
302
|
description?: string;
|
|
294
|
-
workspace_id?: string;
|
|
303
|
+
workspace_id?: string | null;
|
|
304
|
+
is_system?: boolean;
|
|
305
|
+
provider?: 'RunBIOS' | null;
|
|
306
|
+
storage_billing_owner?: 'runbios' | 'customer';
|
|
307
|
+
read_only?: boolean;
|
|
308
|
+
catalog?: DatasetCatalog | null;
|
|
295
309
|
source?: string;
|
|
296
310
|
hf_dataset_id?: string | null;
|
|
297
311
|
hf_subset?: string | null;
|
|
@@ -430,6 +444,21 @@ export interface DatasetRegisterHFParams {
|
|
|
430
444
|
columnMapping?: Record<string, string>;
|
|
431
445
|
importMode?: 'auto' | 'reference' | 'materialize';
|
|
432
446
|
}
|
|
447
|
+
/** Parameters for registering a curated Conscious Loop set as a dataset. */
|
|
448
|
+
export interface DatasetRegisterLoopParams {
|
|
449
|
+
/** The Conscious Loop dataset to register. */
|
|
450
|
+
loopDatasetId: string;
|
|
451
|
+
/** Defaults to `loop-<first 8 of the loop id>`. */
|
|
452
|
+
name?: string;
|
|
453
|
+
/**
|
|
454
|
+
* Which rows to take. Defaults to `all`, because the loop already split the
|
|
455
|
+
* set by TIME and re-splitting a deliberate split throws that decision away.
|
|
456
|
+
* Register `train` and `holdout` separately to score a training job against
|
|
457
|
+
* the loop's own held-back rows; both can exist at once.
|
|
458
|
+
*/
|
|
459
|
+
split?: 'all' | 'train' | 'holdout';
|
|
460
|
+
workspaceId?: string;
|
|
461
|
+
}
|
|
433
462
|
/** Parameters for searching HuggingFace Hub datasets. */
|
|
434
463
|
export interface DatasetHubSearchParams {
|
|
435
464
|
/** Search query. */
|
|
@@ -541,6 +570,8 @@ export interface TrainingCreateParams {
|
|
|
541
570
|
datasetId?: string;
|
|
542
571
|
/** Ordered dataset IDs for multi-dataset training. */
|
|
543
572
|
datasetIds?: string[];
|
|
573
|
+
/** Separate evaluation datasets, composed sequentially. Mutually exclusive with evalSplit. */
|
|
574
|
+
evalDatasetIds?: string[];
|
|
544
575
|
/**
|
|
545
576
|
* Optional per-dataset row cap: keep only the first N rows of a dataset
|
|
546
577
|
* (key = a dataset ID from datasetIds, value = row count). Omit an entry, or
|
|
@@ -695,6 +726,7 @@ export interface TrainingJob {
|
|
|
695
726
|
train_type?: AdapterType;
|
|
696
727
|
rlhf_type?: RLHFAlgorithm | null;
|
|
697
728
|
dataset_ids?: string[];
|
|
729
|
+
eval_dataset_ids?: string[];
|
|
698
730
|
gpu_type?: string;
|
|
699
731
|
gpu_count?: number;
|
|
700
732
|
storage_gb?: number;
|
|
@@ -889,6 +921,7 @@ export interface CanonicalTrainingRequest {
|
|
|
889
921
|
name: string;
|
|
890
922
|
dataset_id: string;
|
|
891
923
|
dataset_ids: string[];
|
|
924
|
+
eval_dataset_ids?: string[];
|
|
892
925
|
hf_dataset_ids?: string;
|
|
893
926
|
dataset_mixing?: string;
|
|
894
927
|
mixing?: Record<string, unknown>;
|