69 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
		
		
			
		
	
	
			69 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 
								 | 
							
								// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
							 | 
						||
| 
								 | 
							
								import { APIResource } from "../../../core/resource.mjs";
							 | 
						||
| 
								 | 
							
								import { Page } from "../../../core/pagination.mjs";
							 | 
						||
| 
								 | 
							
								import { path } from "../../../internal/utils/path.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(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (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(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(path `/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, options);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								//# sourceMappingURL=permissions.mjs.map
							 |