73 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
		
		
			
		
	
	
			73 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 
								 | 
							
								"use strict";
							 | 
						||
| 
								 | 
							
								// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
							 | 
						||
| 
								 | 
							
								Object.defineProperty(exports, "__esModule", { value: true });
							 | 
						||
| 
								 | 
							
								exports.Permissions = void 0;
							 | 
						||
| 
								 | 
							
								const resource_1 = require("../../../core/resource.js");
							 | 
						||
| 
								 | 
							
								const pagination_1 = require("../../../core/pagination.js");
							 | 
						||
| 
								 | 
							
								const path_1 = require("../../../internal/utils/path.js");
							 | 
						||
| 
								 | 
							
								class Permissions extends resource_1.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((0, path_1.path) `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (pagination_1.Page), { body, method: 'post', ...options });
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     * Organization owners can use this endpoint to view all permissions for a
							 | 
						||
| 
								 | 
							
								     * fine-tuned model checkpoint.
							 | 
						||
| 
								 | 
							
								     *
							 | 
						||
| 
								 | 
							
								     * @example
							 | 
						||
| 
								 | 
							
								     * ```ts
							 | 
						||
| 
								 | 
							
								     * const permission =
							 | 
						||
| 
								 | 
							
								     *   await client.fineTuning.checkpoints.permissions.retrieve(
							 | 
						||
| 
								 | 
							
								     *     'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
							 | 
						||
| 
								 | 
							
								     *   );
							 | 
						||
| 
								 | 
							
								     * ```
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    retrieve(fineTunedModelCheckpoint, query = {}, options) {
							 | 
						||
| 
								 | 
							
								        return this._client.get((0, path_1.path) `/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.delete(
							 | 
						||
| 
								 | 
							
								     *     'cp_zc4Q7MP6XxulcVzj4MZdwsAB',
							 | 
						||
| 
								 | 
							
								     *     {
							 | 
						||
| 
								 | 
							
								     *       fine_tuned_model_checkpoint:
							 | 
						||
| 
								 | 
							
								     *         'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd',
							 | 
						||
| 
								 | 
							
								     *     },
							 | 
						||
| 
								 | 
							
								     *   );
							 | 
						||
| 
								 | 
							
								     * ```
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    delete(permissionID, params, options) {
							 | 
						||
| 
								 | 
							
								        const { fine_tuned_model_checkpoint } = params;
							 | 
						||
| 
								 | 
							
								        return this._client.delete((0, path_1.path) `/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, options);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								exports.Permissions = Permissions;
							 | 
						||
| 
								 | 
							
								//# sourceMappingURL=permissions.js.map
							 |