bios-sdk 0.1.1-rc.14 → 0.1.1
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 +1 -31
- package/dist/client.js +1 -35
- package/dist/index.d.ts +1 -1
- package/dist/resources/inference.js +1 -1
- package/dist/types.d.ts +2 -23
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BiOSConfig, ApiErrorBody
|
|
1
|
+
import type { BiOSConfig, ApiErrorBody } 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,22 +12,6 @@ import type { BiOSConfig, ApiErrorBody, AvailableGpuAlternative } from './types.
|
|
|
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
|
-
* ```
|
|
31
15
|
*/
|
|
32
16
|
export declare class ApiError extends Error {
|
|
33
17
|
/** HTTP status code (e.g. 401, 404, 500). */
|
|
@@ -36,20 +20,6 @@ export declare class ApiError extends Error {
|
|
|
36
20
|
readonly code: string | undefined;
|
|
37
21
|
/** Server-assigned request ID for support / debugging. */
|
|
38
22
|
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;
|
|
53
23
|
constructor(status: number, body: ApiErrorBody);
|
|
54
24
|
}
|
|
55
25
|
/** Default API key from `BIOS_API_KEY` when the config omits one. @internal */
|
package/dist/client.js
CHANGED
|
@@ -15,22 +15,6 @@ 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
|
-
* ```
|
|
34
18
|
*/
|
|
35
19
|
export class ApiError extends Error {
|
|
36
20
|
/** HTTP status code (e.g. 401, 404, 500). */
|
|
@@ -39,20 +23,6 @@ export class ApiError extends Error {
|
|
|
39
23
|
code;
|
|
40
24
|
/** Server-assigned request ID for support / debugging. */
|
|
41
25
|
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;
|
|
56
26
|
constructor(status, body) {
|
|
57
27
|
const err = body.error;
|
|
58
28
|
const nested = typeof err === 'object' && err !== null ? err : null;
|
|
@@ -66,10 +36,6 @@ export class ApiError extends Error {
|
|
|
66
36
|
this.status = status;
|
|
67
37
|
this.code = (nested ? String(nested.code || '') : body.code) || undefined;
|
|
68
38
|
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;
|
|
73
39
|
}
|
|
74
40
|
}
|
|
75
41
|
// ============================================================================
|
|
@@ -104,7 +70,7 @@ export class HttpClient {
|
|
|
104
70
|
workspaceIdValue;
|
|
105
71
|
timeout;
|
|
106
72
|
constructor(config) {
|
|
107
|
-
this.baseUrl = (config.baseUrl || envBaseUrl() || 'https://api
|
|
73
|
+
this.baseUrl = (config.baseUrl || envBaseUrl() || 'https://api.usbios.ai').replace(/\/+$/, '');
|
|
108
74
|
this.apiKey = config.apiKey ?? envApiKey();
|
|
109
75
|
this.accessToken = config.accessToken;
|
|
110
76
|
this.orgId = config.orgId;
|
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,
|
|
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';
|
|
@@ -280,7 +280,7 @@ export class Inference {
|
|
|
280
280
|
_http;
|
|
281
281
|
constructor(config = {}, http) {
|
|
282
282
|
this.key = config.inferenceKey;
|
|
283
|
-
this.baseUrl = (config.baseUrl || envBaseUrl() || 'https://api
|
|
283
|
+
this.baseUrl = (config.baseUrl || envBaseUrl() || 'https://api.usbios.ai').replace(/\/+$/, '');
|
|
284
284
|
this.timeout = config.timeout ?? 900_000;
|
|
285
285
|
this._http = http;
|
|
286
286
|
}
|
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 BIOS_BASE_URL environment variable, then the canonical https://api
|
|
11
|
+
/** Base URL for the API. Falls back to the BIOS_BASE_URL environment variable, then the canonical https://api.usbios.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
|
|
17
|
+
/** Inference base URL. Defaults to baseUrl, then https://api.usbios.ai. */
|
|
18
18
|
inferenceBaseUrl?: string;
|
|
19
19
|
/** End-to-end inference timeout in milliseconds. Defaults to 15 minutes. */
|
|
20
20
|
inferenceTimeout?: number;
|
|
@@ -38,27 +38,6 @@ 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;
|
|
62
41
|
}
|
|
63
42
|
/** A model returned from the HuggingFace-backed model search. */
|
|
64
43
|
export interface Model {
|