@retab/node 0.0.48 → 0.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/README.md +8 -215
  2. package/dist/api/client.d.ts +2 -2
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js +2 -2
  5. package/dist/api/documents/client.d.ts +3 -3
  6. package/dist/api/documents/client.d.ts.map +1 -1
  7. package/dist/api/documents/client.js +3 -3
  8. package/dist/api/projects/client.d.ts +15 -0
  9. package/dist/api/projects/client.d.ts.map +1 -0
  10. package/dist/api/projects/client.js +43 -0
  11. package/dist/api/projects/documents/client.d.ts +12 -0
  12. package/dist/api/projects/documents/client.d.ts.map +1 -0
  13. package/dist/api/projects/documents/client.js +39 -0
  14. package/dist/api/projects/iterations/client.d.ts +17 -0
  15. package/dist/api/projects/iterations/client.d.ts.map +1 -0
  16. package/dist/api/projects/iterations/client.js +64 -0
  17. package/dist/client.d.ts +1 -0
  18. package/dist/client.d.ts.map +1 -1
  19. package/dist/client.js +6 -1
  20. package/dist/generated_types.d.ts +17837 -40090
  21. package/dist/generated_types.d.ts.map +1 -1
  22. package/dist/generated_types.js +309 -979
  23. package/dist/index.d.ts +7 -2
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +2 -2
  26. package/dist/types.d.ts +188 -80
  27. package/dist/types.d.ts.map +1 -1
  28. package/dist/types.js +22 -1
  29. package/package.json +6 -9
  30. package/dist/api/consensus/client.d.ts +0 -7
  31. package/dist/api/consensus/client.d.ts.map +0 -1
  32. package/dist/api/consensus/client.js +0 -14
  33. package/dist/errors.d.ts +0 -34
  34. package/dist/errors.d.ts.map +0 -1
  35. package/dist/errors.js +0 -53
  36. package/dist/resource.d.ts +0 -12
  37. package/dist/resource.d.ts.map +0 -1
  38. package/dist/resource.js +0 -19
  39. package/dist/resources/consensus/completions.d.ts +0 -66
  40. package/dist/resources/consensus/completions.d.ts.map +0 -1
  41. package/dist/resources/consensus/completions.js +0 -84
  42. package/dist/resources/consensus/index.d.ts +0 -72
  43. package/dist/resources/consensus/index.d.ts.map +0 -1
  44. package/dist/resources/consensus/index.js +0 -76
  45. package/dist/resources/consensus/responses.d.ts +0 -69
  46. package/dist/resources/consensus/responses.d.ts.map +0 -1
  47. package/dist/resources/consensus/responses.js +0 -99
  48. package/dist/resources/documents/extractions.d.ts +0 -74
  49. package/dist/resources/documents/extractions.d.ts.map +0 -1
  50. package/dist/resources/documents/extractions.js +0 -196
  51. package/dist/resources/documents/index.d.ts +0 -21
  52. package/dist/resources/documents/index.d.ts.map +0 -1
  53. package/dist/resources/documents/index.js +0 -55
  54. package/dist/resources/evaluations/documents.d.ts +0 -40
  55. package/dist/resources/evaluations/documents.d.ts.map +0 -1
  56. package/dist/resources/evaluations/documents.js +0 -123
  57. package/dist/resources/evaluations/index.d.ts +0 -14
  58. package/dist/resources/evaluations/index.d.ts.map +0 -1
  59. package/dist/resources/evaluations/index.js +0 -17
  60. package/dist/resources/evaluations/iterations.d.ts +0 -50
  61. package/dist/resources/evaluations/iterations.d.ts.map +0 -1
  62. package/dist/resources/evaluations/iterations.js +0 -156
  63. package/dist/resources/files.d.ts +0 -82
  64. package/dist/resources/files.d.ts.map +0 -1
  65. package/dist/resources/files.js +0 -150
  66. package/dist/resources/finetuning.d.ts +0 -105
  67. package/dist/resources/finetuning.d.ts.map +0 -1
  68. package/dist/resources/finetuning.js +0 -181
  69. package/dist/resources/index.d.ts +0 -11
  70. package/dist/resources/index.d.ts.map +0 -1
  71. package/dist/resources/index.js +0 -10
  72. package/dist/resources/models.d.ts +0 -57
  73. package/dist/resources/models.d.ts.map +0 -1
  74. package/dist/resources/models.js +0 -72
  75. package/dist/resources/processors/automations/endpoints.d.ts +0 -90
  76. package/dist/resources/processors/automations/endpoints.d.ts.map +0 -1
  77. package/dist/resources/processors/automations/endpoints.js +0 -145
  78. package/dist/resources/processors/automations/index.d.ts +0 -7
  79. package/dist/resources/processors/automations/index.d.ts.map +0 -1
  80. package/dist/resources/processors/automations/index.js +0 -6
  81. package/dist/resources/processors/automations/links.d.ts +0 -90
  82. package/dist/resources/processors/automations/links.d.ts.map +0 -1
  83. package/dist/resources/processors/automations/links.js +0 -149
  84. package/dist/resources/processors/automations/logs.d.ts +0 -35
  85. package/dist/resources/processors/automations/logs.d.ts.map +0 -1
  86. package/dist/resources/processors/automations/logs.js +0 -60
  87. package/dist/resources/processors/automations/mailboxes.d.ts +0 -102
  88. package/dist/resources/processors/automations/mailboxes.d.ts.map +0 -1
  89. package/dist/resources/processors/automations/mailboxes.js +0 -157
  90. package/dist/resources/processors/automations/outlook.d.ts +0 -114
  91. package/dist/resources/processors/automations/outlook.d.ts.map +0 -1
  92. package/dist/resources/processors/automations/outlook.js +0 -170
  93. package/dist/resources/processors/automations/tests.d.ts +0 -58
  94. package/dist/resources/processors/automations/tests.d.ts.map +0 -1
  95. package/dist/resources/processors/automations/tests.js +0 -90
  96. package/dist/resources/processors/index.d.ts +0 -303
  97. package/dist/resources/processors/index.d.ts.map +0 -1
  98. package/dist/resources/processors/index.js +0 -261
  99. package/dist/resources/schemas.d.ts +0 -63
  100. package/dist/resources/schemas.d.ts.map +0 -1
  101. package/dist/resources/schemas.js +0 -183
  102. package/dist/resources/secrets/external_api_keys.d.ts +0 -61
  103. package/dist/resources/secrets/external_api_keys.d.ts.map +0 -1
  104. package/dist/resources/secrets/external_api_keys.js +0 -120
  105. package/dist/resources/secrets/index.d.ts +0 -14
  106. package/dist/resources/secrets/index.d.ts.map +0 -1
  107. package/dist/resources/secrets/index.js +0 -17
  108. package/dist/resources/secrets/webhooks.d.ts +0 -73
  109. package/dist/resources/secrets/webhooks.d.ts.map +0 -1
  110. package/dist/resources/secrets/webhooks.js +0 -145
  111. package/dist/resources/usage.d.ts +0 -223
  112. package/dist/resources/usage.d.ts.map +0 -1
  113. package/dist/resources/usage.js +0 -310
  114. package/dist/types/ai_models.d.ts +0 -389
  115. package/dist/types/ai_models.d.ts.map +0 -1
  116. package/dist/types/ai_models.js +0 -145
  117. package/dist/types/automations/cron.d.ts +0 -28
  118. package/dist/types/automations/cron.d.ts.map +0 -1
  119. package/dist/types/automations/cron.js +0 -1
  120. package/dist/types/automations/endpoints.d.ts +0 -13
  121. package/dist/types/automations/endpoints.d.ts.map +0 -1
  122. package/dist/types/automations/endpoints.js +0 -1
  123. package/dist/types/automations/index.d.ts +0 -7
  124. package/dist/types/automations/index.d.ts.map +0 -1
  125. package/dist/types/automations/index.js +0 -6
  126. package/dist/types/automations/links.d.ts +0 -15
  127. package/dist/types/automations/links.d.ts.map +0 -1
  128. package/dist/types/automations/links.js +0 -1
  129. package/dist/types/automations/mailboxes.d.ts +0 -18
  130. package/dist/types/automations/mailboxes.d.ts.map +0 -1
  131. package/dist/types/automations/mailboxes.js +0 -1
  132. package/dist/types/automations/outlook.d.ts +0 -37
  133. package/dist/types/automations/outlook.d.ts.map +0 -1
  134. package/dist/types/automations/outlook.js +0 -1
  135. package/dist/types/automations/webhooks.d.ts +0 -13
  136. package/dist/types/automations/webhooks.d.ts.map +0 -1
  137. package/dist/types/automations/webhooks.js +0 -1
  138. package/dist/types/browser_canvas.d.ts +0 -4
  139. package/dist/types/browser_canvas.d.ts.map +0 -1
  140. package/dist/types/browser_canvas.js +0 -2
  141. package/dist/types/chat.d.ts +0 -99
  142. package/dist/types/chat.d.ts.map +0 -1
  143. package/dist/types/chat.js +0 -20
  144. package/dist/types/consensus.d.ts +0 -10
  145. package/dist/types/consensus.d.ts.map +0 -1
  146. package/dist/types/consensus.js +0 -1
  147. package/dist/types/db/annotations.d.ts +0 -108
  148. package/dist/types/db/annotations.d.ts.map +0 -1
  149. package/dist/types/db/annotations.js +0 -6
  150. package/dist/types/db/files.d.ts +0 -133
  151. package/dist/types/db/files.d.ts.map +0 -1
  152. package/dist/types/db/files.js +0 -5
  153. package/dist/types/documents/extractions.d.ts +0 -1849
  154. package/dist/types/documents/extractions.d.ts.map +0 -1
  155. package/dist/types/documents/extractions.js +0 -211
  156. package/dist/types/documents/processing.d.ts +0 -249
  157. package/dist/types/documents/processing.d.ts.map +0 -1
  158. package/dist/types/documents/processing.js +0 -6
  159. package/dist/types/evaluations/iterations.d.ts +0 -41
  160. package/dist/types/evaluations/iterations.d.ts.map +0 -1
  161. package/dist/types/evaluations/iterations.js +0 -1
  162. package/dist/types/jobs/base.d.ts +0 -162
  163. package/dist/types/jobs/base.d.ts.map +0 -1
  164. package/dist/types/jobs/base.js +0 -6
  165. package/dist/types/jobs/specialized.d.ts +0 -200
  166. package/dist/types/jobs/specialized.d.ts.map +0 -1
  167. package/dist/types/jobs/specialized.js +0 -37
  168. package/dist/types/logs.d.ts +0 -92
  169. package/dist/types/logs.d.ts.map +0 -1
  170. package/dist/types/logs.js +0 -1
  171. package/dist/types/mime.d.ts +0 -426
  172. package/dist/types/mime.d.ts.map +0 -1
  173. package/dist/types/mime.js +0 -48
  174. package/dist/types/modalities.d.ts +0 -31
  175. package/dist/types/modalities.d.ts.map +0 -1
  176. package/dist/types/modalities.js +0 -109
  177. package/dist/types/pagination.d.ts +0 -5
  178. package/dist/types/pagination.d.ts.map +0 -1
  179. package/dist/types/pagination.js +0 -1
  180. package/dist/types/schemas/enhancement.d.ts +0 -250
  181. package/dist/types/schemas/enhancement.d.ts.map +0 -1
  182. package/dist/types/schemas/enhancement.js +0 -6
  183. package/dist/types/schemas/generate.d.ts +0 -160
  184. package/dist/types/schemas/generate.d.ts.map +0 -1
  185. package/dist/types/schemas/generate.js +0 -19
  186. package/dist/types/schemas/object.d.ts +0 -116
  187. package/dist/types/schemas/object.d.ts.map +0 -1
  188. package/dist/types/schemas/object.js +0 -861
  189. package/dist/types/secrets/external_api_keys.d.ts +0 -27
  190. package/dist/types/secrets/external_api_keys.d.ts.map +0 -1
  191. package/dist/types/secrets/external_api_keys.js +0 -11
  192. package/dist/types/secrets/index.d.ts +0 -2
  193. package/dist/types/secrets/index.d.ts.map +0 -1
  194. package/dist/types/secrets/index.js +0 -1
  195. package/dist/types/standards.d.ts +0 -37
  196. package/dist/types/standards.d.ts.map +0 -1
  197. package/dist/types/standards.js +0 -1
  198. package/dist/utils/ai_models.d.ts +0 -10
  199. package/dist/utils/ai_models.d.ts.map +0 -1
  200. package/dist/utils/ai_models.js +0 -183
  201. package/dist/utils/batch_processing.d.ts +0 -227
  202. package/dist/utils/batch_processing.d.ts.map +0 -1
  203. package/dist/utils/batch_processing.js +0 -268
  204. package/dist/utils/benchmarking.d.ts +0 -115
  205. package/dist/utils/benchmarking.d.ts.map +0 -1
  206. package/dist/utils/benchmarking.js +0 -355
  207. package/dist/utils/chat.d.ts +0 -70
  208. package/dist/utils/chat.d.ts.map +0 -1
  209. package/dist/utils/chat.js +0 -79
  210. package/dist/utils/cost_calculation.d.ts +0 -26
  211. package/dist/utils/cost_calculation.d.ts.map +0 -1
  212. package/dist/utils/cost_calculation.js +0 -99
  213. package/dist/utils/datasets.d.ts +0 -135
  214. package/dist/utils/datasets.d.ts.map +0 -1
  215. package/dist/utils/datasets.js +0 -359
  216. package/dist/utils/display.d.ts +0 -108
  217. package/dist/utils/display.d.ts.map +0 -1
  218. package/dist/utils/display.js +0 -244
  219. package/dist/utils/hash.d.ts +0 -18
  220. package/dist/utils/hash.d.ts.map +0 -1
  221. package/dist/utils/hash.js +0 -31
  222. package/dist/utils/hashing.d.ts +0 -18
  223. package/dist/utils/hashing.d.ts.map +0 -1
  224. package/dist/utils/hashing.js +0 -28
  225. package/dist/utils/index.d.ts +0 -8
  226. package/dist/utils/index.d.ts.map +0 -1
  227. package/dist/utils/index.js +0 -10
  228. package/dist/utils/json_schema.d.ts +0 -18
  229. package/dist/utils/json_schema.d.ts.map +0 -1
  230. package/dist/utils/json_schema.js +0 -334
  231. package/dist/utils/json_schema_utils.d.ts +0 -42
  232. package/dist/utils/json_schema_utils.d.ts.map +0 -1
  233. package/dist/utils/json_schema_utils.js +0 -212
  234. package/dist/utils/jsonl.d.ts +0 -60
  235. package/dist/utils/jsonl.d.ts.map +0 -1
  236. package/dist/utils/jsonl.js +0 -259
  237. package/dist/utils/mime.d.ts +0 -6
  238. package/dist/utils/mime.d.ts.map +0 -1
  239. package/dist/utils/mime.js +0 -129
  240. package/dist/utils/model_cards.d.ts +0 -219
  241. package/dist/utils/model_cards.d.ts.map +0 -1
  242. package/dist/utils/model_cards.js +0 -462
  243. package/dist/utils/prompt_optimization.d.ts +0 -96
  244. package/dist/utils/prompt_optimization.d.ts.map +0 -1
  245. package/dist/utils/prompt_optimization.js +0 -275
  246. package/dist/utils/responses.d.ts +0 -35
  247. package/dist/utils/responses.d.ts.map +0 -1
  248. package/dist/utils/responses.js +0 -37
  249. package/dist/utils/stream.d.ts +0 -13
  250. package/dist/utils/stream.d.ts.map +0 -1
  251. package/dist/utils/stream.js +0 -64
  252. package/dist/utils/stream_context_managers.d.ts +0 -147
  253. package/dist/utils/stream_context_managers.d.ts.map +0 -1
  254. package/dist/utils/stream_context_managers.js +0 -380
  255. package/dist/utils/usage.d.ts +0 -57
  256. package/dist/utils/usage.d.ts.map +0 -1
  257. package/dist/utils/usage.js +0 -97
  258. package/dist/utils/webhook_secrets.d.ts +0 -59
  259. package/dist/utils/webhook_secrets.d.ts.map +0 -1
  260. package/dist/utils/webhook_secrets.js +0 -107
  261. package/dist/utils/zod_to_json_schema.d.ts +0 -11
  262. package/dist/utils/zod_to_json_schema.d.ts.map +0 -1
  263. package/dist/utils/zod_to_json_schema.js +0 -123
@@ -1,156 +0,0 @@
1
- import { SyncAPIResource, AsyncAPIResource } from '../../resource.js';
2
- export class IterationsMixin {
3
- prepareCreate(evaluation_id, params) {
4
- return {
5
- method: 'POST',
6
- url: `/v1/evaluations/${evaluation_id}/iterations`,
7
- data: params,
8
- };
9
- }
10
- prepareList(evaluation_id, params = {}) {
11
- const { before, after, limit = 10, order = 'desc', } = params;
12
- const queryParams = {};
13
- if (before !== undefined)
14
- queryParams.before = before;
15
- if (after !== undefined)
16
- queryParams.after = after;
17
- if (limit !== undefined)
18
- queryParams.limit = limit;
19
- if (order !== undefined)
20
- queryParams.order = order;
21
- return {
22
- method: 'GET',
23
- url: `/v1/evaluations/${evaluation_id}/iterations`,
24
- params: queryParams,
25
- };
26
- }
27
- prepareGet(evaluation_id, iteration_id) {
28
- return {
29
- method: 'GET',
30
- url: `/v1/evaluations/${evaluation_id}/iterations/${iteration_id}`,
31
- };
32
- }
33
- preparePatch(evaluation_id, iteration_id, params) {
34
- return {
35
- method: 'PATCH',
36
- url: `/v1/evaluations/${evaluation_id}/iterations/${iteration_id}`,
37
- data: params,
38
- };
39
- }
40
- prepareDelete(evaluation_id, iteration_id) {
41
- return {
42
- method: 'DELETE',
43
- url: `/v1/evaluations/${evaluation_id}/iterations/${iteration_id}`,
44
- };
45
- }
46
- prepareProcess(evaluation_id, iteration_id, params) {
47
- return {
48
- method: 'POST',
49
- url: `/v1/evaluations/${evaluation_id}/iterations/${iteration_id}/process`,
50
- data: params,
51
- };
52
- }
53
- prepareDocumentStatus(evaluation_id, iteration_id) {
54
- return {
55
- method: 'GET',
56
- url: `/v1/evaluations/${evaluation_id}/iterations/${iteration_id}/document-status`,
57
- };
58
- }
59
- prepareAddFromJsonl(evaluation_id, params) {
60
- return {
61
- method: 'POST',
62
- url: `/v1/evaluations/${evaluation_id}/iterations/add-from-jsonl`,
63
- data: params,
64
- };
65
- }
66
- }
67
- export class Iterations extends SyncAPIResource {
68
- constructor() {
69
- super(...arguments);
70
- this.mixin = new IterationsMixin();
71
- }
72
- create(evaluation_id, params) {
73
- const preparedRequest = this.mixin.prepareCreate(evaluation_id, params);
74
- const response = this._client._preparedRequest(preparedRequest);
75
- return response;
76
- }
77
- list(evaluation_id, params = {}) {
78
- const preparedRequest = this.mixin.prepareList(evaluation_id, params);
79
- const response = this._client._preparedRequest(preparedRequest);
80
- return response;
81
- }
82
- get(evaluation_id, iteration_id) {
83
- const preparedRequest = this.mixin.prepareGet(evaluation_id, iteration_id);
84
- const response = this._client._preparedRequest(preparedRequest);
85
- return response;
86
- }
87
- patch(evaluation_id, iteration_id, params) {
88
- const preparedRequest = this.mixin.preparePatch(evaluation_id, iteration_id, params);
89
- const response = this._client._preparedRequest(preparedRequest);
90
- return response;
91
- }
92
- delete(evaluation_id, iteration_id) {
93
- const preparedRequest = this.mixin.prepareDelete(evaluation_id, iteration_id);
94
- this._client._preparedRequest(preparedRequest);
95
- }
96
- process(evaluation_id, iteration_id, params) {
97
- const preparedRequest = this.mixin.prepareProcess(evaluation_id, iteration_id, params);
98
- const response = this._client._preparedRequest(preparedRequest);
99
- return response;
100
- }
101
- documentStatus(evaluation_id, iteration_id) {
102
- const preparedRequest = this.mixin.prepareDocumentStatus(evaluation_id, iteration_id);
103
- const response = this._client._preparedRequest(preparedRequest);
104
- return response;
105
- }
106
- addFromJsonl(evaluation_id, params) {
107
- const preparedRequest = this.mixin.prepareAddFromJsonl(evaluation_id, params);
108
- const response = this._client._preparedRequest(preparedRequest);
109
- return response;
110
- }
111
- }
112
- export class AsyncIterations extends AsyncAPIResource {
113
- constructor() {
114
- super(...arguments);
115
- this.mixin = new IterationsMixin();
116
- }
117
- async create(evaluation_id, params) {
118
- const preparedRequest = this.mixin.prepareCreate(evaluation_id, params);
119
- const response = await this._client._preparedRequest(preparedRequest);
120
- return response;
121
- }
122
- async list(evaluation_id, params = {}) {
123
- const preparedRequest = this.mixin.prepareList(evaluation_id, params);
124
- const response = await this._client._preparedRequest(preparedRequest);
125
- return response;
126
- }
127
- async get(evaluation_id, iteration_id) {
128
- const preparedRequest = this.mixin.prepareGet(evaluation_id, iteration_id);
129
- const response = await this._client._preparedRequest(preparedRequest);
130
- return response;
131
- }
132
- async patch(evaluation_id, iteration_id, params) {
133
- const preparedRequest = this.mixin.preparePatch(evaluation_id, iteration_id, params);
134
- const response = await this._client._preparedRequest(preparedRequest);
135
- return response;
136
- }
137
- async delete(evaluation_id, iteration_id) {
138
- const preparedRequest = this.mixin.prepareDelete(evaluation_id, iteration_id);
139
- await this._client._preparedRequest(preparedRequest);
140
- }
141
- async process(evaluation_id, iteration_id, params) {
142
- const preparedRequest = this.mixin.prepareProcess(evaluation_id, iteration_id, params);
143
- const response = await this._client._preparedRequest(preparedRequest);
144
- return response;
145
- }
146
- async documentStatus(evaluation_id, iteration_id) {
147
- const preparedRequest = this.mixin.prepareDocumentStatus(evaluation_id, iteration_id);
148
- const response = await this._client._preparedRequest(preparedRequest);
149
- return response;
150
- }
151
- async addFromJsonl(evaluation_id, params) {
152
- const preparedRequest = this.mixin.prepareAddFromJsonl(evaluation_id, params);
153
- const response = await this._client._preparedRequest(preparedRequest);
154
- return response;
155
- }
156
- }
@@ -1,82 +0,0 @@
1
- import { SyncAPIResource, AsyncAPIResource } from '../resource.js';
2
- type FilePurpose = 'assistants' | 'batch' | 'fine-tune' | 'vision';
3
- export declare class Files extends SyncAPIResource {
4
- /**
5
- * Create a file using OpenAI's API.
6
- * This integrates with the OpenAI SDK to upload files.
7
- *
8
- * @param file - The file to upload
9
- * @param purpose - The purpose of the file upload
10
- * @returns Promise<any> - The OpenAI file response
11
- */
12
- create(file: any, purpose: FilePurpose): Promise<any>;
13
- /**
14
- * List files using OpenAI's API.
15
- *
16
- * @param purpose - Optional purpose filter
17
- * @returns Promise<any> - The OpenAI files list response
18
- */
19
- list(purpose?: FilePurpose): Promise<any>;
20
- /**
21
- * Retrieve a file using OpenAI's API.
22
- *
23
- * @param fileId - The ID of the file to retrieve
24
- * @returns Promise<any> - The OpenAI file response
25
- */
26
- retrieve(fileId: string): Promise<any>;
27
- /**
28
- * Delete a file using OpenAI's API.
29
- *
30
- * @param fileId - The ID of the file to delete
31
- * @returns Promise<any> - The OpenAI delete response
32
- */
33
- delete(fileId: string): Promise<any>;
34
- /**
35
- * Retrieve file content using OpenAI's API.
36
- *
37
- * @param fileId - The ID of the file to retrieve content for
38
- * @returns Promise<any> - The file content
39
- */
40
- content(fileId: string): Promise<any>;
41
- }
42
- export declare class AsyncFiles extends AsyncAPIResource {
43
- /**
44
- * Create a file using OpenAI's API asynchronously.
45
- * This integrates with the OpenAI SDK to upload files.
46
- *
47
- * @param file - The file to upload
48
- * @param purpose - The purpose of the file upload
49
- * @returns Promise<any> - The OpenAI file response
50
- */
51
- create(file: any, purpose: FilePurpose): Promise<any>;
52
- /**
53
- * List files using OpenAI's API asynchronously.
54
- *
55
- * @param purpose - Optional purpose filter
56
- * @returns Promise<any> - The OpenAI files list response
57
- */
58
- list(purpose?: FilePurpose): Promise<any>;
59
- /**
60
- * Retrieve a file using OpenAI's API asynchronously.
61
- *
62
- * @param fileId - The ID of the file to retrieve
63
- * @returns Promise<any> - The OpenAI file response
64
- */
65
- retrieve(fileId: string): Promise<any>;
66
- /**
67
- * Delete a file using OpenAI's API asynchronously.
68
- *
69
- * @param fileId - The ID of the file to delete
70
- * @returns Promise<any> - The OpenAI delete response
71
- */
72
- delete(fileId: string): Promise<any>;
73
- /**
74
- * Retrieve file content using OpenAI's API asynchronously.
75
- *
76
- * @param fileId - The ID of the file to retrieve content for
77
- * @returns Promise<any> - The file content
78
- */
79
- content(fileId: string): Promise<any>;
80
- }
81
- export {};
82
- //# sourceMappingURL=files.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/resources/files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGnE,KAAK,WAAW,GAAG,YAAY,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,CAAC;AAEnE,qBAAa,KAAM,SAAQ,eAAe;IACxC;;;;;;;OAOG;IACG,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;IAU3D;;;;;OAKG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;IAU/C;;;;;OAKG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAU5C;;;;;OAKG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAU1C;;;;;OAKG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAS5C;AAED,qBAAa,UAAW,SAAQ,gBAAgB;IAC9C;;;;;;;OAOG;IACG,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;IAU3D;;;;;OAKG;IACG,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;IAU/C;;;;;OAKG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAU5C;;;;;OAKG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAU1C;;;;;OAKG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAS5C"}
@@ -1,150 +0,0 @@
1
- import { SyncAPIResource, AsyncAPIResource } from '../resource.js';
2
- import OpenAI from 'openai';
3
- export class Files extends SyncAPIResource {
4
- /**
5
- * Create a file using OpenAI's API.
6
- * This integrates with the OpenAI SDK to upload files.
7
- *
8
- * @param file - The file to upload
9
- * @param purpose - The purpose of the file upload
10
- * @returns Promise<any> - The OpenAI file response
11
- */
12
- async create(file, purpose) {
13
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
14
- if (!openaiApiKey) {
15
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
16
- }
17
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
18
- return await openaiClient.files.create({ file, purpose });
19
- }
20
- /**
21
- * List files using OpenAI's API.
22
- *
23
- * @param purpose - Optional purpose filter
24
- * @returns Promise<any> - The OpenAI files list response
25
- */
26
- async list(purpose) {
27
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
28
- if (!openaiApiKey) {
29
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
30
- }
31
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
32
- return await openaiClient.files.list({ purpose });
33
- }
34
- /**
35
- * Retrieve a file using OpenAI's API.
36
- *
37
- * @param fileId - The ID of the file to retrieve
38
- * @returns Promise<any> - The OpenAI file response
39
- */
40
- async retrieve(fileId) {
41
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
42
- if (!openaiApiKey) {
43
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
44
- }
45
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
46
- return await openaiClient.files.retrieve(fileId);
47
- }
48
- /**
49
- * Delete a file using OpenAI's API.
50
- *
51
- * @param fileId - The ID of the file to delete
52
- * @returns Promise<any> - The OpenAI delete response
53
- */
54
- async delete(fileId) {
55
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
56
- if (!openaiApiKey) {
57
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
58
- }
59
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
60
- return await openaiClient.files.delete(fileId);
61
- }
62
- /**
63
- * Retrieve file content using OpenAI's API.
64
- *
65
- * @param fileId - The ID of the file to retrieve content for
66
- * @returns Promise<any> - The file content
67
- */
68
- async content(fileId) {
69
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
70
- if (!openaiApiKey) {
71
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
72
- }
73
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
74
- return await openaiClient.files.content(fileId);
75
- }
76
- }
77
- export class AsyncFiles extends AsyncAPIResource {
78
- /**
79
- * Create a file using OpenAI's API asynchronously.
80
- * This integrates with the OpenAI SDK to upload files.
81
- *
82
- * @param file - The file to upload
83
- * @param purpose - The purpose of the file upload
84
- * @returns Promise<any> - The OpenAI file response
85
- */
86
- async create(file, purpose) {
87
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
88
- if (!openaiApiKey) {
89
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
90
- }
91
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
92
- return await openaiClient.files.create({ file, purpose });
93
- }
94
- /**
95
- * List files using OpenAI's API asynchronously.
96
- *
97
- * @param purpose - Optional purpose filter
98
- * @returns Promise<any> - The OpenAI files list response
99
- */
100
- async list(purpose) {
101
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
102
- if (!openaiApiKey) {
103
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
104
- }
105
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
106
- return await openaiClient.files.list({ purpose });
107
- }
108
- /**
109
- * Retrieve a file using OpenAI's API asynchronously.
110
- *
111
- * @param fileId - The ID of the file to retrieve
112
- * @returns Promise<any> - The OpenAI file response
113
- */
114
- async retrieve(fileId) {
115
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
116
- if (!openaiApiKey) {
117
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
118
- }
119
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
120
- return await openaiClient.files.retrieve(fileId);
121
- }
122
- /**
123
- * Delete a file using OpenAI's API asynchronously.
124
- *
125
- * @param fileId - The ID of the file to delete
126
- * @returns Promise<any> - The OpenAI delete response
127
- */
128
- async delete(fileId) {
129
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
130
- if (!openaiApiKey) {
131
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
132
- }
133
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
134
- return await openaiClient.files.delete(fileId);
135
- }
136
- /**
137
- * Retrieve file content using OpenAI's API asynchronously.
138
- *
139
- * @param fileId - The ID of the file to retrieve content for
140
- * @returns Promise<any> - The file content
141
- */
142
- async content(fileId) {
143
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
144
- if (!openaiApiKey) {
145
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
146
- }
147
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
148
- return await openaiClient.files.content(fileId);
149
- }
150
- }
@@ -1,105 +0,0 @@
1
- import { SyncAPIResource, AsyncAPIResource } from '../resource.js';
2
- export declare class FineTuningJobs extends SyncAPIResource {
3
- /**
4
- * Create a new fine-tuning job.
5
- *
6
- * @param training_file - The ID of the uploaded training file
7
- * @param model - The model to fine-tune
8
- * @returns The fine-tuning job response
9
- */
10
- create(params: {
11
- training_file: string;
12
- model: string;
13
- validation_file?: string;
14
- hyperparameters?: {
15
- batch_size?: number | 'auto';
16
- learning_rate_multiplier?: number | 'auto';
17
- n_epochs?: number | 'auto';
18
- };
19
- suffix?: string;
20
- }): Promise<any>;
21
- /**
22
- * Retrieve the status of a fine-tuning job.
23
- *
24
- * @param fine_tuning_job_id - The ID of the fine-tuning job
25
- * @returns The fine-tuning job response
26
- */
27
- retrieve(fine_tuning_job_id: string): Promise<any>;
28
- /**
29
- * List fine-tuning jobs.
30
- *
31
- * @param params - Optional parameters for listing
32
- * @returns List of fine-tuning jobs
33
- */
34
- list(params?: {
35
- after?: string;
36
- limit?: number;
37
- }): Promise<any>;
38
- /**
39
- * Cancel a fine-tuning job.
40
- *
41
- * @param fine_tuning_job_id - The ID of the fine-tuning job to cancel
42
- * @returns The cancelled fine-tuning job response
43
- */
44
- cancel(fine_tuning_job_id: string): Promise<any>;
45
- /**
46
- * List events for a fine-tuning job.
47
- *
48
- * @param fine_tuning_job_id - The ID of the fine-tuning job
49
- * @param params - Optional parameters for listing events
50
- * @returns List of fine-tuning job events
51
- */
52
- listEvents(fine_tuning_job_id: string, params?: {
53
- after?: string;
54
- limit?: number;
55
- }): Promise<any>;
56
- }
57
- export declare class AsyncFineTuningJobs extends AsyncAPIResource {
58
- /**
59
- * Create a new fine-tuning job asynchronously.
60
- */
61
- create(params: {
62
- training_file: string;
63
- model: string;
64
- validation_file?: string;
65
- hyperparameters?: {
66
- batch_size?: number | 'auto';
67
- learning_rate_multiplier?: number | 'auto';
68
- n_epochs?: number | 'auto';
69
- };
70
- suffix?: string;
71
- }): Promise<any>;
72
- /**
73
- * Retrieve the status of a fine-tuning job asynchronously.
74
- */
75
- retrieve(fine_tuning_job_id: string): Promise<any>;
76
- /**
77
- * List fine-tuning jobs asynchronously.
78
- */
79
- list(params?: {
80
- after?: string;
81
- limit?: number;
82
- }): Promise<any>;
83
- /**
84
- * Cancel a fine-tuning job asynchronously.
85
- */
86
- cancel(fine_tuning_job_id: string): Promise<any>;
87
- /**
88
- * List events for a fine-tuning job asynchronously.
89
- */
90
- listEvents(fine_tuning_job_id: string, params?: {
91
- after?: string;
92
- limit?: number;
93
- }): Promise<any>;
94
- }
95
- export declare class FineTuning extends SyncAPIResource {
96
- private _jobs;
97
- constructor(client: any);
98
- get jobs(): FineTuningJobs;
99
- }
100
- export declare class AsyncFineTuning extends AsyncAPIResource {
101
- private _jobs;
102
- constructor(client: any);
103
- get jobs(): AsyncFineTuningJobs;
104
- }
105
- //# sourceMappingURL=finetuning.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"finetuning.d.ts","sourceRoot":"","sources":["../../src/resources/finetuning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAcnE,qBAAa,cAAe,SAAQ,eAAe;IACjD;;;;;;OAMG;IACG,MAAM,CAAC,MAAM,EAAE;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,EAAE,MAAM,CAAC;QACd,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,eAAe,CAAC,EAAE;YAChB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;YAC7B,wBAAwB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;YAC3C,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;SAC5B,CAAC;QACF,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,GAAG,CAAC;IAuBhB;;;;;OAKG;IACG,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAUxD;;;;;OAKG;IACG,IAAI,CAAC,MAAM,GAAE;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KACX,GAAG,OAAO,CAAC,GAAG,CAAC;IAUrB;;;;;OAKG;IACG,MAAM,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAUtD;;;;;;OAMG;IACG,UAAU,CAAC,kBAAkB,EAAE,MAAM,EAAE,MAAM,GAAE;QACnD,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KACX,GAAG,OAAO,CAAC,GAAG,CAAC;CAStB;AAED,qBAAa,mBAAoB,SAAQ,gBAAgB;IACvD;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,KAAK,EAAE,MAAM,CAAC;QACd,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,eAAe,CAAC,EAAE;YAChB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;YAC7B,wBAAwB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;YAC3C,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;SAC5B,CAAC;QACF,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,GAAG,CAAC;IAuBhB;;OAEG;IACG,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAUxD;;OAEG;IACG,IAAI,CAAC,MAAM,GAAE;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KACX,GAAG,OAAO,CAAC,GAAG,CAAC;IAUrB;;OAEG;IACG,MAAM,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAUtD;;OAEG;IACG,UAAU,CAAC,kBAAkB,EAAE,MAAM,EAAE,MAAM,GAAE;QACnD,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KACX,GAAG,OAAO,CAAC,GAAG,CAAC;CAStB;AAED,qBAAa,UAAW,SAAQ,eAAe;IAC7C,OAAO,CAAC,KAAK,CAAiB;gBAElB,MAAM,EAAE,GAAG;IAKvB,IAAI,IAAI,IAAI,cAAc,CAEzB;CACF;AAED,qBAAa,eAAgB,SAAQ,gBAAgB;IACnD,OAAO,CAAC,KAAK,CAAsB;gBAEvB,MAAM,EAAE,GAAG;IAKvB,IAAI,IAAI,IAAI,mBAAmB,CAE9B;CACF"}
@@ -1,181 +0,0 @@
1
- import { SyncAPIResource, AsyncAPIResource } from '../resource.js';
2
- import OpenAI from 'openai';
3
- // Valid OpenAI models for fine-tuning (using string array to avoid type conflicts)
4
- const VALID_OPENAI_MODELS = [
5
- 'gpt-4o-mini-2024-07-18',
6
- 'gpt-4o-2024-08-06',
7
- 'gpt-3.5-turbo-0125',
8
- 'gpt-3.5-turbo-1106',
9
- 'gpt-3.5-turbo-0613',
10
- 'davinci-002',
11
- 'babbage-002'
12
- ];
13
- export class FineTuningJobs extends SyncAPIResource {
14
- /**
15
- * Create a new fine-tuning job.
16
- *
17
- * @param training_file - The ID of the uploaded training file
18
- * @param model - The model to fine-tune
19
- * @returns The fine-tuning job response
20
- */
21
- async create(params) {
22
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
23
- if (!openaiApiKey) {
24
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
25
- }
26
- // Validate model
27
- if (!VALID_OPENAI_MODELS.includes(params.model)) {
28
- throw new Error(`Model ${params.model} is not supported. Supported models are: ${VALID_OPENAI_MODELS.join(', ')}`);
29
- }
30
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
31
- return await openaiClient.fineTuning.jobs.create({
32
- training_file: params.training_file,
33
- model: params.model,
34
- validation_file: params.validation_file,
35
- hyperparameters: params.hyperparameters,
36
- suffix: params.suffix,
37
- });
38
- }
39
- /**
40
- * Retrieve the status of a fine-tuning job.
41
- *
42
- * @param fine_tuning_job_id - The ID of the fine-tuning job
43
- * @returns The fine-tuning job response
44
- */
45
- async retrieve(fine_tuning_job_id) {
46
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
47
- if (!openaiApiKey) {
48
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
49
- }
50
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
51
- return await openaiClient.fineTuning.jobs.retrieve(fine_tuning_job_id);
52
- }
53
- /**
54
- * List fine-tuning jobs.
55
- *
56
- * @param params - Optional parameters for listing
57
- * @returns List of fine-tuning jobs
58
- */
59
- async list(params = {}) {
60
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
61
- if (!openaiApiKey) {
62
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
63
- }
64
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
65
- return await openaiClient.fineTuning.jobs.list(params);
66
- }
67
- /**
68
- * Cancel a fine-tuning job.
69
- *
70
- * @param fine_tuning_job_id - The ID of the fine-tuning job to cancel
71
- * @returns The cancelled fine-tuning job response
72
- */
73
- async cancel(fine_tuning_job_id) {
74
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
75
- if (!openaiApiKey) {
76
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
77
- }
78
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
79
- return await openaiClient.fineTuning.jobs.cancel(fine_tuning_job_id);
80
- }
81
- /**
82
- * List events for a fine-tuning job.
83
- *
84
- * @param fine_tuning_job_id - The ID of the fine-tuning job
85
- * @param params - Optional parameters for listing events
86
- * @returns List of fine-tuning job events
87
- */
88
- async listEvents(fine_tuning_job_id, params = {}) {
89
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
90
- if (!openaiApiKey) {
91
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
92
- }
93
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
94
- return await openaiClient.fineTuning.jobs.listEvents(fine_tuning_job_id, params);
95
- }
96
- }
97
- export class AsyncFineTuningJobs extends AsyncAPIResource {
98
- /**
99
- * Create a new fine-tuning job asynchronously.
100
- */
101
- async create(params) {
102
- // Validate model
103
- if (!VALID_OPENAI_MODELS.includes(params.model)) {
104
- throw new Error(`Model ${params.model} is not supported. Supported models are: ${VALID_OPENAI_MODELS.join(', ')}`);
105
- }
106
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
107
- if (!openaiApiKey) {
108
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
109
- }
110
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
111
- return await openaiClient.fineTuning.jobs.create({
112
- training_file: params.training_file,
113
- model: params.model,
114
- validation_file: params.validation_file,
115
- hyperparameters: params.hyperparameters,
116
- suffix: params.suffix,
117
- });
118
- }
119
- /**
120
- * Retrieve the status of a fine-tuning job asynchronously.
121
- */
122
- async retrieve(fine_tuning_job_id) {
123
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
124
- if (!openaiApiKey) {
125
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
126
- }
127
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
128
- return await openaiClient.fineTuning.jobs.retrieve(fine_tuning_job_id);
129
- }
130
- /**
131
- * List fine-tuning jobs asynchronously.
132
- */
133
- async list(params = {}) {
134
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
135
- if (!openaiApiKey) {
136
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
137
- }
138
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
139
- return await openaiClient.fineTuning.jobs.list(params);
140
- }
141
- /**
142
- * Cancel a fine-tuning job asynchronously.
143
- */
144
- async cancel(fine_tuning_job_id) {
145
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
146
- if (!openaiApiKey) {
147
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
148
- }
149
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
150
- return await openaiClient.fineTuning.jobs.cancel(fine_tuning_job_id);
151
- }
152
- /**
153
- * List events for a fine-tuning job asynchronously.
154
- */
155
- async listEvents(fine_tuning_job_id, params = {}) {
156
- const openaiApiKey = this._client.getHeaders()['OpenAI-Api-Key'];
157
- if (!openaiApiKey) {
158
- throw new Error('OpenAI API key not found. Please provide it in the client configuration.');
159
- }
160
- const openaiClient = new OpenAI({ apiKey: openaiApiKey });
161
- return await openaiClient.fineTuning.jobs.listEvents(fine_tuning_job_id, params);
162
- }
163
- }
164
- export class FineTuning extends SyncAPIResource {
165
- constructor(client) {
166
- super(client);
167
- this._jobs = new FineTuningJobs(client);
168
- }
169
- get jobs() {
170
- return this._jobs;
171
- }
172
- }
173
- export class AsyncFineTuning extends AsyncAPIResource {
174
- constructor(client) {
175
- super(client);
176
- this._jobs = new AsyncFineTuningJobs(client);
177
- }
178
- get jobs() {
179
- return this._jobs;
180
- }
181
- }