bios-sdk 0.1.1-dev.10 → 0.1.1-dev.13
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/dist/client.d.ts +31 -1
- package/dist/client.js +34 -0
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +21 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BiOSConfig, ApiErrorBody } from './types.js';
|
|
1
|
+
import type { BiOSConfig, ApiErrorBody, AvailableGpuAlternative } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Typed error thrown by every SDK method when the API returns a non-2xx status.
|
|
4
4
|
*
|
|
@@ -12,6 +12,22 @@ import type { BiOSConfig, ApiErrorBody } from './types.js';
|
|
|
12
12
|
* }
|
|
13
13
|
* }
|
|
14
14
|
* ```
|
|
15
|
+
*
|
|
16
|
+
* Availability rejections are self-recoverable: when the selected GPU is no
|
|
17
|
+
* longer bookable at submit time the API answers 409 with a machine code and
|
|
18
|
+
* the currently bookable alternatives, and the SDK surfaces them typed:
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* try {
|
|
23
|
+
* await client.training.create({ ...req, gpu_type: 'A100_80GB' });
|
|
24
|
+
* } catch (err) {
|
|
25
|
+
* if (err instanceof ApiError && err.code === 'SELECTED_GPU_UNAVAILABLE') {
|
|
26
|
+
* const next = err.availableGpus?.[0];
|
|
27
|
+
* if (next) await client.training.create({ ...req, gpu_type: next.gpu_type });
|
|
28
|
+
* }
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
15
31
|
*/
|
|
16
32
|
export declare class ApiError extends Error {
|
|
17
33
|
/** HTTP status code (e.g. 401, 404, 500). */
|
|
@@ -20,6 +36,20 @@ export declare class ApiError extends Error {
|
|
|
20
36
|
readonly code: string | undefined;
|
|
21
37
|
/** Server-assigned request ID for support / debugging. */
|
|
22
38
|
readonly requestId: string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* The full parsed error response body. Availability rejections carry
|
|
41
|
+
* structured recovery data here (`available_gpus`, `checked_at`).
|
|
42
|
+
*/
|
|
43
|
+
readonly body: ApiErrorBody;
|
|
44
|
+
/**
|
|
45
|
+
* Bookable-now GPU alternatives on availability rejections
|
|
46
|
+
* (SELECTED_GPU_UNAVAILABLE / CAPACITY_UNAVAILABLE); undefined otherwise.
|
|
47
|
+
* Every entry fit the requested model when `checkedAt` was stamped —
|
|
48
|
+
* resubmit with one of these and nothing else changed.
|
|
49
|
+
*/
|
|
50
|
+
readonly availableGpus: AvailableGpuAlternative[] | undefined;
|
|
51
|
+
/** Availability snapshot time behind an availability rejection. */
|
|
52
|
+
readonly checkedAt: string | undefined;
|
|
23
53
|
constructor(status: number, body: ApiErrorBody);
|
|
24
54
|
}
|
|
25
55
|
/** Default API key from `BIOS_API_KEY` when the config omits one. @internal */
|
package/dist/client.js
CHANGED
|
@@ -15,6 +15,22 @@ import { VERSION } from './index.js';
|
|
|
15
15
|
* }
|
|
16
16
|
* }
|
|
17
17
|
* ```
|
|
18
|
+
*
|
|
19
|
+
* Availability rejections are self-recoverable: when the selected GPU is no
|
|
20
|
+
* longer bookable at submit time the API answers 409 with a machine code and
|
|
21
|
+
* the currently bookable alternatives, and the SDK surfaces them typed:
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* try {
|
|
26
|
+
* await client.training.create({ ...req, gpu_type: 'A100_80GB' });
|
|
27
|
+
* } catch (err) {
|
|
28
|
+
* if (err instanceof ApiError && err.code === 'SELECTED_GPU_UNAVAILABLE') {
|
|
29
|
+
* const next = err.availableGpus?.[0];
|
|
30
|
+
* if (next) await client.training.create({ ...req, gpu_type: next.gpu_type });
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
18
34
|
*/
|
|
19
35
|
export class ApiError extends Error {
|
|
20
36
|
/** HTTP status code (e.g. 401, 404, 500). */
|
|
@@ -23,6 +39,20 @@ export class ApiError extends Error {
|
|
|
23
39
|
code;
|
|
24
40
|
/** Server-assigned request ID for support / debugging. */
|
|
25
41
|
requestId;
|
|
42
|
+
/**
|
|
43
|
+
* The full parsed error response body. Availability rejections carry
|
|
44
|
+
* structured recovery data here (`available_gpus`, `checked_at`).
|
|
45
|
+
*/
|
|
46
|
+
body;
|
|
47
|
+
/**
|
|
48
|
+
* Bookable-now GPU alternatives on availability rejections
|
|
49
|
+
* (SELECTED_GPU_UNAVAILABLE / CAPACITY_UNAVAILABLE); undefined otherwise.
|
|
50
|
+
* Every entry fit the requested model when `checkedAt` was stamped —
|
|
51
|
+
* resubmit with one of these and nothing else changed.
|
|
52
|
+
*/
|
|
53
|
+
availableGpus;
|
|
54
|
+
/** Availability snapshot time behind an availability rejection. */
|
|
55
|
+
checkedAt;
|
|
26
56
|
constructor(status, body) {
|
|
27
57
|
const err = body.error;
|
|
28
58
|
const nested = typeof err === 'object' && err !== null ? err : null;
|
|
@@ -36,6 +66,10 @@ export class ApiError extends Error {
|
|
|
36
66
|
this.status = status;
|
|
37
67
|
this.code = (nested ? String(nested.code || '') : body.code) || undefined;
|
|
38
68
|
this.requestId = body.request_id;
|
|
69
|
+
this.body = body;
|
|
70
|
+
const alts = body.available_gpus ?? body.available_alternatives;
|
|
71
|
+
this.availableGpus = Array.isArray(alts) && alts.length > 0 ? alts : undefined;
|
|
72
|
+
this.checkedAt = body.checked_at;
|
|
39
73
|
}
|
|
40
74
|
}
|
|
41
75
|
// ============================================================================
|
package/dist/index.d.ts
CHANGED
|
@@ -63,4 +63,4 @@ export { Training } from './resources/training.js';
|
|
|
63
63
|
export { Wallet } from './resources/wallet.js';
|
|
64
64
|
export { GPU, type GPURecommendation } from './resources/gpu.js';
|
|
65
65
|
export { Inference, validateChatRequest, parseSSE, type ChatMessage, type FunctionTool, type ChatCompletionParams, type ChatCompletionResponse, type ChatCompletionChunk, } from './resources/inference.js';
|
|
66
|
-
export type { BiOSConfig, PaginatedResponse, ApiErrorBody, Model, ModelSearchParams, ModelSearchResponse, 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, TransactionListParams, GPUInfo, GPUPricingResponse, GPUOptionsParams, GPUOption, GPUOptionSuggestion, GPUOptionsResponse, InferenceStatus, InferenceCreateParams, InferenceUpdateParams, InferenceDeployment, 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, } from './types.js';
|
|
66
|
+
export type { BiOSConfig, PaginatedResponse, ApiErrorBody, AvailableGpuAlternative, Model, ModelSearchParams, ModelSearchResponse, 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, TransactionListParams, GPUInfo, GPUPricingResponse, GPUOptionsParams, GPUOption, GPUOptionSuggestion, GPUOptionsResponse, InferenceStatus, InferenceCreateParams, InferenceUpdateParams, InferenceDeployment, 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, } from './types.js';
|
package/dist/types.d.ts
CHANGED
|
@@ -38,6 +38,27 @@ export interface ApiErrorBody {
|
|
|
38
38
|
message?: string;
|
|
39
39
|
code?: string;
|
|
40
40
|
request_id?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Bookable-now GPU alternatives, present on availability rejections
|
|
43
|
+
* (SELECTED_GPU_UNAVAILABLE / CAPACITY_UNAVAILABLE): each entry fits the
|
|
44
|
+
* requested model's minimum requirements and was in stock at `checked_at`.
|
|
45
|
+
* Pick one and resubmit — nothing else about the request needs to change.
|
|
46
|
+
*/
|
|
47
|
+
available_gpus?: AvailableGpuAlternative[];
|
|
48
|
+
/** Same contract as `available_gpus`; some surfaces use this field name. */
|
|
49
|
+
available_alternatives?: AvailableGpuAlternative[];
|
|
50
|
+
/** When the availability snapshot behind the rejection was taken. */
|
|
51
|
+
checked_at?: string;
|
|
52
|
+
}
|
|
53
|
+
/** One bookable-now GPU alternative carried on an availability rejection. */
|
|
54
|
+
export interface AvailableGpuAlternative {
|
|
55
|
+
gpu_type: string;
|
|
56
|
+
gpu_count?: number;
|
|
57
|
+
available_count?: number;
|
|
58
|
+
price_per_hour_cents?: number;
|
|
59
|
+
provider?: string;
|
|
60
|
+
region?: string;
|
|
61
|
+
tier?: string;
|
|
41
62
|
}
|
|
42
63
|
/** A model returned from the HuggingFace-backed model search. */
|
|
43
64
|
export interface Model {
|