permissions.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. "use strict";
  2. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. exports.Permissions = void 0;
  5. const resource_1 = require("../../../core/resource.js");
  6. const pagination_1 = require("../../../core/pagination.js");
  7. const path_1 = require("../../../internal/utils/path.js");
  8. class Permissions extends resource_1.APIResource {
  9. /**
  10. * **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys).
  11. *
  12. * This enables organization owners to share fine-tuned models with other projects
  13. * in their organization.
  14. *
  15. * @example
  16. * ```ts
  17. * // Automatically fetches more pages as needed.
  18. * for await (const permissionCreateResponse of client.fineTuning.checkpoints.permissions.create(
  19. * 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd',
  20. * { project_ids: ['string'] },
  21. * )) {
  22. * // ...
  23. * }
  24. * ```
  25. */
  26. create(fineTunedModelCheckpoint, body, options) {
  27. return this._client.getAPIList((0, path_1.path) `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (pagination_1.Page), { body, method: 'post', ...options });
  28. }
  29. /**
  30. * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
  31. *
  32. * Organization owners can use this endpoint to view all permissions for a
  33. * fine-tuned model checkpoint.
  34. *
  35. * @example
  36. * ```ts
  37. * const permission =
  38. * await client.fineTuning.checkpoints.permissions.retrieve(
  39. * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
  40. * );
  41. * ```
  42. */
  43. retrieve(fineTunedModelCheckpoint, query = {}, options) {
  44. return this._client.get((0, path_1.path) `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
  45. query,
  46. ...options,
  47. });
  48. }
  49. /**
  50. * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
  51. *
  52. * Organization owners can use this endpoint to delete a permission for a
  53. * fine-tuned model checkpoint.
  54. *
  55. * @example
  56. * ```ts
  57. * const permission =
  58. * await client.fineTuning.checkpoints.permissions.delete(
  59. * 'cp_zc4Q7MP6XxulcVzj4MZdwsAB',
  60. * {
  61. * fine_tuned_model_checkpoint:
  62. * 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd',
  63. * },
  64. * );
  65. * ```
  66. */
  67. delete(permissionID, params, options) {
  68. const { fine_tuned_model_checkpoint } = params;
  69. return this._client.delete((0, path_1.path) `/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, options);
  70. }
  71. }
  72. exports.Permissions = Permissions;
  73. //# sourceMappingURL=permissions.js.map