60 lines
2.3 KiB
JavaScript
60 lines
2.3 KiB
JavaScript
|
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
||
|
|
import { APIResource } from "../../../resource.mjs";
|
||
|
|
import { isRequestOptions } from "../../../core.mjs";
|
||
|
|
import { Page } from "../../../pagination.mjs";
|
||
|
|
export class Permissions extends APIResource {
|
||
|
|
/**
|
||
|
|
* **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
|
||
|
|
*
|
||
|
|
* This enables organization owners to share fine-tuned models with other projects
|
||
|
|
* in their organization.
|
||
|
|
*
|
||
|
|
* @example
|
||
|
|
* ```ts
|
||
|
|
* // Automatically fetches more pages as needed.
|
||
|
|
* for await (const permissionCreateResponse of client.fineTuning.checkpoints.permissions.create(
|
||
|
|
* 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd',
|
||
|
|
* { project_ids: ['string'] },
|
||
|
|
* )) {
|
||
|
|
* // ...
|
||
|
|
* }
|
||
|
|
* ```
|
||
|
|
*/
|
||
|
|
create(fineTunedModelCheckpoint, body, options) {
|
||
|
|
return this._client.getAPIList(`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, PermissionCreateResponsesPage, { body, method: 'post', ...options });
|
||
|
|
}
|
||
|
|
retrieve(fineTunedModelCheckpoint, query = {}, options) {
|
||
|
|
if (isRequestOptions(query)) {
|
||
|
|
return this.retrieve(fineTunedModelCheckpoint, {}, query);
|
||
|
|
}
|
||
|
|
return this._client.get(`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
|
||
|
|
query,
|
||
|
|
...options,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
||
|
|
*
|
||
|
|
* Organization owners can use this endpoint to delete a permission for a
|
||
|
|
* fine-tuned model checkpoint.
|
||
|
|
*
|
||
|
|
* @example
|
||
|
|
* ```ts
|
||
|
|
* const permission =
|
||
|
|
* await client.fineTuning.checkpoints.permissions.del(
|
||
|
|
* 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd',
|
||
|
|
* 'cp_zc4Q7MP6XxulcVzj4MZdwsAB',
|
||
|
|
* );
|
||
|
|
* ```
|
||
|
|
*/
|
||
|
|
del(fineTunedModelCheckpoint, permissionId, options) {
|
||
|
|
return this._client.delete(`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions/${permissionId}`, options);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* Note: no pagination actually occurs yet, this is for forwards-compatibility.
|
||
|
|
*/
|
||
|
|
export class PermissionCreateResponsesPage extends Page {
|
||
|
|
}
|
||
|
|
Permissions.PermissionCreateResponsesPage = PermissionCreateResponsesPage;
|
||
|
|
//# sourceMappingURL=permissions.mjs.map
|