runbios-sdk 0.2.1-dev.62
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 +460 -0
- package/dist/client.d.ts +202 -0
- package/dist/client.js +408 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.js +93 -0
- package/dist/resources/datasets.d.ts +180 -0
- package/dist/resources/datasets.js +358 -0
- package/dist/resources/gpu-priorities.d.ts +23 -0
- package/dist/resources/gpu-priorities.js +63 -0
- package/dist/resources/gpu.d.ts +60 -0
- package/dist/resources/gpu.js +101 -0
- package/dist/resources/inference.d.ts +224 -0
- package/dist/resources/inference.js +794 -0
- package/dist/resources/models.d.ts +113 -0
- package/dist/resources/models.js +171 -0
- package/dist/resources/training.d.ts +166 -0
- package/dist/resources/training.js +419 -0
- package/dist/resources/wallet.d.ts +53 -0
- package/dist/resources/wallet.js +61 -0
- package/dist/types.d.ts +1916 -0
- package/dist/types.js +4 -0
- package/package.json +52 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import type { ModelDetailResponse, ModelSearchParams, ModelSearchResponse, ModelConfig, AdapterCompatibilityParams, AdapterCompatibilityResponse, ArchitectureScope, SupportedArchitecturesResponse } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Access the Run BiOS model catalog -- search models, fetch
|
|
5
|
+
* training-relevant configuration, and check adapter compatibility.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Models {
|
|
8
|
+
private readonly _http;
|
|
9
|
+
/** @internal */
|
|
10
|
+
constructor(_http: HttpClient);
|
|
11
|
+
/**
|
|
12
|
+
* Search the Run BiOS model catalog -- the platform's own hosted, verified
|
|
13
|
+
* models. Every result is mirrored in Run BiOS storage and can be trained and
|
|
14
|
+
* deployed; this is never a live Hugging Face search. A model that is not
|
|
15
|
+
* listed here is not hosted on Run BiOS yet.
|
|
16
|
+
*
|
|
17
|
+
* Reads the registry endpoint `GET /api/models` DIRECTLY. Each result is the
|
|
18
|
+
* registry's own snake_case row plus `maxContext` (the native context window
|
|
19
|
+
* that caps a deployment's `contextLength`) and `weightBytes`. Note that `id`
|
|
20
|
+
* is the registry UUID -- the model HANDLE you pass to training and
|
|
21
|
+
* deployment is `repo_id`.
|
|
22
|
+
*
|
|
23
|
+
* `query` becomes the registry's `q` filter, the only search parameter it
|
|
24
|
+
* reads. The deprecated `author` / `visibility` / `kind` / `integrationId`
|
|
25
|
+
* filters are ignored by the registry and are no longer sent.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const res = await client.models.search({ query: 'llama', type: 'llm', limit: 10 });
|
|
30
|
+
* for (const m of res.models) {
|
|
31
|
+
* console.log(`${m.repo_id} -- ${m.params_total_b}B params, ${m.maxContext} ctx`);
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
search(params?: ModelSearchParams): Promise<ModelSearchResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Fetch one catalog model by its `author/name` handle.
|
|
38
|
+
*
|
|
39
|
+
* The model block carries `maxContext` (the native context window that caps
|
|
40
|
+
* `contextLength` on a deployment) and `weightBytes` (on-disk weight size),
|
|
41
|
+
* both absent for partner/private models.
|
|
42
|
+
*/
|
|
43
|
+
get(modelId: string): Promise<ModelDetailResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* Native max context window in tokens, or undefined when not recorded.
|
|
46
|
+
*
|
|
47
|
+
* This is the ceiling a deployment's `contextLength` can never exceed.
|
|
48
|
+
* `undefined` means UNKNOWN (unreachable registry, unlisted model, or a
|
|
49
|
+
* partner model with the fact stripped) -- never treat it as zero.
|
|
50
|
+
*/
|
|
51
|
+
nativeMaxContext(modelId: string): Promise<number | undefined>;
|
|
52
|
+
/**
|
|
53
|
+
* Fetch the training configuration for a specific model from the catalog.
|
|
54
|
+
*
|
|
55
|
+
* Returns parameter counts, architecture type, and whether the model
|
|
56
|
+
* uses Mixture-of-Experts -- information needed to choose the right
|
|
57
|
+
* GPU and adapter configuration.
|
|
58
|
+
*
|
|
59
|
+
* @param modelId - Full model id (e.g. "meta-llama/Llama-3.1-8B").
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const config = await client.models.getConfig('meta-llama/Llama-3.1-8B');
|
|
64
|
+
* console.log(`${config.totalParams}B params, MoE: ${config.isMoE}`);
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
getConfig(modelId: string): Promise<ModelConfig>;
|
|
68
|
+
/**
|
|
69
|
+
* Check which adapters are compatible with a given architecture,
|
|
70
|
+
* training method, and (optionally) RLHF algorithm.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const compat = await client.models.getAdapterCompatibility({
|
|
75
|
+
* modelType: 'llama',
|
|
76
|
+
* trainingMethod: 'rlhf',
|
|
77
|
+
* rlhfAlgorithm: 'dpo',
|
|
78
|
+
* });
|
|
79
|
+
* const usable = compat.adapters.filter(a => a.compatible);
|
|
80
|
+
* console.log(`${usable.length} compatible adapters`);
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
getAdapterCompatibility(params?: AdapterCompatibilityParams): Promise<AdapterCompatibilityResponse>;
|
|
84
|
+
/**
|
|
85
|
+
* List the architectures the platform supports for a given scope. This is
|
|
86
|
+
* the authoritative registry the platform gates on:
|
|
87
|
+
* - `inference` — architecture classes that can be served (deployed).
|
|
88
|
+
* - `training` — architecture keys the fine-tuning wizard/gate accepts.
|
|
89
|
+
*
|
|
90
|
+
* A `count` of 0 means the registry is empty and nothing is explicitly
|
|
91
|
+
* restricted (every architecture the engine supports is allowed).
|
|
92
|
+
*
|
|
93
|
+
* ```ts
|
|
94
|
+
* const { architectures } = await client.models.getSupportedArchitectures({ scope: 'inference' });
|
|
95
|
+
* const servable = architectures.filter(a => a.enabled).map(a => a.architecture);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
getSupportedArchitectures(params?: {
|
|
99
|
+
scope?: ArchitectureScope;
|
|
100
|
+
}): Promise<SupportedArchitecturesResponse>;
|
|
101
|
+
}
|
|
102
|
+
/** Registry detail path for an `author/name` catalog id, else undefined. @internal */
|
|
103
|
+
export declare function modelDetailPath(modelId: string): string | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Native max context window (tokens) for a catalog model, or undefined.
|
|
106
|
+
*
|
|
107
|
+
* Reads the registry directly (`GET /api/models/{author}/{name}` ->
|
|
108
|
+
* `model.maxContext`). Returns undefined for anything that is not an ANSWER: an
|
|
109
|
+
* id that is not `author/name`, an unreachable registry, a model the registry
|
|
110
|
+
* does not carry, or a model whose native window is not recorded. Callers MUST
|
|
111
|
+
* treat undefined as UNKNOWN and never as a rejection. @internal
|
|
112
|
+
*/
|
|
113
|
+
export declare function readNativeMaxContext(http: HttpClient, modelId: string): Promise<number | undefined>;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Access the Run BiOS model catalog -- search models, fetch
|
|
3
|
+
* training-relevant configuration, and check adapter compatibility.
|
|
4
|
+
*/
|
|
5
|
+
export class Models {
|
|
6
|
+
_http;
|
|
7
|
+
/** @internal */
|
|
8
|
+
constructor(_http) {
|
|
9
|
+
this._http = _http;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Search the Run BiOS model catalog -- the platform's own hosted, verified
|
|
13
|
+
* models. Every result is mirrored in Run BiOS storage and can be trained and
|
|
14
|
+
* deployed; this is never a live Hugging Face search. A model that is not
|
|
15
|
+
* listed here is not hosted on Run BiOS yet.
|
|
16
|
+
*
|
|
17
|
+
* Reads the registry endpoint `GET /api/models` DIRECTLY. Each result is the
|
|
18
|
+
* registry's own snake_case row plus `maxContext` (the native context window
|
|
19
|
+
* that caps a deployment's `contextLength`) and `weightBytes`. Note that `id`
|
|
20
|
+
* is the registry UUID -- the model HANDLE you pass to training and
|
|
21
|
+
* deployment is `repo_id`.
|
|
22
|
+
*
|
|
23
|
+
* `query` becomes the registry's `q` filter, the only search parameter it
|
|
24
|
+
* reads. The deprecated `author` / `visibility` / `kind` / `integrationId`
|
|
25
|
+
* filters are ignored by the registry and are no longer sent.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const res = await client.models.search({ query: 'llama', type: 'llm', limit: 10 });
|
|
30
|
+
* for (const m of res.models) {
|
|
31
|
+
* console.log(`${m.repo_id} -- ${m.params_total_b}B params, ${m.maxContext} ctx`);
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
async search(params = {}) {
|
|
36
|
+
const q = new URLSearchParams();
|
|
37
|
+
if (params.query)
|
|
38
|
+
q.set('q', params.query);
|
|
39
|
+
if (params.type)
|
|
40
|
+
q.set('type', params.type);
|
|
41
|
+
if (params.offset !== undefined)
|
|
42
|
+
q.set('offset', String(params.offset));
|
|
43
|
+
if (params.limit !== undefined)
|
|
44
|
+
q.set('limit', String(params.limit));
|
|
45
|
+
if (params.minParams !== undefined)
|
|
46
|
+
q.set('min_params', String(params.minParams));
|
|
47
|
+
if (params.maxParams !== undefined)
|
|
48
|
+
q.set('max_params', String(params.maxParams));
|
|
49
|
+
if (params.sort)
|
|
50
|
+
q.set('sort', params.sort);
|
|
51
|
+
return this._http.fetchGet(`/api/models?${q}`);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Fetch one catalog model by its `author/name` handle.
|
|
55
|
+
*
|
|
56
|
+
* The model block carries `maxContext` (the native context window that caps
|
|
57
|
+
* `contextLength` on a deployment) and `weightBytes` (on-disk weight size),
|
|
58
|
+
* both absent for partner/private models.
|
|
59
|
+
*/
|
|
60
|
+
async get(modelId) {
|
|
61
|
+
const path = modelDetailPath(modelId);
|
|
62
|
+
if (!path)
|
|
63
|
+
throw new Error('RunBiOS: modelId must be a catalog handle of the form author/name');
|
|
64
|
+
return this._http.fetchGet(path);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Native max context window in tokens, or undefined when not recorded.
|
|
68
|
+
*
|
|
69
|
+
* This is the ceiling a deployment's `contextLength` can never exceed.
|
|
70
|
+
* `undefined` means UNKNOWN (unreachable registry, unlisted model, or a
|
|
71
|
+
* partner model with the fact stripped) -- never treat it as zero.
|
|
72
|
+
*/
|
|
73
|
+
async nativeMaxContext(modelId) {
|
|
74
|
+
return readNativeMaxContext(this._http, modelId);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Fetch the training configuration for a specific model from the catalog.
|
|
78
|
+
*
|
|
79
|
+
* Returns parameter counts, architecture type, and whether the model
|
|
80
|
+
* uses Mixture-of-Experts -- information needed to choose the right
|
|
81
|
+
* GPU and adapter configuration.
|
|
82
|
+
*
|
|
83
|
+
* @param modelId - Full model id (e.g. "meta-llama/Llama-3.1-8B").
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const config = await client.models.getConfig('meta-llama/Llama-3.1-8B');
|
|
88
|
+
* console.log(`${config.totalParams}B params, MoE: ${config.isMoE}`);
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
async getConfig(modelId) {
|
|
92
|
+
return this._http.fetchGet(`/api/public/model-config?id=${encodeURIComponent(modelId)}`);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Check which adapters are compatible with a given architecture,
|
|
96
|
+
* training method, and (optionally) RLHF algorithm.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* const compat = await client.models.getAdapterCompatibility({
|
|
101
|
+
* modelType: 'llama',
|
|
102
|
+
* trainingMethod: 'rlhf',
|
|
103
|
+
* rlhfAlgorithm: 'dpo',
|
|
104
|
+
* });
|
|
105
|
+
* const usable = compat.adapters.filter(a => a.compatible);
|
|
106
|
+
* console.log(`${usable.length} compatible adapters`);
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
async getAdapterCompatibility(params = {}) {
|
|
110
|
+
const q = new URLSearchParams();
|
|
111
|
+
if (params.architecture)
|
|
112
|
+
q.set('architecture', params.architecture);
|
|
113
|
+
if (params.modelType)
|
|
114
|
+
q.set('model_type', params.modelType);
|
|
115
|
+
if (params.trainingMethod)
|
|
116
|
+
q.set('training_method', params.trainingMethod);
|
|
117
|
+
if (params.rlhfAlgorithm)
|
|
118
|
+
q.set('rlhf_algorithm', params.rlhfAlgorithm);
|
|
119
|
+
return this._http.fetchGet(`/api/public/adapter-compatibility?${q}`);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* List the architectures the platform supports for a given scope. This is
|
|
123
|
+
* the authoritative registry the platform gates on:
|
|
124
|
+
* - `inference` — architecture classes that can be served (deployed).
|
|
125
|
+
* - `training` — architecture keys the fine-tuning wizard/gate accepts.
|
|
126
|
+
*
|
|
127
|
+
* A `count` of 0 means the registry is empty and nothing is explicitly
|
|
128
|
+
* restricted (every architecture the engine supports is allowed).
|
|
129
|
+
*
|
|
130
|
+
* ```ts
|
|
131
|
+
* const { architectures } = await client.models.getSupportedArchitectures({ scope: 'inference' });
|
|
132
|
+
* const servable = architectures.filter(a => a.enabled).map(a => a.architecture);
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
async getSupportedArchitectures(params = {}) {
|
|
136
|
+
const q = new URLSearchParams();
|
|
137
|
+
q.set('scope', params.scope ?? 'inference');
|
|
138
|
+
return this._http.fetchGet(`/api/public/serving-architectures?${q}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/** Registry detail path for an `author/name` catalog id, else undefined. @internal */
|
|
142
|
+
export function modelDetailPath(modelId) {
|
|
143
|
+
const repo = (modelId || '').trim().replace(/^\/+|\/+$/g, '');
|
|
144
|
+
const parts = repo.split('/');
|
|
145
|
+
if (parts.length !== 2 || !parts[0] || !parts[1])
|
|
146
|
+
return undefined;
|
|
147
|
+
return `/api/models/${encodeURIComponent(parts[0])}/${encodeURIComponent(parts[1])}`;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Native max context window (tokens) for a catalog model, or undefined.
|
|
151
|
+
*
|
|
152
|
+
* Reads the registry directly (`GET /api/models/{author}/{name}` ->
|
|
153
|
+
* `model.maxContext`). Returns undefined for anything that is not an ANSWER: an
|
|
154
|
+
* id that is not `author/name`, an unreachable registry, a model the registry
|
|
155
|
+
* does not carry, or a model whose native window is not recorded. Callers MUST
|
|
156
|
+
* treat undefined as UNKNOWN and never as a rejection. @internal
|
|
157
|
+
*/
|
|
158
|
+
export async function readNativeMaxContext(http, modelId) {
|
|
159
|
+
const path = modelDetailPath(modelId);
|
|
160
|
+
if (!path)
|
|
161
|
+
return undefined;
|
|
162
|
+
let response;
|
|
163
|
+
try {
|
|
164
|
+
response = await http.fetchGet(path);
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
return undefined;
|
|
168
|
+
}
|
|
169
|
+
const native = response?.model?.maxContext;
|
|
170
|
+
return typeof native === 'number' && Number.isFinite(native) && native > 0 ? native : undefined;
|
|
171
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import type { HttpClient } from '../client.js';
|
|
2
|
+
import type { TrainingCreateParams, TrainingListParams, TrainingJob, TrainingListResponse, TrainingMetrics, TrainingCheckpoint, TrainingLogs, TrainingStopResponse, TrainingResumeResponse, TrainingPreflightResponse, TrainingCapabilities } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Create, monitor, and manage fine-tuning training jobs.
|
|
5
|
+
*/
|
|
6
|
+
export declare class Training {
|
|
7
|
+
private readonly _http;
|
|
8
|
+
/** @internal */
|
|
9
|
+
constructor(_http: HttpClient);
|
|
10
|
+
/** Return the authoritative method, adapter, and hyperparameter contract Run BiOS trains against. */
|
|
11
|
+
capabilities(): Promise<TrainingCapabilities>;
|
|
12
|
+
/**
|
|
13
|
+
* Create a new training job (book-before-reveal).
|
|
14
|
+
*
|
|
15
|
+
* The call blocks while the ranked GPU ladder is booked (~40s typical). A
|
|
16
|
+
* training id and the "training started" email exist only once a real machine is
|
|
17
|
+
* secured, so the returned `status` is one of:
|
|
18
|
+
*
|
|
19
|
+
* - `"booked"` — a GPU was secured (booked == secured); the job then
|
|
20
|
+
* progresses through provisioning, downloading, and running on its own.
|
|
21
|
+
* - `"securing"` — still booking at the deadline; the async tail continues.
|
|
22
|
+
* Poll {@link get} until it reaches `booked`/`running` (or terminal).
|
|
23
|
+
* Nothing is charged until a machine is real.
|
|
24
|
+
* - `"queued"` — returned only with explicit queue consent
|
|
25
|
+
* (`queueIfUnavailable: true`); waits for stock at zero charge and books
|
|
26
|
+
* via the same path.
|
|
27
|
+
*
|
|
28
|
+
* If the ladder is exhausted at booking time without queue consent, this
|
|
29
|
+
* rejects with a `CAPACITY_UNAVAILABLE` (HTTP 409) carrying neutral
|
|
30
|
+
* alternatives — no phantom job remains and nothing is billed. The SDK never
|
|
31
|
+
* auto-substitutes a GPU; a transient 503 is a retry, never a capacity
|
|
32
|
+
* verdict.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const job = await client.training.create({
|
|
37
|
+
* model: 'meta-llama/Llama-3.1-8B-Instruct',
|
|
38
|
+
* datasetId: 'ds_abc123',
|
|
39
|
+
* method: 'sft',
|
|
40
|
+
* adapter: 'lora',
|
|
41
|
+
* epochs: 3,
|
|
42
|
+
* learningRate: 2e-4,
|
|
43
|
+
* loraRank: 16,
|
|
44
|
+
* loraAlpha: 32,
|
|
45
|
+
* gpuType: 'A100_80GB',
|
|
46
|
+
* gpuCount: 1,
|
|
47
|
+
* });
|
|
48
|
+
* console.log(`Job ${job.id} created -- status: ${job.status}`);
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
create(params: TrainingCreateParams): Promise<TrainingJob>;
|
|
52
|
+
/** Validate and canonicalize a training request without creating or billing a job. */
|
|
53
|
+
preflight(params: TrainingCreateParams): Promise<TrainingPreflightResponse>;
|
|
54
|
+
/** Return one server-driven page with pagination metadata. */
|
|
55
|
+
listPage(params?: TrainingListParams): Promise<TrainingListResponse>;
|
|
56
|
+
/**
|
|
57
|
+
* List training jobs, optionally filtered by workspace or status.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* const jobs = await client.training.list({ status: 'running' });
|
|
62
|
+
* for (const job of jobs) {
|
|
63
|
+
* console.log(`${job.id} -- ${job.model} -- ${job.status}`);
|
|
64
|
+
* }
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
list(params?: TrainingListParams): Promise<TrainingJob[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Get detailed information about a training job.
|
|
70
|
+
*
|
|
71
|
+
* @param id - Training job ID.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* const job = await client.training.get('job_abc123');
|
|
76
|
+
* console.log(`Status: ${job.status}, Progress: ${job.progress}%`);
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
get(id: string): Promise<TrainingJob>;
|
|
80
|
+
/**
|
|
81
|
+
* Get training metrics (loss curves, learning rate, throughput) for a job.
|
|
82
|
+
*
|
|
83
|
+
* @param id - Training job ID.
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```ts
|
|
87
|
+
* const metrics = await client.training.getMetrics('job_abc123');
|
|
88
|
+
* console.log(`Current loss: ${metrics.metrics.at(-1)?.loss}`);
|
|
89
|
+
* console.log(`${metrics.metrics.length} metric points`);
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
getMetrics(id: string): Promise<TrainingMetrics>;
|
|
93
|
+
/**
|
|
94
|
+
* List checkpoints saved during training.
|
|
95
|
+
*
|
|
96
|
+
* @param id - Training job ID.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* const checkpoints = await client.training.getCheckpoints('job_abc123');
|
|
101
|
+
* for (const cp of checkpoints) {
|
|
102
|
+
* console.log(`${cp.name}: ${cp.size_bytes} bytes`);
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
getCheckpoints(id: string): Promise<TrainingCheckpoint[]>;
|
|
107
|
+
/**
|
|
108
|
+
* Get training logs for a job.
|
|
109
|
+
*
|
|
110
|
+
* @param id - Training job ID.
|
|
111
|
+
* @param tail - Maximum newest entries to return (server clamps to 1-1000).
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* const logs = await client.training.getLogs('job_abc123');
|
|
116
|
+
* for (const entry of logs.logs) {
|
|
117
|
+
* console.log(entry.level, entry.message);
|
|
118
|
+
* }
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
getLogs(id: string, tail?: number): Promise<TrainingLogs>;
|
|
122
|
+
/**
|
|
123
|
+
* Stop a running training job.
|
|
124
|
+
*
|
|
125
|
+
* By default, intermediate data (checkpoints, logs) is preserved.
|
|
126
|
+
* Pass `keepData: false` to clean up all job artifacts.
|
|
127
|
+
*
|
|
128
|
+
* @param id - Training job ID.
|
|
129
|
+
* @param keepData - Whether to keep checkpoints and logs. Defaults to true.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* await client.training.stop('job_abc123');
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
stop(id: string, keepData?: boolean): Promise<TrainingStopResponse>;
|
|
137
|
+
/**
|
|
138
|
+
* Resume a stopped or `interrupted` training job from its last checkpoint.
|
|
139
|
+
*
|
|
140
|
+
* Use this on a `stopped` job, or one resting at `interrupted` — the
|
|
141
|
+
* self-heal state a started job enters when its machine is lost and billing has
|
|
142
|
+
* already been stopped (distinct from `failed`). Resume re-books on secured
|
|
143
|
+
* capacity before reporting resumed, so book-before-reveal still applies.
|
|
144
|
+
*
|
|
145
|
+
* @param id - Training job ID.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* await client.training.resume('job_abc123');
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
resume(id: string, idempotencyKey?: string): Promise<TrainingResumeResponse>;
|
|
153
|
+
/**
|
|
154
|
+
* Delete a specific checkpoint from a training job.
|
|
155
|
+
*
|
|
156
|
+
* @param jobId - Training job ID.
|
|
157
|
+
* @param checkpointId - Checkpoint ID to delete.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* await client.training.deleteCheckpoint('job_abc123', 'cp_xyz789');
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
getEvals(id: string): Promise<Record<string, unknown>>;
|
|
165
|
+
deleteCheckpoint(jobId: string, checkpointId: string): Promise<void>;
|
|
166
|
+
}
|