runbios-sdk 0.2.1-dev.97 → 0.2.1-rc.118

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.js CHANGED
@@ -276,7 +276,7 @@ export class HttpClient {
276
276
  constructor(config) {
277
277
  // Default host stays api.runbios.ai for now; cutover to api.runbios.ai is
278
278
  // planned once its DNS exists.
279
- this.baseUrl = (config.baseUrl || envBaseUrl() || 'https://api-dev.runbios.ai').replace(/\/+$/, '');
279
+ this.baseUrl = (config.baseUrl || envBaseUrl() || 'https://api-staging.runbios.ai').replace(/\/+$/, '');
280
280
  this.apiKey = config.apiKey ?? envApiKey();
281
281
  this.accessToken = config.accessToken;
282
282
  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-dev.97";
39
+ export declare const VERSION = "0.2.1-rc.118";
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);
@@ -61,8 +70,9 @@ export { RunBiOS as BiOS };
61
70
  export { ApiError, GpuRejectionError, CapacityUnavailableError, ComingSoonError, CAPACITY_UNAVAILABLE_CODE, COMING_SOON_CODES, 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, } 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-dev.97';
39
+ export const VERSION = '0.2.1-rc.118';
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)
@@ -87,6 +98,7 @@ export { RunBiOS as BiOS };
87
98
  export { ApiError, GpuRejectionError, CapacityUnavailableError, ComingSoonError, CAPACITY_UNAVAILABLE_CODE, COMING_SOON_CODES, 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';
@@ -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
  /**
@@ -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;
@@ -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-dev.runbios.ai').replace(/\/+$/, '');
329
+ this.baseUrl = (config.baseUrl || envBaseUrl() || 'https://api-staging.runbios.ai').replace(/\/+$/, '');
330
330
  this.timeout = config.timeout ?? 900_000;
331
331
  this._http = http;
332
332
  }
@@ -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
+ }