runbios-sdk 0.2.6-rc.201 → 0.2.7-dev.202

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
@@ -320,8 +320,14 @@ const job = await client.training.create(request);
320
320
  const jobs = await client.training.list({ status: 'running' });
321
321
  const page = await client.training.listPage({ limit: 50, offset: 0 });
322
322
 
323
- // Get metrics
324
- const metrics = await client.training.getMetrics('job_abc123');
323
+ // Get a compact, model-readable report (metric averages/ranges/best steps and GPU averages/peaks)
324
+ const report = await client.training.getMetrics('job_abc123', { view: 'summary' });
325
+ for (const metric of report.metric_summaries ?? []) {
326
+ console.log(metric.label, metric.latest, metric.average, metric.best);
327
+ }
328
+
329
+ // Request a bounded curve only when you need its shape
330
+ const metrics = await client.training.getMetrics('job_abc123', { view: 'series', maxPoints: 200 });
325
331
  for (const point of metrics.metrics) console.log(point.step, point.loss);
326
332
 
327
333
  // Get checkpoints
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-staging.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.6-rc.201";
39
+ export declare const VERSION = "0.2.7-dev.202";
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.6-rc.201';
39
+ export const VERSION = '0.2.7-dev.202';
40
40
  export class RunBiOS {
41
41
  /** Search models, fetch configs, check adapter compatibility. */
42
42
  models;
@@ -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
  }
@@ -1,5 +1,5 @@
1
1
  import type { HttpClient } from '../client.js';
2
- import type { TrainingCreateParams, TrainingListParams, TrainingJob, TrainingListResponse, TrainingMetrics, TrainingCheckpoint, TrainingLogs, TrainingStopResponse, TrainingResumeResponse, TrainingPreflightResponse, TrainingRecommendParams, TrainingAdvisorVerdict, TrainingCapabilities } from '../types.js';
2
+ import type { TrainingCreateParams, TrainingListParams, TrainingJob, TrainingListResponse, TrainingMetrics, TrainingMetricsOptions, TrainingCheckpoint, TrainingLogs, TrainingStopResponse, TrainingResumeResponse, TrainingPreflightResponse, TrainingRecommendParams, TrainingAdvisorVerdict, TrainingCapabilities } from '../types.js';
3
3
  /**
4
4
  * Create, monitor, and manage fine-tuning training jobs.
5
5
  */
@@ -93,15 +93,17 @@ export declare class Training {
93
93
  * Get training metrics (loss curves, learning rate, throughput) for a job.
94
94
  *
95
95
  * @param id - Training job ID.
96
+ * @param options - Choose semantic summaries, a bounded series, or the backward-compatible full rows.
96
97
  *
97
98
  * @example
98
99
  * ```ts
99
- * const metrics = await client.training.getMetrics('job_abc123');
100
- * console.log(`Current loss: ${metrics.metrics.at(-1)?.loss}`);
101
- * console.log(`${metrics.metrics.length} metric points`);
100
+ * const report = await client.training.getMetrics('job_abc123', { view: 'summary' });
101
+ * console.log(report.metric_summaries?.find(metric => metric.key === 'loss'));
102
+ * const curve = await client.training.getMetrics('job_abc123', { view: 'series', maxPoints: 200 });
103
+ * console.log(`${curve.metrics.length} bounded metric points`);
102
104
  * ```
103
105
  */
104
- getMetrics(id: string): Promise<TrainingMetrics>;
106
+ getMetrics(id: string, options?: TrainingMetricsOptions): Promise<TrainingMetrics>;
105
107
  /**
106
108
  * List checkpoints saved during training.
107
109
  *
@@ -343,20 +343,38 @@ export class Training {
343
343
  * Get training metrics (loss curves, learning rate, throughput) for a job.
344
344
  *
345
345
  * @param id - Training job ID.
346
+ * @param options - Choose semantic summaries, a bounded series, or the backward-compatible full rows.
346
347
  *
347
348
  * @example
348
349
  * ```ts
349
- * const metrics = await client.training.getMetrics('job_abc123');
350
- * console.log(`Current loss: ${metrics.metrics.at(-1)?.loss}`);
351
- * console.log(`${metrics.metrics.length} metric points`);
350
+ * const report = await client.training.getMetrics('job_abc123', { view: 'summary' });
351
+ * console.log(report.metric_summaries?.find(metric => metric.key === 'loss'));
352
+ * const curve = await client.training.getMetrics('job_abc123', { view: 'series', maxPoints: 200 });
353
+ * console.log(`${curve.metrics.length} bounded metric points`);
352
354
  * ```
353
355
  */
354
- async getMetrics(id) {
355
- const result = await this._http.fetchGet(`/api/training/jobs/${encodeURIComponent(id)}/metrics`);
356
+ async getMetrics(id, options = {}) {
357
+ if (options.maxPoints !== undefined && (!Number.isInteger(options.maxPoints) || options.maxPoints < 1 || options.maxPoints > 1000)) {
358
+ throw new Error('RunBiOS: maxPoints must be an integer between 1 and 1000');
359
+ }
360
+ const query = new URLSearchParams();
361
+ if (options.view)
362
+ query.set('view', options.view);
363
+ if (options.maxPoints !== undefined)
364
+ query.set('max_points', String(options.maxPoints));
365
+ const encodedQuery = query.toString();
366
+ const suffix = encodedQuery ? `?${encodedQuery}` : '';
367
+ const result = await this._http.fetchGet(`/api/training/jobs/${encodeURIComponent(id)}/metrics${suffix}`);
356
368
  const metrics = Array.isArray(result.metrics)
357
369
  ? result.metrics
358
370
  : Array.isArray(result.steps) ? result.steps : [];
359
- return { ...result, metrics, graph_configs: result.graph_configs || [], steps: metrics };
371
+ return {
372
+ ...result,
373
+ metrics,
374
+ graph_configs: result.graph_configs || [],
375
+ metric_summaries: result.metric_summaries || [],
376
+ steps: metrics,
377
+ };
360
378
  }
361
379
  /**
362
380
  * List checkpoints saved during training.
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-staging.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-staging.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;
@@ -837,13 +837,93 @@ export interface TrainingResourceMetrics {
837
837
  disk_total_gib: number | null;
838
838
  gpus: TrainingDeviceMetrics[];
839
839
  }
840
+ export interface TrainingResourceValueSummary {
841
+ average: number;
842
+ peak: number;
843
+ samples: number;
844
+ }
845
+ export interface TrainingDeviceResourceSummary {
846
+ memory_used_mib: TrainingResourceValueSummary | null;
847
+ memory_total_mib: number | null;
848
+ utilization_pct: TrainingResourceValueSummary | null;
849
+ temperature_c: TrainingResourceValueSummary | null;
850
+ }
851
+ export interface TrainingResourceSummary {
852
+ scope: 'attempt';
853
+ aggregation: 'sample_mean';
854
+ sample_count: number;
855
+ first_sampled_at: string | null;
856
+ last_sampled_at: string | null;
857
+ gpu_count: number | null;
858
+ gpu_memory_used_mib: TrainingResourceValueSummary | null;
859
+ gpu_memory_total_mib: number | null;
860
+ gpu_utilization_pct: TrainingResourceValueSummary | null;
861
+ gpu_temperature_c: TrainingResourceValueSummary | null;
862
+ host_ram_used_gib: TrainingResourceValueSummary | null;
863
+ host_ram_limit_gib: number | null;
864
+ host_ram_pct: TrainingResourceValueSummary | null;
865
+ host_cpu_usage_pct: TrainingResourceValueSummary | null;
866
+ host_cpu_limit_cores: number | null;
867
+ disk_used_gib: TrainingResourceValueSummary | null;
868
+ disk_total_gib: number | null;
869
+ gpus: TrainingDeviceResourceSummary[];
870
+ }
871
+ export interface TrainingMetricSummary {
872
+ key: string;
873
+ label: string;
874
+ unit: string;
875
+ goal: 'minimize' | 'maximize' | 'schedule' | 'progress' | 'observe' | string;
876
+ points: number;
877
+ first: number;
878
+ latest: number;
879
+ minimum: number;
880
+ maximum: number;
881
+ average: number;
882
+ change: number;
883
+ change_percent?: number;
884
+ first_step: number;
885
+ last_step: number;
886
+ best?: number;
887
+ best_step?: number;
888
+ }
889
+ export interface TrainingSeriesMeta {
890
+ view: 'full' | 'series' | 'summary';
891
+ x_axis: 'step';
892
+ included: boolean;
893
+ total_points: number;
894
+ returned_points: number;
895
+ downsampled: boolean;
896
+ sampling: 'none' | 'uniform';
897
+ }
898
+ export interface TrainingMetricsOptions {
899
+ view?: 'full' | 'series' | 'summary';
900
+ maxPoints?: number;
901
+ }
902
+ export interface TrainingMetricsRunContext {
903
+ status: string;
904
+ training_method?: string | null;
905
+ rlhf_type?: string | null;
906
+ train_type: string;
907
+ model_id: string;
908
+ model_revision: string;
909
+ current_step: number;
910
+ total_steps: number;
911
+ gpu_type: string;
912
+ gpu_count: number;
913
+ parameters: Record<string, unknown>;
914
+ omitted_parameter_keys: string[];
915
+ }
840
916
  /** Training metrics for a job. */
841
917
  export interface TrainingMetrics {
842
918
  metrics: MetricPoint[];
843
919
  training_method?: string | null;
844
920
  rlhf_type?: string | null;
845
921
  graph_configs: MetricGraphConfig[];
922
+ metric_summaries?: TrainingMetricSummary[];
846
923
  resource_metrics?: TrainingResourceMetrics | null;
924
+ resource_summary?: TrainingResourceSummary | null;
925
+ series_meta?: TrainingSeriesMeta;
926
+ run_context?: TrainingMetricsRunContext;
847
927
  /** @deprecated Use metrics. Populated as a compatibility alias. */
848
928
  steps?: MetricPoint[];
849
929
  }
@@ -867,6 +947,8 @@ export interface MetricGraphConfig {
867
947
  key: string;
868
948
  label: string;
869
949
  color: string;
950
+ unit?: string;
951
+ goal?: string;
870
952
  }
871
953
  /** A training checkpoint. */
872
954
  export interface TrainingCheckpoint {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runbios-sdk",
3
- "version": "0.2.6-rc.201",
3
+ "version": "0.2.7-dev.202",
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",