permissions.mjs 2.5 KB

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