permissions.d.mts 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. import { APIResource } from "../../../core/resource.mjs";
  2. import { APIPromise } from "../../../core/api-promise.mjs";
  3. import { Page, PagePromise } from "../../../core/pagination.mjs";
  4. import { RequestOptions } from "../../../internal/request-options.mjs";
  5. export declare 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: string, body: PermissionCreateParams, options?: RequestOptions): PagePromise<PermissionCreateResponsesPage, PermissionCreateResponse>;
  24. /**
  25. * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
  26. *
  27. * Organization owners can use this endpoint to view all permissions for a
  28. * fine-tuned model checkpoint.
  29. *
  30. * @example
  31. * ```ts
  32. * const permission =
  33. * await client.fineTuning.checkpoints.permissions.retrieve(
  34. * 'ft-AF1WoRqd3aJAHsqc9NY7iL8F',
  35. * );
  36. * ```
  37. */
  38. retrieve(fineTunedModelCheckpoint: string, query?: PermissionRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<PermissionRetrieveResponse>;
  39. /**
  40. * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
  41. *
  42. * Organization owners can use this endpoint to delete a permission for a
  43. * fine-tuned model checkpoint.
  44. *
  45. * @example
  46. * ```ts
  47. * const permission =
  48. * await client.fineTuning.checkpoints.permissions.delete(
  49. * 'cp_zc4Q7MP6XxulcVzj4MZdwsAB',
  50. * {
  51. * fine_tuned_model_checkpoint:
  52. * 'ft:gpt-4o-mini-2024-07-18:org:weather:B7R9VjQd',
  53. * },
  54. * );
  55. * ```
  56. */
  57. delete(permissionID: string, params: PermissionDeleteParams, options?: RequestOptions): APIPromise<PermissionDeleteResponse>;
  58. }
  59. export type PermissionCreateResponsesPage = Page<PermissionCreateResponse>;
  60. /**
  61. * The `checkpoint.permission` object represents a permission for a fine-tuned
  62. * model checkpoint.
  63. */
  64. export interface PermissionCreateResponse {
  65. /**
  66. * The permission identifier, which can be referenced in the API endpoints.
  67. */
  68. id: string;
  69. /**
  70. * The Unix timestamp (in seconds) for when the permission was created.
  71. */
  72. created_at: number;
  73. /**
  74. * The object type, which is always "checkpoint.permission".
  75. */
  76. object: 'checkpoint.permission';
  77. /**
  78. * The project identifier that the permission is for.
  79. */
  80. project_id: string;
  81. }
  82. export interface PermissionRetrieveResponse {
  83. data: Array<PermissionRetrieveResponse.Data>;
  84. has_more: boolean;
  85. object: 'list';
  86. first_id?: string | null;
  87. last_id?: string | null;
  88. }
  89. export declare namespace PermissionRetrieveResponse {
  90. /**
  91. * The `checkpoint.permission` object represents a permission for a fine-tuned
  92. * model checkpoint.
  93. */
  94. interface Data {
  95. /**
  96. * The permission identifier, which can be referenced in the API endpoints.
  97. */
  98. id: string;
  99. /**
  100. * The Unix timestamp (in seconds) for when the permission was created.
  101. */
  102. created_at: number;
  103. /**
  104. * The object type, which is always "checkpoint.permission".
  105. */
  106. object: 'checkpoint.permission';
  107. /**
  108. * The project identifier that the permission is for.
  109. */
  110. project_id: string;
  111. }
  112. }
  113. export interface PermissionDeleteResponse {
  114. /**
  115. * The ID of the fine-tuned model checkpoint permission that was deleted.
  116. */
  117. id: string;
  118. /**
  119. * Whether the fine-tuned model checkpoint permission was successfully deleted.
  120. */
  121. deleted: boolean;
  122. /**
  123. * The object type, which is always "checkpoint.permission".
  124. */
  125. object: 'checkpoint.permission';
  126. }
  127. export interface PermissionCreateParams {
  128. /**
  129. * The project identifiers to grant access to.
  130. */
  131. project_ids: Array<string>;
  132. }
  133. export interface PermissionRetrieveParams {
  134. /**
  135. * Identifier for the last permission ID from the previous pagination request.
  136. */
  137. after?: string;
  138. /**
  139. * Number of permissions to retrieve.
  140. */
  141. limit?: number;
  142. /**
  143. * The order in which to retrieve permissions.
  144. */
  145. order?: 'ascending' | 'descending';
  146. /**
  147. * The ID of the project to get permissions for.
  148. */
  149. project_id?: string;
  150. }
  151. export interface PermissionDeleteParams {
  152. /**
  153. * The ID of the fine-tuned model checkpoint to delete a permission for.
  154. */
  155. fine_tuned_model_checkpoint: string;
  156. }
  157. export declare namespace Permissions {
  158. export { type PermissionCreateResponse as PermissionCreateResponse, type PermissionRetrieveResponse as PermissionRetrieveResponse, type PermissionDeleteResponse as PermissionDeleteResponse, type PermissionCreateResponsesPage as PermissionCreateResponsesPage, type PermissionCreateParams as PermissionCreateParams, type PermissionRetrieveParams as PermissionRetrieveParams, type PermissionDeleteParams as PermissionDeleteParams, };
  159. }
  160. //# sourceMappingURL=permissions.d.mts.map