@gpuai/sdk 0.3.8 → 0.3.9
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 +3 -2
- package/dist/apis/FineTuningApi.d.ts +17 -0
- package/dist/apis/FineTuningApi.js +48 -0
- package/dist/esm/apis/FineTuningApi.d.ts +17 -0
- package/dist/esm/apis/FineTuningApi.js +48 -0
- package/dist/esm/models/Model.d.ts +12 -0
- package/dist/esm/models/Model.js +4 -0
- package/dist/models/Model.d.ts +12 -0
- package/dist/models/Model.js +4 -0
- package/docs/FineTuningApi.md +77 -0
- package/docs/Model.md +4 -0
- package/package.json +1 -1
- package/src/apis/FineTuningApi.ts +59 -0
- package/src/models/Model.ts +16 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @gpuai/sdk@0.3.
|
|
1
|
+
# @gpuai/sdk@0.3.9
|
|
2
2
|
|
|
3
3
|
A TypeScript SDK client for the api.gpu.ai API.
|
|
4
4
|
|
|
@@ -72,6 +72,7 @@ All URIs are relative to *https://api.gpu.ai/v1*
|
|
|
72
72
|
*FineTuningApi* | [**getFineTuningJob**](docs/FineTuningApi.md#getfinetuningjob) | **GET** /fine_tuning/jobs/{id} | Retrieve a fine-tuning job (OpenAI-compatible)
|
|
73
73
|
*FineTuningApi* | [**listFineTuningJobEvents**](docs/FineTuningApi.md#listfinetuningjobevents) | **GET** /fine_tuning/jobs/{id}/events | List fine-tuning job events (OpenAI-compatible)
|
|
74
74
|
*FineTuningApi* | [**listFineTuningJobs**](docs/FineTuningApi.md#listfinetuningjobs) | **GET** /fine_tuning/jobs | List fine-tuning jobs (OpenAI-compatible)
|
|
75
|
+
*FineTuningApi* | [**retrieveFile**](docs/FineTuningApi.md#retrievefile) | **GET** /files/{id} | Retrieve a file (OpenAI-compatible)
|
|
75
76
|
*GpuTypesApi* | [**listGpuTypes**](docs/GpuTypesApi.md#listgputypes) | **GET** /gpu-types | List available GPU types (no auth required)
|
|
76
77
|
*InferenceApi* | [**cancelVideo**](docs/InferenceApi.md#cancelvideo) | **POST** /videos/{id}/cancel | Cancel a video generation job
|
|
77
78
|
*InferenceApi* | [**createChatCompletion**](docs/InferenceApi.md#createchatcompletion) | **POST** /chat/completions | Create a chat completion (OpenAI-compatible)
|
|
@@ -203,7 +204,7 @@ and is automatically generated by the
|
|
|
203
204
|
[OpenAPI Generator](https://openapi-generator.tech) project:
|
|
204
205
|
|
|
205
206
|
- API version: `1.0.0`
|
|
206
|
-
- Package version: `0.3.
|
|
207
|
+
- Package version: `0.3.9`
|
|
207
208
|
- Generator version: `7.24.0`
|
|
208
209
|
- Build package: `org.openapitools.codegen.languages.TypeScriptFetchClientCodegen`
|
|
209
210
|
|
|
@@ -37,6 +37,9 @@ export interface ListFineTuningJobsRequest {
|
|
|
37
37
|
after?: string;
|
|
38
38
|
limit?: number;
|
|
39
39
|
}
|
|
40
|
+
export interface RetrieveFileRequest {
|
|
41
|
+
id: string;
|
|
42
|
+
}
|
|
40
43
|
/**
|
|
41
44
|
*
|
|
42
45
|
*/
|
|
@@ -113,6 +116,20 @@ export declare class FineTuningApi extends runtime.BaseAPI {
|
|
|
113
116
|
* List fine-tuning jobs (OpenAI-compatible)
|
|
114
117
|
*/
|
|
115
118
|
listFineTuningJobs(requestParameters?: ListFineTuningJobsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FineTuningJobList>;
|
|
119
|
+
/**
|
|
120
|
+
* Creates request options for retrieveFile without sending the request
|
|
121
|
+
*/
|
|
122
|
+
retrieveFileRequestOpts(requestParameters: RetrieveFileRequest): Promise<runtime.RequestOpts>;
|
|
123
|
+
/**
|
|
124
|
+
* Returns the metadata for one of your uploaded files. The lookup is scoped to the organization the API key belongs to: a file id that does not exist and one that belongs to another organization both return the same 404, so this route cannot be used to probe for other tenants\' ids. Use it to check that a `training_file` is present and usable BEFORE creating a fine-tuning job — the create path performs the identical ownership check, so a file this route returns is a file that create will accept.
|
|
125
|
+
* Retrieve a file (OpenAI-compatible)
|
|
126
|
+
*/
|
|
127
|
+
retrieveFileRaw(requestParameters: RetrieveFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FileObject>>;
|
|
128
|
+
/**
|
|
129
|
+
* Returns the metadata for one of your uploaded files. The lookup is scoped to the organization the API key belongs to: a file id that does not exist and one that belongs to another organization both return the same 404, so this route cannot be used to probe for other tenants\' ids. Use it to check that a `training_file` is present and usable BEFORE creating a fine-tuning job — the create path performs the identical ownership check, so a file this route returns is a file that create will accept.
|
|
130
|
+
* Retrieve a file (OpenAI-compatible)
|
|
131
|
+
*/
|
|
132
|
+
retrieveFile(requestParameters: RetrieveFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FileObject>;
|
|
116
133
|
}
|
|
117
134
|
/**
|
|
118
135
|
* @export
|
|
@@ -342,6 +342,54 @@ class FineTuningApi extends runtime.BaseAPI {
|
|
|
342
342
|
return yield response.value();
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
|
+
/**
|
|
346
|
+
* Creates request options for retrieveFile without sending the request
|
|
347
|
+
*/
|
|
348
|
+
retrieveFileRequestOpts(requestParameters) {
|
|
349
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
350
|
+
if (requestParameters['id'] == null) {
|
|
351
|
+
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling retrieveFile().');
|
|
352
|
+
}
|
|
353
|
+
const queryParameters = {};
|
|
354
|
+
const headerParameters = {};
|
|
355
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
356
|
+
const token = this.configuration.accessToken;
|
|
357
|
+
const tokenString = yield token("bearerAuth", []);
|
|
358
|
+
if (tokenString) {
|
|
359
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
let urlPath = `/files/{id}`;
|
|
363
|
+
urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
|
|
364
|
+
return {
|
|
365
|
+
path: urlPath,
|
|
366
|
+
method: 'GET',
|
|
367
|
+
headers: headerParameters,
|
|
368
|
+
query: queryParameters,
|
|
369
|
+
};
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Returns the metadata for one of your uploaded files. The lookup is scoped to the organization the API key belongs to: a file id that does not exist and one that belongs to another organization both return the same 404, so this route cannot be used to probe for other tenants\' ids. Use it to check that a `training_file` is present and usable BEFORE creating a fine-tuning job — the create path performs the identical ownership check, so a file this route returns is a file that create will accept.
|
|
374
|
+
* Retrieve a file (OpenAI-compatible)
|
|
375
|
+
*/
|
|
376
|
+
retrieveFileRaw(requestParameters, initOverrides) {
|
|
377
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
378
|
+
const requestOptions = yield this.retrieveFileRequestOpts(requestParameters);
|
|
379
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
380
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, FileObject_1.FileObjectFromJSON)(jsonValue));
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Returns the metadata for one of your uploaded files. The lookup is scoped to the organization the API key belongs to: a file id that does not exist and one that belongs to another organization both return the same 404, so this route cannot be used to probe for other tenants\' ids. Use it to check that a `training_file` is present and usable BEFORE creating a fine-tuning job — the create path performs the identical ownership check, so a file this route returns is a file that create will accept.
|
|
385
|
+
* Retrieve a file (OpenAI-compatible)
|
|
386
|
+
*/
|
|
387
|
+
retrieveFile(requestParameters, initOverrides) {
|
|
388
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
389
|
+
const response = yield this.retrieveFileRaw(requestParameters, initOverrides);
|
|
390
|
+
return yield response.value();
|
|
391
|
+
});
|
|
392
|
+
}
|
|
345
393
|
}
|
|
346
394
|
exports.FineTuningApi = FineTuningApi;
|
|
347
395
|
/**
|
|
@@ -37,6 +37,9 @@ export interface ListFineTuningJobsRequest {
|
|
|
37
37
|
after?: string;
|
|
38
38
|
limit?: number;
|
|
39
39
|
}
|
|
40
|
+
export interface RetrieveFileRequest {
|
|
41
|
+
id: string;
|
|
42
|
+
}
|
|
40
43
|
/**
|
|
41
44
|
*
|
|
42
45
|
*/
|
|
@@ -113,6 +116,20 @@ export declare class FineTuningApi extends runtime.BaseAPI {
|
|
|
113
116
|
* List fine-tuning jobs (OpenAI-compatible)
|
|
114
117
|
*/
|
|
115
118
|
listFineTuningJobs(requestParameters?: ListFineTuningJobsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FineTuningJobList>;
|
|
119
|
+
/**
|
|
120
|
+
* Creates request options for retrieveFile without sending the request
|
|
121
|
+
*/
|
|
122
|
+
retrieveFileRequestOpts(requestParameters: RetrieveFileRequest): Promise<runtime.RequestOpts>;
|
|
123
|
+
/**
|
|
124
|
+
* Returns the metadata for one of your uploaded files. The lookup is scoped to the organization the API key belongs to: a file id that does not exist and one that belongs to another organization both return the same 404, so this route cannot be used to probe for other tenants\' ids. Use it to check that a `training_file` is present and usable BEFORE creating a fine-tuning job — the create path performs the identical ownership check, so a file this route returns is a file that create will accept.
|
|
125
|
+
* Retrieve a file (OpenAI-compatible)
|
|
126
|
+
*/
|
|
127
|
+
retrieveFileRaw(requestParameters: RetrieveFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FileObject>>;
|
|
128
|
+
/**
|
|
129
|
+
* Returns the metadata for one of your uploaded files. The lookup is scoped to the organization the API key belongs to: a file id that does not exist and one that belongs to another organization both return the same 404, so this route cannot be used to probe for other tenants\' ids. Use it to check that a `training_file` is present and usable BEFORE creating a fine-tuning job — the create path performs the identical ownership check, so a file this route returns is a file that create will accept.
|
|
130
|
+
* Retrieve a file (OpenAI-compatible)
|
|
131
|
+
*/
|
|
132
|
+
retrieveFile(requestParameters: RetrieveFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FileObject>;
|
|
116
133
|
}
|
|
117
134
|
/**
|
|
118
135
|
* @export
|
|
@@ -339,6 +339,54 @@ export class FineTuningApi extends runtime.BaseAPI {
|
|
|
339
339
|
return yield response.value();
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* Creates request options for retrieveFile without sending the request
|
|
344
|
+
*/
|
|
345
|
+
retrieveFileRequestOpts(requestParameters) {
|
|
346
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
347
|
+
if (requestParameters['id'] == null) {
|
|
348
|
+
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling retrieveFile().');
|
|
349
|
+
}
|
|
350
|
+
const queryParameters = {};
|
|
351
|
+
const headerParameters = {};
|
|
352
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
353
|
+
const token = this.configuration.accessToken;
|
|
354
|
+
const tokenString = yield token("bearerAuth", []);
|
|
355
|
+
if (tokenString) {
|
|
356
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
let urlPath = `/files/{id}`;
|
|
360
|
+
urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
|
|
361
|
+
return {
|
|
362
|
+
path: urlPath,
|
|
363
|
+
method: 'GET',
|
|
364
|
+
headers: headerParameters,
|
|
365
|
+
query: queryParameters,
|
|
366
|
+
};
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Returns the metadata for one of your uploaded files. The lookup is scoped to the organization the API key belongs to: a file id that does not exist and one that belongs to another organization both return the same 404, so this route cannot be used to probe for other tenants\' ids. Use it to check that a `training_file` is present and usable BEFORE creating a fine-tuning job — the create path performs the identical ownership check, so a file this route returns is a file that create will accept.
|
|
371
|
+
* Retrieve a file (OpenAI-compatible)
|
|
372
|
+
*/
|
|
373
|
+
retrieveFileRaw(requestParameters, initOverrides) {
|
|
374
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
375
|
+
const requestOptions = yield this.retrieveFileRequestOpts(requestParameters);
|
|
376
|
+
const response = yield this.request(requestOptions, initOverrides);
|
|
377
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => FileObjectFromJSON(jsonValue));
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Returns the metadata for one of your uploaded files. The lookup is scoped to the organization the API key belongs to: a file id that does not exist and one that belongs to another organization both return the same 404, so this route cannot be used to probe for other tenants\' ids. Use it to check that a `training_file` is present and usable BEFORE creating a fine-tuning job — the create path performs the identical ownership check, so a file this route returns is a file that create will accept.
|
|
382
|
+
* Retrieve a file (OpenAI-compatible)
|
|
383
|
+
*/
|
|
384
|
+
retrieveFile(requestParameters, initOverrides) {
|
|
385
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
386
|
+
const response = yield this.retrieveFileRaw(requestParameters, initOverrides);
|
|
387
|
+
return yield response.value();
|
|
388
|
+
});
|
|
389
|
+
}
|
|
342
390
|
}
|
|
343
391
|
/**
|
|
344
392
|
* @export
|
|
@@ -89,6 +89,18 @@ export interface Model {
|
|
|
89
89
|
* @memberof Model
|
|
90
90
|
*/
|
|
91
91
|
aliases?: Array<string>;
|
|
92
|
+
/**
|
|
93
|
+
* Whether this model can be used as the base of a managed fine-tuning job. The tunable allowlist is operator-curated and much narrower than the serving catalog, so this is false for almost every model. Absent means false.
|
|
94
|
+
* @type {boolean}
|
|
95
|
+
* @memberof Model
|
|
96
|
+
*/
|
|
97
|
+
fineTunable?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* The exact id to send as `model` when creating a fine-tuning job for this entry. Present only when `fine_tunable` is true, and deliberately distinct from `id`: the allowlist matches the customer-facing base id (e.g. `qwen2.5-7b-instruct`), which a served model normally carries as an alias rather than as its namespaced catalog id.
|
|
100
|
+
* @type {string}
|
|
101
|
+
* @memberof Model
|
|
102
|
+
*/
|
|
103
|
+
fineTuneBaseModel?: string;
|
|
92
104
|
/**
|
|
93
105
|
*
|
|
94
106
|
* @type {ModelStatusEnum}
|
package/dist/esm/models/Model.js
CHANGED
|
@@ -75,6 +75,8 @@ export function ModelFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
75
75
|
'parameters': json['parameters'] == null ? undefined : (json['parameters'].map(ModelParametersInnerFromJSON)),
|
|
76
76
|
'pricing': ModelPricingFromJSON(json['pricing']),
|
|
77
77
|
'aliases': json['aliases'] == null ? undefined : json['aliases'],
|
|
78
|
+
'fineTunable': json['fine_tunable'] == null ? undefined : json['fine_tunable'],
|
|
79
|
+
'fineTuneBaseModel': json['fine_tune_base_model'] == null ? undefined : json['fine_tune_base_model'],
|
|
78
80
|
'status': json['status'],
|
|
79
81
|
};
|
|
80
82
|
}
|
|
@@ -98,6 +100,8 @@ export function ModelToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
98
100
|
'parameters': value['parameters'] == null ? undefined : (value['parameters'].map(ModelParametersInnerToJSON)),
|
|
99
101
|
'pricing': ModelPricingToJSON(value['pricing']),
|
|
100
102
|
'aliases': value['aliases'],
|
|
103
|
+
'fine_tunable': value['fineTunable'],
|
|
104
|
+
'fine_tune_base_model': value['fineTuneBaseModel'],
|
|
101
105
|
'status': value['status'],
|
|
102
106
|
};
|
|
103
107
|
}
|
package/dist/models/Model.d.ts
CHANGED
|
@@ -89,6 +89,18 @@ export interface Model {
|
|
|
89
89
|
* @memberof Model
|
|
90
90
|
*/
|
|
91
91
|
aliases?: Array<string>;
|
|
92
|
+
/**
|
|
93
|
+
* Whether this model can be used as the base of a managed fine-tuning job. The tunable allowlist is operator-curated and much narrower than the serving catalog, so this is false for almost every model. Absent means false.
|
|
94
|
+
* @type {boolean}
|
|
95
|
+
* @memberof Model
|
|
96
|
+
*/
|
|
97
|
+
fineTunable?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* The exact id to send as `model` when creating a fine-tuning job for this entry. Present only when `fine_tunable` is true, and deliberately distinct from `id`: the allowlist matches the customer-facing base id (e.g. `qwen2.5-7b-instruct`), which a served model normally carries as an alias rather than as its namespaced catalog id.
|
|
100
|
+
* @type {string}
|
|
101
|
+
* @memberof Model
|
|
102
|
+
*/
|
|
103
|
+
fineTuneBaseModel?: string;
|
|
92
104
|
/**
|
|
93
105
|
*
|
|
94
106
|
* @type {ModelStatusEnum}
|
package/dist/models/Model.js
CHANGED
|
@@ -83,6 +83,8 @@ function ModelFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
83
83
|
'parameters': json['parameters'] == null ? undefined : (json['parameters'].map(ModelParametersInner_1.ModelParametersInnerFromJSON)),
|
|
84
84
|
'pricing': (0, ModelPricing_1.ModelPricingFromJSON)(json['pricing']),
|
|
85
85
|
'aliases': json['aliases'] == null ? undefined : json['aliases'],
|
|
86
|
+
'fineTunable': json['fine_tunable'] == null ? undefined : json['fine_tunable'],
|
|
87
|
+
'fineTuneBaseModel': json['fine_tune_base_model'] == null ? undefined : json['fine_tune_base_model'],
|
|
86
88
|
'status': json['status'],
|
|
87
89
|
};
|
|
88
90
|
}
|
|
@@ -106,6 +108,8 @@ function ModelToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
106
108
|
'parameters': value['parameters'] == null ? undefined : (value['parameters'].map(ModelParametersInner_1.ModelParametersInnerToJSON)),
|
|
107
109
|
'pricing': (0, ModelPricing_1.ModelPricingToJSON)(value['pricing']),
|
|
108
110
|
'aliases': value['aliases'],
|
|
111
|
+
'fine_tunable': value['fineTunable'],
|
|
112
|
+
'fine_tune_base_model': value['fineTuneBaseModel'],
|
|
109
113
|
'status': value['status'],
|
|
110
114
|
};
|
|
111
115
|
}
|
package/docs/FineTuningApi.md
CHANGED
|
@@ -10,6 +10,7 @@ All URIs are relative to *https://api.gpu.ai/v1*
|
|
|
10
10
|
| [**getFineTuningJob**](FineTuningApi.md#getfinetuningjob) | **GET** /fine_tuning/jobs/{id} | Retrieve a fine-tuning job (OpenAI-compatible) |
|
|
11
11
|
| [**listFineTuningJobEvents**](FineTuningApi.md#listfinetuningjobevents) | **GET** /fine_tuning/jobs/{id}/events | List fine-tuning job events (OpenAI-compatible) |
|
|
12
12
|
| [**listFineTuningJobs**](FineTuningApi.md#listfinetuningjobs) | **GET** /fine_tuning/jobs | List fine-tuning jobs (OpenAI-compatible) |
|
|
13
|
+
| [**retrieveFile**](FineTuningApi.md#retrievefile) | **GET** /files/{id} | Retrieve a file (OpenAI-compatible) |
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
|
|
@@ -466,3 +467,79 @@ example().catch(console.error);
|
|
|
466
467
|
|
|
467
468
|
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
468
469
|
|
|
470
|
+
|
|
471
|
+
## retrieveFile
|
|
472
|
+
|
|
473
|
+
> FileObject retrieveFile(id)
|
|
474
|
+
|
|
475
|
+
Retrieve a file (OpenAI-compatible)
|
|
476
|
+
|
|
477
|
+
Returns the metadata for one of your uploaded files. The lookup is scoped to the organization the API key belongs to: a file id that does not exist and one that belongs to another organization both return the same 404, so this route cannot be used to probe for other tenants\' ids. Use it to check that a `training_file` is present and usable BEFORE creating a fine-tuning job — the create path performs the identical ownership check, so a file this route returns is a file that create will accept.
|
|
478
|
+
|
|
479
|
+
### Example
|
|
480
|
+
|
|
481
|
+
```ts
|
|
482
|
+
import {
|
|
483
|
+
Configuration,
|
|
484
|
+
FineTuningApi,
|
|
485
|
+
} from '@gpuai/sdk';
|
|
486
|
+
import type { RetrieveFileRequest } from '@gpuai/sdk';
|
|
487
|
+
|
|
488
|
+
async function example() {
|
|
489
|
+
console.log("🚀 Testing @gpuai/sdk SDK...");
|
|
490
|
+
const config = new Configuration({
|
|
491
|
+
// Configure HTTP bearer authorization: bearerAuth
|
|
492
|
+
accessToken: "YOUR BEARER TOKEN",
|
|
493
|
+
});
|
|
494
|
+
const api = new FineTuningApi(config);
|
|
495
|
+
|
|
496
|
+
const body = {
|
|
497
|
+
// string | The file id returned by the upload, e.g. `file-9f2c1a...`.
|
|
498
|
+
id: id_example,
|
|
499
|
+
} satisfies RetrieveFileRequest;
|
|
500
|
+
|
|
501
|
+
try {
|
|
502
|
+
const data = await api.retrieveFile(body);
|
|
503
|
+
console.log(data);
|
|
504
|
+
} catch (error) {
|
|
505
|
+
console.error(error);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// Run the test
|
|
510
|
+
example().catch(console.error);
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
### Parameters
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
| Name | Type | Description | Notes |
|
|
517
|
+
|------------- | ------------- | ------------- | -------------|
|
|
518
|
+
| **id** | `string` | The file id returned by the upload, e.g. `file-9f2c1a...`. | [Defaults to `undefined`] |
|
|
519
|
+
|
|
520
|
+
### Return type
|
|
521
|
+
|
|
522
|
+
[**FileObject**](FileObject.md)
|
|
523
|
+
|
|
524
|
+
### Authorization
|
|
525
|
+
|
|
526
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
527
|
+
|
|
528
|
+
### HTTP request headers
|
|
529
|
+
|
|
530
|
+
- **Content-Type**: Not defined
|
|
531
|
+
- **Accept**: `application/json`
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
### HTTP response details
|
|
535
|
+
| Status code | Description | Response headers |
|
|
536
|
+
|-------------|-------------|------------------|
|
|
537
|
+
| **200** | The file object. | - |
|
|
538
|
+
| **401** | Missing or invalid API key (OpenAI error envelope). | - |
|
|
539
|
+
| **403** | API key lacks the required scope (OpenAI error envelope). | - |
|
|
540
|
+
| **404** | Model or resource not found (OpenAI error envelope). | - |
|
|
541
|
+
| **429** | Rate limit exceeded (OpenAI error envelope). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
542
|
+
| **500** | Internal server error (OpenAI error envelope). | - |
|
|
543
|
+
|
|
544
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
545
|
+
|
package/docs/Model.md
CHANGED
|
@@ -18,6 +18,8 @@ Name | Type
|
|
|
18
18
|
`parameters` | [Array<ModelParametersInner>](ModelParametersInner.md)
|
|
19
19
|
`pricing` | [ModelPricing](ModelPricing.md)
|
|
20
20
|
`aliases` | Array<string>
|
|
21
|
+
`fineTunable` | boolean
|
|
22
|
+
`fineTuneBaseModel` | string
|
|
21
23
|
`status` | string
|
|
22
24
|
|
|
23
25
|
## Example
|
|
@@ -39,6 +41,8 @@ const example = {
|
|
|
39
41
|
"parameters": null,
|
|
40
42
|
"pricing": null,
|
|
41
43
|
"aliases": null,
|
|
44
|
+
"fineTunable": null,
|
|
45
|
+
"fineTuneBaseModel": null,
|
|
42
46
|
"status": null,
|
|
43
47
|
} satisfies Model
|
|
44
48
|
|
package/package.json
CHANGED
|
@@ -72,6 +72,10 @@ export interface ListFineTuningJobsRequest {
|
|
|
72
72
|
limit?: number;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
export interface RetrieveFileRequest {
|
|
76
|
+
id: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
75
79
|
/**
|
|
76
80
|
*
|
|
77
81
|
*/
|
|
@@ -436,6 +440,61 @@ export class FineTuningApi extends runtime.BaseAPI {
|
|
|
436
440
|
return await response.value();
|
|
437
441
|
}
|
|
438
442
|
|
|
443
|
+
/**
|
|
444
|
+
* Creates request options for retrieveFile without sending the request
|
|
445
|
+
*/
|
|
446
|
+
async retrieveFileRequestOpts(requestParameters: RetrieveFileRequest): Promise<runtime.RequestOpts> {
|
|
447
|
+
if (requestParameters['id'] == null) {
|
|
448
|
+
throw new runtime.RequiredError(
|
|
449
|
+
'id',
|
|
450
|
+
'Required parameter "id" was null or undefined when calling retrieveFile().'
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
const queryParameters: any = {};
|
|
455
|
+
|
|
456
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
457
|
+
|
|
458
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
459
|
+
const token = this.configuration.accessToken;
|
|
460
|
+
const tokenString = await token("bearerAuth", []);
|
|
461
|
+
|
|
462
|
+
if (tokenString) {
|
|
463
|
+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
let urlPath = `/files/{id}`;
|
|
468
|
+
urlPath = urlPath.replace('{id}', encodeURIComponent(String(requestParameters['id'])));
|
|
469
|
+
|
|
470
|
+
return {
|
|
471
|
+
path: urlPath,
|
|
472
|
+
method: 'GET',
|
|
473
|
+
headers: headerParameters,
|
|
474
|
+
query: queryParameters,
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* Returns the metadata for one of your uploaded files. The lookup is scoped to the organization the API key belongs to: a file id that does not exist and one that belongs to another organization both return the same 404, so this route cannot be used to probe for other tenants\' ids. Use it to check that a `training_file` is present and usable BEFORE creating a fine-tuning job — the create path performs the identical ownership check, so a file this route returns is a file that create will accept.
|
|
480
|
+
* Retrieve a file (OpenAI-compatible)
|
|
481
|
+
*/
|
|
482
|
+
async retrieveFileRaw(requestParameters: RetrieveFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FileObject>> {
|
|
483
|
+
const requestOptions = await this.retrieveFileRequestOpts(requestParameters);
|
|
484
|
+
const response = await this.request(requestOptions, initOverrides);
|
|
485
|
+
|
|
486
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => FileObjectFromJSON(jsonValue));
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Returns the metadata for one of your uploaded files. The lookup is scoped to the organization the API key belongs to: a file id that does not exist and one that belongs to another organization both return the same 404, so this route cannot be used to probe for other tenants\' ids. Use it to check that a `training_file` is present and usable BEFORE creating a fine-tuning job — the create path performs the identical ownership check, so a file this route returns is a file that create will accept.
|
|
491
|
+
* Retrieve a file (OpenAI-compatible)
|
|
492
|
+
*/
|
|
493
|
+
async retrieveFile(requestParameters: RetrieveFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FileObject> {
|
|
494
|
+
const response = await this.retrieveFileRaw(requestParameters, initOverrides);
|
|
495
|
+
return await response.value();
|
|
496
|
+
}
|
|
497
|
+
|
|
439
498
|
}
|
|
440
499
|
|
|
441
500
|
/**
|
package/src/models/Model.ts
CHANGED
|
@@ -106,6 +106,18 @@ export interface Model {
|
|
|
106
106
|
* @memberof Model
|
|
107
107
|
*/
|
|
108
108
|
aliases?: Array<string>;
|
|
109
|
+
/**
|
|
110
|
+
* Whether this model can be used as the base of a managed fine-tuning job. The tunable allowlist is operator-curated and much narrower than the serving catalog, so this is false for almost every model. Absent means false.
|
|
111
|
+
* @type {boolean}
|
|
112
|
+
* @memberof Model
|
|
113
|
+
*/
|
|
114
|
+
fineTunable?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* The exact id to send as `model` when creating a fine-tuning job for this entry. Present only when `fine_tunable` is true, and deliberately distinct from `id`: the allowlist matches the customer-facing base id (e.g. `qwen2.5-7b-instruct`), which a served model normally carries as an alias rather than as its namespaced catalog id.
|
|
117
|
+
* @type {string}
|
|
118
|
+
* @memberof Model
|
|
119
|
+
*/
|
|
120
|
+
fineTuneBaseModel?: string;
|
|
109
121
|
/**
|
|
110
122
|
*
|
|
111
123
|
* @type {ModelStatusEnum}
|
|
@@ -181,6 +193,8 @@ export function ModelFromJSONTyped(json: any, ignoreDiscriminator: boolean): Mod
|
|
|
181
193
|
'parameters': json['parameters'] == null ? undefined : ((json['parameters'] as Array<any>).map(ModelParametersInnerFromJSON)),
|
|
182
194
|
'pricing': ModelPricingFromJSON(json['pricing']),
|
|
183
195
|
'aliases': json['aliases'] == null ? undefined : json['aliases'],
|
|
196
|
+
'fineTunable': json['fine_tunable'] == null ? undefined : json['fine_tunable'],
|
|
197
|
+
'fineTuneBaseModel': json['fine_tune_base_model'] == null ? undefined : json['fine_tune_base_model'],
|
|
184
198
|
'status': json['status'],
|
|
185
199
|
};
|
|
186
200
|
}
|
|
@@ -208,6 +222,8 @@ export function ModelToJSONTyped(value?: Model | null, ignoreDiscriminator: bool
|
|
|
208
222
|
'parameters': value['parameters'] == null ? undefined : ((value['parameters'] as Array<any>).map(ModelParametersInnerToJSON)),
|
|
209
223
|
'pricing': ModelPricingToJSON(value['pricing']),
|
|
210
224
|
'aliases': value['aliases'],
|
|
225
|
+
'fine_tunable': value['fineTunable'],
|
|
226
|
+
'fine_tune_base_model': value['fineTuneBaseModel'],
|
|
211
227
|
'status': value['status'],
|
|
212
228
|
};
|
|
213
229
|
}
|