openai 1.1.3 → 2.0.4

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.
package/api.ts ADDED
@@ -0,0 +1,2481 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * OpenAI API
5
+ * APIs for sampling from and fine-tuning language models
6
+ *
7
+ * The version of the OpenAPI document: 1.0.3
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import { Configuration } from './configuration';
17
+ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
18
+ // Some imports not used depending on template conditions
19
+ // @ts-ignore
20
+ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
21
+ // @ts-ignore
22
+ import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';
23
+
24
+ /**
25
+ *
26
+ * @export
27
+ * @interface CreateAnswerRequest
28
+ */
29
+ export interface CreateAnswerRequest {
30
+ /**
31
+ * ID of the engine to use for completion. You can select one of `ada`, `babbage`, `curie`, or `davinci`.
32
+ * @type {string}
33
+ * @memberof CreateAnswerRequest
34
+ */
35
+ 'model': string;
36
+ /**
37
+ * Question to get answered.
38
+ * @type {string}
39
+ * @memberof CreateAnswerRequest
40
+ */
41
+ 'question': string;
42
+ /**
43
+ * List of (question, answer) pairs that will help steer the model towards the tone and answer format you\'d like. We recommend adding 2 to 3 examples.
44
+ * @type {Array<any>}
45
+ * @memberof CreateAnswerRequest
46
+ */
47
+ 'examples': Array<any>;
48
+ /**
49
+ * A text snippet containing the contextual information used to generate the answers for the `examples` you provide.
50
+ * @type {string}
51
+ * @memberof CreateAnswerRequest
52
+ */
53
+ 'examples_context': string;
54
+ /**
55
+ * List of documents from which the answer for the input `question` should be derived. If this is an empty list, the question will be answered based on the question-answer examples. You should specify either `documents` or a `file`, but not both.
56
+ * @type {Array<string>}
57
+ * @memberof CreateAnswerRequest
58
+ */
59
+ 'documents'?: Array<string> | null;
60
+ /**
61
+ * The ID of an uploaded file that contains documents to search over. See [upload file](/docs/api-reference/files/upload) for how to upload a file of the desired format and purpose. You should specify either `documents` or a `file`, but not both.
62
+ * @type {string}
63
+ * @memberof CreateAnswerRequest
64
+ */
65
+ 'file'?: string | null;
66
+ /**
67
+ * ID of the engine to use for [Search](/docs/api-reference/searches/create). You can select one of `ada`, `babbage`, `curie`, or `davinci`.
68
+ * @type {string}
69
+ * @memberof CreateAnswerRequest
70
+ */
71
+ 'search_model'?: string | null;
72
+ /**
73
+ * The maximum number of documents to be ranked by [Search](/docs/api-reference/searches/create) when using `file`. Setting it to a higher value leads to improved accuracy but with increased latency and cost.
74
+ * @type {number}
75
+ * @memberof CreateAnswerRequest
76
+ */
77
+ 'max_rerank'?: number | null;
78
+ /**
79
+ * What [sampling temperature](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277) to use. Higher values mean the model will take more risks and value 0 (argmax sampling) works better for scenarios with a well-defined answer.
80
+ * @type {number}
81
+ * @memberof CreateAnswerRequest
82
+ */
83
+ 'temperature'?: number | null;
84
+ /**
85
+ * Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. The maximum value for `logprobs` is 5. If you need more than this, please contact support@openai.com and describe your use case. When `logprobs` is set, `completion` will be automatically added into `expand` to get the logprobs.
86
+ * @type {number}
87
+ * @memberof CreateAnswerRequest
88
+ */
89
+ 'logprobs'?: number | null;
90
+ /**
91
+ * The maximum number of tokens allowed for the generated answer
92
+ * @type {number}
93
+ * @memberof CreateAnswerRequest
94
+ */
95
+ 'max_tokens'?: number | null;
96
+ /**
97
+ * Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
98
+ * @type {string | Array<string>}
99
+ * @memberof CreateAnswerRequest
100
+ */
101
+ 'stop'?: string | Array<string> | null;
102
+ /**
103
+ * How many answers to generate for each question.
104
+ * @type {number}
105
+ * @memberof CreateAnswerRequest
106
+ */
107
+ 'n'?: number | null;
108
+ /**
109
+ * Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. As an example, you can pass `{\"50256\": -100}` to prevent the <|endoftext|> token from being generated.
110
+ * @type {object}
111
+ * @memberof CreateAnswerRequest
112
+ */
113
+ 'logit_bias'?: object | null;
114
+ /**
115
+ * A special boolean flag for showing metadata. If set to `true`, each document entry in the returned JSON will contain a \"metadata\" field. This flag only takes effect when `file` is set.
116
+ * @type {boolean}
117
+ * @memberof CreateAnswerRequest
118
+ */
119
+ 'return_metadata'?: boolean | null;
120
+ /**
121
+ * If set to `true`, the returned JSON will include a \"prompt\" field containing the final prompt that was used to request a completion. This is mainly useful for debugging purposes.
122
+ * @type {boolean}
123
+ * @memberof CreateAnswerRequest
124
+ */
125
+ 'return_prompt'?: boolean | null;
126
+ /**
127
+ * If an object name is in the list, we provide the full information of the object; otherwise, we only provide the object ID. Currently we support `completion` and `file` objects for expansion.
128
+ * @type {Array<any>}
129
+ * @memberof CreateAnswerRequest
130
+ */
131
+ 'expand'?: Array<any> | null;
132
+ /**
133
+ * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
134
+ * @type {string}
135
+ * @memberof CreateAnswerRequest
136
+ */
137
+ 'user'?: string;
138
+ }
139
+ /**
140
+ *
141
+ * @export
142
+ * @interface CreateAnswerResponse
143
+ */
144
+ export interface CreateAnswerResponse {
145
+ /**
146
+ *
147
+ * @type {string}
148
+ * @memberof CreateAnswerResponse
149
+ */
150
+ 'object'?: string;
151
+ /**
152
+ *
153
+ * @type {string}
154
+ * @memberof CreateAnswerResponse
155
+ */
156
+ 'model'?: string;
157
+ /**
158
+ *
159
+ * @type {string}
160
+ * @memberof CreateAnswerResponse
161
+ */
162
+ 'search_model'?: string;
163
+ /**
164
+ *
165
+ * @type {string}
166
+ * @memberof CreateAnswerResponse
167
+ */
168
+ 'completion'?: string;
169
+ /**
170
+ *
171
+ * @type {Array<string>}
172
+ * @memberof CreateAnswerResponse
173
+ */
174
+ 'answers'?: Array<string>;
175
+ /**
176
+ *
177
+ * @type {Array<CreateAnswerResponseSelectedDocuments>}
178
+ * @memberof CreateAnswerResponse
179
+ */
180
+ 'selected_documents'?: Array<CreateAnswerResponseSelectedDocuments>;
181
+ }
182
+ /**
183
+ *
184
+ * @export
185
+ * @interface CreateAnswerResponseSelectedDocuments
186
+ */
187
+ export interface CreateAnswerResponseSelectedDocuments {
188
+ /**
189
+ *
190
+ * @type {number}
191
+ * @memberof CreateAnswerResponseSelectedDocuments
192
+ */
193
+ 'document'?: number;
194
+ /**
195
+ *
196
+ * @type {string}
197
+ * @memberof CreateAnswerResponseSelectedDocuments
198
+ */
199
+ 'text'?: string;
200
+ }
201
+ /**
202
+ *
203
+ * @export
204
+ * @interface CreateClassificationRequest
205
+ */
206
+ export interface CreateClassificationRequest {
207
+ /**
208
+ * ID of the engine to use for completion. You can select one of `ada`, `babbage`, `curie`, or `davinci`.
209
+ * @type {string}
210
+ * @memberof CreateClassificationRequest
211
+ */
212
+ 'model': string;
213
+ /**
214
+ * Query to be classified.
215
+ * @type {string}
216
+ * @memberof CreateClassificationRequest
217
+ */
218
+ 'query': string;
219
+ /**
220
+ * A list of examples with labels, in the following format: `[[\"The movie is so interesting.\", \"Positive\"], [\"It is quite boring.\", \"Negative\"], ...]` All the label strings will be normalized to be capitalized. You should specify either `examples` or `file`, but not both.
221
+ * @type {Array<any>}
222
+ * @memberof CreateClassificationRequest
223
+ */
224
+ 'examples'?: Array<any> | null;
225
+ /**
226
+ * The ID of the uploaded file that contains training examples. See [upload file](/docs/api-reference/files/upload) for how to upload a file of the desired format and purpose. You should specify either `examples` or `file`, but not both.
227
+ * @type {string}
228
+ * @memberof CreateClassificationRequest
229
+ */
230
+ 'file'?: string | null;
231
+ /**
232
+ * The set of categories being classified. If not specified, candidate labels will be automatically collected from the examples you provide. All the label strings will be normalized to be capitalized.
233
+ * @type {Array<string>}
234
+ * @memberof CreateClassificationRequest
235
+ */
236
+ 'labels'?: Array<string> | null;
237
+ /**
238
+ * ID of the engine to use for [Search](/docs/api-reference/searches/create). You can select one of `ada`, `babbage`, `curie`, or `davinci`.
239
+ * @type {string}
240
+ * @memberof CreateClassificationRequest
241
+ */
242
+ 'search_model'?: string | null;
243
+ /**
244
+ * What sampling `temperature` to use. Higher values mean the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer.
245
+ * @type {number}
246
+ * @memberof CreateClassificationRequest
247
+ */
248
+ 'temperature'?: number | null;
249
+ /**
250
+ * Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. The maximum value for `logprobs` is 5. If you need more than this, please contact support@openai.com and describe your use case. When `logprobs` is set, `completion` will be automatically added into `expand` to get the logprobs.
251
+ * @type {number}
252
+ * @memberof CreateClassificationRequest
253
+ */
254
+ 'logprobs'?: number | null;
255
+ /**
256
+ * The maximum number of examples to be ranked by [Search](/docs/api-reference/searches/create) when using `file`. Setting it to a higher value leads to improved accuracy but with increased latency and cost.
257
+ * @type {number}
258
+ * @memberof CreateClassificationRequest
259
+ */
260
+ 'max_examples'?: number | null;
261
+ /**
262
+ * Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. As an example, you can pass `{\"50256\": -100}` to prevent the <|endoftext|> token from being generated.
263
+ * @type {object}
264
+ * @memberof CreateClassificationRequest
265
+ */
266
+ 'logit_bias'?: object | null;
267
+ /**
268
+ * If set to `true`, the returned JSON will include a \"prompt\" field containing the final prompt that was used to request a completion. This is mainly useful for debugging purposes.
269
+ * @type {boolean}
270
+ * @memberof CreateClassificationRequest
271
+ */
272
+ 'return_prompt'?: boolean | null;
273
+ /**
274
+ * A special boolean flag for showing metadata. If set to `true`, each document entry in the returned JSON will contain a \"metadata\" field. This flag only takes effect when `file` is set.
275
+ * @type {boolean}
276
+ * @memberof CreateClassificationRequest
277
+ */
278
+ 'return_metadata'?: boolean | null;
279
+ /**
280
+ * If an object name is in the list, we provide the full information of the object; otherwise, we only provide the object ID. Currently we support `completion` and `file` objects for expansion.
281
+ * @type {Array<any>}
282
+ * @memberof CreateClassificationRequest
283
+ */
284
+ 'expand'?: Array<any> | null;
285
+ /**
286
+ * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
287
+ * @type {string}
288
+ * @memberof CreateClassificationRequest
289
+ */
290
+ 'user'?: string;
291
+ }
292
+ /**
293
+ *
294
+ * @export
295
+ * @interface CreateClassificationResponse
296
+ */
297
+ export interface CreateClassificationResponse {
298
+ /**
299
+ *
300
+ * @type {string}
301
+ * @memberof CreateClassificationResponse
302
+ */
303
+ 'object'?: string;
304
+ /**
305
+ *
306
+ * @type {string}
307
+ * @memberof CreateClassificationResponse
308
+ */
309
+ 'model'?: string;
310
+ /**
311
+ *
312
+ * @type {string}
313
+ * @memberof CreateClassificationResponse
314
+ */
315
+ 'search_model'?: string;
316
+ /**
317
+ *
318
+ * @type {string}
319
+ * @memberof CreateClassificationResponse
320
+ */
321
+ 'completion'?: string;
322
+ /**
323
+ *
324
+ * @type {string}
325
+ * @memberof CreateClassificationResponse
326
+ */
327
+ 'label'?: string;
328
+ /**
329
+ *
330
+ * @type {Array<CreateClassificationResponseSelectedExamples>}
331
+ * @memberof CreateClassificationResponse
332
+ */
333
+ 'selected_examples'?: Array<CreateClassificationResponseSelectedExamples>;
334
+ }
335
+ /**
336
+ *
337
+ * @export
338
+ * @interface CreateClassificationResponseSelectedExamples
339
+ */
340
+ export interface CreateClassificationResponseSelectedExamples {
341
+ /**
342
+ *
343
+ * @type {number}
344
+ * @memberof CreateClassificationResponseSelectedExamples
345
+ */
346
+ 'document'?: number;
347
+ /**
348
+ *
349
+ * @type {string}
350
+ * @memberof CreateClassificationResponseSelectedExamples
351
+ */
352
+ 'text'?: string;
353
+ /**
354
+ *
355
+ * @type {string}
356
+ * @memberof CreateClassificationResponseSelectedExamples
357
+ */
358
+ 'label'?: string;
359
+ }
360
+ /**
361
+ *
362
+ * @export
363
+ * @interface CreateCompletionFromModelRequest
364
+ */
365
+ export interface CreateCompletionFromModelRequest {
366
+ /**
367
+ * The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document.
368
+ * @type {string | Array<string> | Array<number> | Array<any>}
369
+ * @memberof CreateCompletionFromModelRequest
370
+ */
371
+ 'prompt'?: string | Array<string> | Array<number> | Array<any> | null;
372
+ /**
373
+ * The maximum number of [tokens](/tokenizer) to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model\'s context length. Most models have a context length of 2048 tokens (except `code-davinci-001`, which supports 4096).
374
+ * @type {number}
375
+ * @memberof CreateCompletionFromModelRequest
376
+ */
377
+ 'max_tokens'?: number | null;
378
+ /**
379
+ * What [sampling temperature](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277) to use. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. We generally recommend altering this or `top_p` but not both.
380
+ * @type {number}
381
+ * @memberof CreateCompletionFromModelRequest
382
+ */
383
+ 'temperature'?: number | null;
384
+ /**
385
+ * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.
386
+ * @type {number}
387
+ * @memberof CreateCompletionFromModelRequest
388
+ */
389
+ 'top_p'?: number | null;
390
+ /**
391
+ * How many completions to generate for each prompt. **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.
392
+ * @type {number}
393
+ * @memberof CreateCompletionFromModelRequest
394
+ */
395
+ 'n'?: number | null;
396
+ /**
397
+ * Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message.
398
+ * @type {boolean}
399
+ * @memberof CreateCompletionFromModelRequest
400
+ */
401
+ 'stream'?: boolean | null;
402
+ /**
403
+ * Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. The maximum value for `logprobs` is 5. If you need more than this, please contact support@openai.com and describe your use case.
404
+ * @type {number}
405
+ * @memberof CreateCompletionFromModelRequest
406
+ */
407
+ 'logprobs'?: number | null;
408
+ /**
409
+ * Echo back the prompt in addition to the completion
410
+ * @type {boolean}
411
+ * @memberof CreateCompletionFromModelRequest
412
+ */
413
+ 'echo'?: boolean | null;
414
+ /**
415
+ * Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
416
+ * @type {string | Array<string>}
417
+ * @memberof CreateCompletionFromModelRequest
418
+ */
419
+ 'stop'?: string | Array<string> | null;
420
+ /**
421
+ * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model\'s likelihood to talk about new topics. [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details)
422
+ * @type {number}
423
+ * @memberof CreateCompletionFromModelRequest
424
+ */
425
+ 'presence_penalty'?: number | null;
426
+ /**
427
+ * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model\'s likelihood to repeat the same line verbatim. [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details)
428
+ * @type {number}
429
+ * @memberof CreateCompletionFromModelRequest
430
+ */
431
+ 'frequency_penalty'?: number | null;
432
+ /**
433
+ * Generates `best_of` completions server-side and returns the \"best\" (the one with the lowest log probability per token). Results cannot be streamed. When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.
434
+ * @type {number}
435
+ * @memberof CreateCompletionFromModelRequest
436
+ */
437
+ 'best_of'?: number | null;
438
+ /**
439
+ * Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. As an example, you can pass `{\"50256\": -100}` to prevent the <|endoftext|> token from being generated.
440
+ * @type {object}
441
+ * @memberof CreateCompletionFromModelRequest
442
+ */
443
+ 'logit_bias'?: object | null;
444
+ /**
445
+ * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
446
+ * @type {string}
447
+ * @memberof CreateCompletionFromModelRequest
448
+ */
449
+ 'user'?: string;
450
+ /**
451
+ * ID of the model to use for completion.
452
+ * @type {string}
453
+ * @memberof CreateCompletionFromModelRequest
454
+ */
455
+ 'model'?: string;
456
+ }
457
+ /**
458
+ *
459
+ * @export
460
+ * @interface CreateCompletionFromModelRequestAllOf
461
+ */
462
+ export interface CreateCompletionFromModelRequestAllOf {
463
+ /**
464
+ * ID of the model to use for completion.
465
+ * @type {string}
466
+ * @memberof CreateCompletionFromModelRequestAllOf
467
+ */
468
+ 'model'?: string;
469
+ }
470
+ /**
471
+ *
472
+ * @export
473
+ * @interface CreateCompletionRequest
474
+ */
475
+ export interface CreateCompletionRequest {
476
+ /**
477
+ * The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document.
478
+ * @type {string | Array<string> | Array<number> | Array<any>}
479
+ * @memberof CreateCompletionRequest
480
+ */
481
+ 'prompt'?: string | Array<string> | Array<number> | Array<any> | null;
482
+ /**
483
+ * The maximum number of [tokens](/tokenizer) to generate in the completion. The token count of your prompt plus `max_tokens` cannot exceed the model\'s context length. Most models have a context length of 2048 tokens (except `code-davinci-001`, which supports 4096).
484
+ * @type {number}
485
+ * @memberof CreateCompletionRequest
486
+ */
487
+ 'max_tokens'?: number | null;
488
+ /**
489
+ * What [sampling temperature](https://towardsdatascience.com/how-to-sample-from-language-models-682bceb97277) to use. Higher values means the model will take more risks. Try 0.9 for more creative applications, and 0 (argmax sampling) for ones with a well-defined answer. We generally recommend altering this or `top_p` but not both.
490
+ * @type {number}
491
+ * @memberof CreateCompletionRequest
492
+ */
493
+ 'temperature'?: number | null;
494
+ /**
495
+ * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.
496
+ * @type {number}
497
+ * @memberof CreateCompletionRequest
498
+ */
499
+ 'top_p'?: number | null;
500
+ /**
501
+ * How many completions to generate for each prompt. **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.
502
+ * @type {number}
503
+ * @memberof CreateCompletionRequest
504
+ */
505
+ 'n'?: number | null;
506
+ /**
507
+ * Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message.
508
+ * @type {boolean}
509
+ * @memberof CreateCompletionRequest
510
+ */
511
+ 'stream'?: boolean | null;
512
+ /**
513
+ * Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. The maximum value for `logprobs` is 5. If you need more than this, please contact support@openai.com and describe your use case.
514
+ * @type {number}
515
+ * @memberof CreateCompletionRequest
516
+ */
517
+ 'logprobs'?: number | null;
518
+ /**
519
+ * Echo back the prompt in addition to the completion
520
+ * @type {boolean}
521
+ * @memberof CreateCompletionRequest
522
+ */
523
+ 'echo'?: boolean | null;
524
+ /**
525
+ * Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
526
+ * @type {string | Array<string>}
527
+ * @memberof CreateCompletionRequest
528
+ */
529
+ 'stop'?: string | Array<string> | null;
530
+ /**
531
+ * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model\'s likelihood to talk about new topics. [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details)
532
+ * @type {number}
533
+ * @memberof CreateCompletionRequest
534
+ */
535
+ 'presence_penalty'?: number | null;
536
+ /**
537
+ * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model\'s likelihood to repeat the same line verbatim. [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details)
538
+ * @type {number}
539
+ * @memberof CreateCompletionRequest
540
+ */
541
+ 'frequency_penalty'?: number | null;
542
+ /**
543
+ * Generates `best_of` completions server-side and returns the \"best\" (the one with the lowest log probability per token). Results cannot be streamed. When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`.
544
+ * @type {number}
545
+ * @memberof CreateCompletionRequest
546
+ */
547
+ 'best_of'?: number | null;
548
+ /**
549
+ * Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. As an example, you can pass `{\"50256\": -100}` to prevent the <|endoftext|> token from being generated.
550
+ * @type {object}
551
+ * @memberof CreateCompletionRequest
552
+ */
553
+ 'logit_bias'?: object | null;
554
+ /**
555
+ * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
556
+ * @type {string}
557
+ * @memberof CreateCompletionRequest
558
+ */
559
+ 'user'?: string;
560
+ }
561
+ /**
562
+ *
563
+ * @export
564
+ * @interface CreateCompletionResponse
565
+ */
566
+ export interface CreateCompletionResponse {
567
+ /**
568
+ *
569
+ * @type {string}
570
+ * @memberof CreateCompletionResponse
571
+ */
572
+ 'id'?: string;
573
+ /**
574
+ *
575
+ * @type {string}
576
+ * @memberof CreateCompletionResponse
577
+ */
578
+ 'object'?: string;
579
+ /**
580
+ *
581
+ * @type {number}
582
+ * @memberof CreateCompletionResponse
583
+ */
584
+ 'created'?: number;
585
+ /**
586
+ *
587
+ * @type {string}
588
+ * @memberof CreateCompletionResponse
589
+ */
590
+ 'model'?: string;
591
+ /**
592
+ *
593
+ * @type {Array<CreateCompletionResponseChoices>}
594
+ * @memberof CreateCompletionResponse
595
+ */
596
+ 'choices'?: Array<CreateCompletionResponseChoices>;
597
+ }
598
+ /**
599
+ *
600
+ * @export
601
+ * @interface CreateCompletionResponseChoices
602
+ */
603
+ export interface CreateCompletionResponseChoices {
604
+ /**
605
+ *
606
+ * @type {string}
607
+ * @memberof CreateCompletionResponseChoices
608
+ */
609
+ 'text'?: string;
610
+ /**
611
+ *
612
+ * @type {number}
613
+ * @memberof CreateCompletionResponseChoices
614
+ */
615
+ 'index'?: number;
616
+ /**
617
+ *
618
+ * @type {CreateCompletionResponseLogprobs}
619
+ * @memberof CreateCompletionResponseChoices
620
+ */
621
+ 'logprobs'?: CreateCompletionResponseLogprobs | null;
622
+ /**
623
+ *
624
+ * @type {string}
625
+ * @memberof CreateCompletionResponseChoices
626
+ */
627
+ 'finish_reason'?: string;
628
+ }
629
+ /**
630
+ *
631
+ * @export
632
+ * @interface CreateCompletionResponseLogprobs
633
+ */
634
+ export interface CreateCompletionResponseLogprobs {
635
+ /**
636
+ *
637
+ * @type {Array<string>}
638
+ * @memberof CreateCompletionResponseLogprobs
639
+ */
640
+ 'tokens'?: Array<string>;
641
+ /**
642
+ *
643
+ * @type {Array<number>}
644
+ * @memberof CreateCompletionResponseLogprobs
645
+ */
646
+ 'token_logprobs'?: Array<number>;
647
+ /**
648
+ *
649
+ * @type {Array<object>}
650
+ * @memberof CreateCompletionResponseLogprobs
651
+ */
652
+ 'top_logprobs'?: Array<object>;
653
+ /**
654
+ *
655
+ * @type {Array<number>}
656
+ * @memberof CreateCompletionResponseLogprobs
657
+ */
658
+ 'text_offset'?: Array<number>;
659
+ }
660
+ /**
661
+ *
662
+ * @export
663
+ * @interface CreateEmbeddingRequest
664
+ */
665
+ export interface CreateEmbeddingRequest {
666
+ /**
667
+ * Input text to get embeddings for, encoded as a string or array of tokens. To get embeddings for multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed 2048 tokens in length. Unless your are embedding code, we suggest replacing newlines (`\\n`) in your input with a single space, as we have observed inferior results when newlines are present.
668
+ * @type {string | Array<string> | Array<number> | Array<any>}
669
+ * @memberof CreateEmbeddingRequest
670
+ */
671
+ 'input': string | Array<string> | Array<number> | Array<any>;
672
+ /**
673
+ * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
674
+ * @type {string}
675
+ * @memberof CreateEmbeddingRequest
676
+ */
677
+ 'user'?: string;
678
+ }
679
+ /**
680
+ *
681
+ * @export
682
+ * @interface CreateEmbeddingResponse
683
+ */
684
+ export interface CreateEmbeddingResponse {
685
+ /**
686
+ *
687
+ * @type {string}
688
+ * @memberof CreateEmbeddingResponse
689
+ */
690
+ 'object'?: string;
691
+ /**
692
+ *
693
+ * @type {string}
694
+ * @memberof CreateEmbeddingResponse
695
+ */
696
+ 'model'?: string;
697
+ /**
698
+ *
699
+ * @type {Array<CreateEmbeddingResponseData>}
700
+ * @memberof CreateEmbeddingResponse
701
+ */
702
+ 'data'?: Array<CreateEmbeddingResponseData>;
703
+ }
704
+ /**
705
+ *
706
+ * @export
707
+ * @interface CreateEmbeddingResponseData
708
+ */
709
+ export interface CreateEmbeddingResponseData {
710
+ /**
711
+ *
712
+ * @type {number}
713
+ * @memberof CreateEmbeddingResponseData
714
+ */
715
+ 'index'?: number;
716
+ /**
717
+ *
718
+ * @type {string}
719
+ * @memberof CreateEmbeddingResponseData
720
+ */
721
+ 'object'?: string;
722
+ /**
723
+ *
724
+ * @type {Array<number>}
725
+ * @memberof CreateEmbeddingResponseData
726
+ */
727
+ 'embedding'?: Array<number>;
728
+ }
729
+ /**
730
+ *
731
+ * @export
732
+ * @interface CreateFineTuneRequest
733
+ */
734
+ export interface CreateFineTuneRequest {
735
+ /**
736
+ * The ID of an uploaded file that contains training data. See [upload file](/docs/api-reference/files/upload) for how to upload a file. Your dataset must be formatted as a JSONL file, where each training example is a JSON object with the keys \"prompt\" and \"completion\". Additionally, you must upload your file with the purpose `fine-tune`. See the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details.
737
+ * @type {string}
738
+ * @memberof CreateFineTuneRequest
739
+ */
740
+ 'training_file': string;
741
+ /**
742
+ * The ID of an uploaded file that contains validation data. If you provide this file, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in the [fine-tuning results file](/docs/guides/fine-tuning/analyzing-your-fine-tuned-model). Your train and validation data should be mutually exclusive. Your dataset must be formatted as a JSONL file, where each validation example is a JSON object with the keys \"prompt\" and \"completion\". Additionally, you must upload your file with the purpose `fine-tune`. See the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details.
743
+ * @type {string}
744
+ * @memberof CreateFineTuneRequest
745
+ */
746
+ 'validation_file'?: string | null;
747
+ /**
748
+ * The name of the base model to fine-tune. You can select one of \"ada\", \"babbage\", \"curie\", or \"davinci\". To learn more about these models, see the [Engines](https://beta.openai.com/docs/engines) documentation.
749
+ * @type {string}
750
+ * @memberof CreateFineTuneRequest
751
+ */
752
+ 'model'?: string | null;
753
+ /**
754
+ * The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
755
+ * @type {number}
756
+ * @memberof CreateFineTuneRequest
757
+ */
758
+ 'n_epochs'?: number | null;
759
+ /**
760
+ * The batch size to use for training. The batch size is the number of training examples used to train a single forward and backward pass. By default, the batch size will be dynamically configured to be ~0.2% of the number of examples in the training set, capped at 256 - in general, we\'ve found that larger batch sizes tend to work better for larger datasets.
761
+ * @type {number}
762
+ * @memberof CreateFineTuneRequest
763
+ */
764
+ 'batch_size'?: number | null;
765
+ /**
766
+ * The learning rate multiplier to use for training. The fine-tuning learning rate is the original learning rate used for pretraining multiplied by this value. By default, the learning rate multiplier is the 0.05, 0.1, or 0.2 depending on final `batch_size` (larger learning rates tend to perform better with larger batch sizes). We recommend experimenting with values in the range 0.02 to 0.2 to see what produces the best results.
767
+ * @type {number}
768
+ * @memberof CreateFineTuneRequest
769
+ */
770
+ 'learning_rate_multiplier'?: number | null;
771
+ /**
772
+ * The weight to use for loss on the prompt tokens. This controls how much the model tries to learn to generate the prompt (as compared to the completion which always has a weight of 1.0), and can add a stabilizing effect to training when completions are short. If prompts are extremely long (relative to completions), it may make sense to reduce this weight so as to avoid over-prioritizing learning the prompt.
773
+ * @type {number}
774
+ * @memberof CreateFineTuneRequest
775
+ */
776
+ 'prompt_loss_weight'?: number | null;
777
+ /**
778
+ * If set, we calculate classification-specific metrics such as accuracy and F-1 score using the validation set at the end of every epoch. These metrics can be viewed in the [results file](/docs/guides/fine-tuning/analyzing-your-fine-tuned-model). In order to compute classification metrics, you must provide a `validation_file`. Additionally, you must specify `classification_n_classes` for multiclass classification or `classification_positive_class` for binary classification.
779
+ * @type {boolean}
780
+ * @memberof CreateFineTuneRequest
781
+ */
782
+ 'compute_classification_metrics'?: boolean | null;
783
+ /**
784
+ * The number of classes in a classification task. This parameter is required for multiclass classification.
785
+ * @type {number}
786
+ * @memberof CreateFineTuneRequest
787
+ */
788
+ 'classification_n_classes'?: number | null;
789
+ /**
790
+ * The positive class in binary classification. This parameter is needed to generate precision, recall, and F1 metrics when doing binary classification.
791
+ * @type {string}
792
+ * @memberof CreateFineTuneRequest
793
+ */
794
+ 'classification_positive_class'?: string | null;
795
+ /**
796
+ * If this is provided, we calculate F-beta scores at the specified beta values. The F-beta score is a generalization of F-1 score. This is only used for binary classification. With a beta of 1 (i.e. the F-1 score), precision and recall are given the same weight. A larger beta score puts more weight on recall and less on precision. A smaller beta score puts more weight on precision and less on recall.
797
+ * @type {Array<number>}
798
+ * @memberof CreateFineTuneRequest
799
+ */
800
+ 'classification_betas'?: Array<number> | null;
801
+ }
802
+ /**
803
+ *
804
+ * @export
805
+ * @interface CreateSearchRequest
806
+ */
807
+ export interface CreateSearchRequest {
808
+ /**
809
+ * Query to search against the documents.
810
+ * @type {string}
811
+ * @memberof CreateSearchRequest
812
+ */
813
+ 'query': string;
814
+ /**
815
+ * Up to 200 documents to search over, provided as a list of strings. The maximum document length (in tokens) is 2034 minus the number of tokens in the query. You should specify either `documents` or a `file`, but not both.
816
+ * @type {Array<string>}
817
+ * @memberof CreateSearchRequest
818
+ */
819
+ 'documents'?: Array<string> | null;
820
+ /**
821
+ * The ID of an uploaded file that contains documents to search over. You should specify either `documents` or a `file`, but not both.
822
+ * @type {string}
823
+ * @memberof CreateSearchRequest
824
+ */
825
+ 'file'?: string | null;
826
+ /**
827
+ * The maximum number of documents to be re-ranked and returned by search. This flag only takes effect when `file` is set.
828
+ * @type {number}
829
+ * @memberof CreateSearchRequest
830
+ */
831
+ 'max_rerank'?: number | null;
832
+ /**
833
+ * A special boolean flag for showing metadata. If set to `true`, each document entry in the returned JSON will contain a \"metadata\" field. This flag only takes effect when `file` is set.
834
+ * @type {boolean}
835
+ * @memberof CreateSearchRequest
836
+ */
837
+ 'return_metadata'?: boolean | null;
838
+ /**
839
+ * A unique identifier representing your end-user, which will help OpenAI to monitor and detect abuse.
840
+ * @type {string}
841
+ * @memberof CreateSearchRequest
842
+ */
843
+ 'user'?: string;
844
+ }
845
+ /**
846
+ *
847
+ * @export
848
+ * @interface CreateSearchResponse
849
+ */
850
+ export interface CreateSearchResponse {
851
+ /**
852
+ *
853
+ * @type {string}
854
+ * @memberof CreateSearchResponse
855
+ */
856
+ 'object'?: string;
857
+ /**
858
+ *
859
+ * @type {string}
860
+ * @memberof CreateSearchResponse
861
+ */
862
+ 'model'?: string;
863
+ /**
864
+ *
865
+ * @type {Array<CreateSearchResponseData>}
866
+ * @memberof CreateSearchResponse
867
+ */
868
+ 'data'?: Array<CreateSearchResponseData>;
869
+ }
870
+ /**
871
+ *
872
+ * @export
873
+ * @interface CreateSearchResponseData
874
+ */
875
+ export interface CreateSearchResponseData {
876
+ /**
877
+ *
878
+ * @type {string}
879
+ * @memberof CreateSearchResponseData
880
+ */
881
+ 'object'?: string;
882
+ /**
883
+ *
884
+ * @type {number}
885
+ * @memberof CreateSearchResponseData
886
+ */
887
+ 'document'?: number;
888
+ /**
889
+ *
890
+ * @type {number}
891
+ * @memberof CreateSearchResponseData
892
+ */
893
+ 'score'?: number;
894
+ }
895
+ /**
896
+ *
897
+ * @export
898
+ * @interface DeleteFileResponse
899
+ */
900
+ export interface DeleteFileResponse {
901
+ /**
902
+ *
903
+ * @type {string}
904
+ * @memberof DeleteFileResponse
905
+ */
906
+ 'id'?: string;
907
+ /**
908
+ *
909
+ * @type {string}
910
+ * @memberof DeleteFileResponse
911
+ */
912
+ 'object'?: string;
913
+ /**
914
+ *
915
+ * @type {boolean}
916
+ * @memberof DeleteFileResponse
917
+ */
918
+ 'deleted'?: boolean;
919
+ }
920
+ /**
921
+ *
922
+ * @export
923
+ * @interface Engine
924
+ */
925
+ export interface Engine {
926
+ /**
927
+ *
928
+ * @type {string}
929
+ * @memberof Engine
930
+ */
931
+ 'id'?: string;
932
+ /**
933
+ *
934
+ * @type {string}
935
+ * @memberof Engine
936
+ */
937
+ 'object'?: string;
938
+ /**
939
+ *
940
+ * @type {number}
941
+ * @memberof Engine
942
+ */
943
+ 'created'?: number;
944
+ /**
945
+ *
946
+ * @type {boolean}
947
+ * @memberof Engine
948
+ */
949
+ 'ready'?: boolean;
950
+ }
951
+ /**
952
+ *
953
+ * @export
954
+ * @interface FineTune
955
+ */
956
+ export interface FineTune {
957
+ /**
958
+ *
959
+ * @type {string}
960
+ * @memberof FineTune
961
+ */
962
+ 'id'?: string;
963
+ /**
964
+ *
965
+ * @type {string}
966
+ * @memberof FineTune
967
+ */
968
+ 'object'?: string;
969
+ /**
970
+ *
971
+ * @type {number}
972
+ * @memberof FineTune
973
+ */
974
+ 'created_at'?: number;
975
+ /**
976
+ *
977
+ * @type {number}
978
+ * @memberof FineTune
979
+ */
980
+ 'updated_at'?: number;
981
+ /**
982
+ *
983
+ * @type {string}
984
+ * @memberof FineTune
985
+ */
986
+ 'model'?: string;
987
+ /**
988
+ *
989
+ * @type {string}
990
+ * @memberof FineTune
991
+ */
992
+ 'fine_tuned_model'?: string | null;
993
+ /**
994
+ *
995
+ * @type {string}
996
+ * @memberof FineTune
997
+ */
998
+ 'organization_id'?: string;
999
+ /**
1000
+ *
1001
+ * @type {string}
1002
+ * @memberof FineTune
1003
+ */
1004
+ 'status'?: string;
1005
+ /**
1006
+ *
1007
+ * @type {object}
1008
+ * @memberof FineTune
1009
+ */
1010
+ 'hyperparams'?: object;
1011
+ /**
1012
+ *
1013
+ * @type {Array<OpenAIFile>}
1014
+ * @memberof FineTune
1015
+ */
1016
+ 'training_files'?: Array<OpenAIFile>;
1017
+ /**
1018
+ *
1019
+ * @type {Array<OpenAIFile>}
1020
+ * @memberof FineTune
1021
+ */
1022
+ 'validation_files'?: Array<OpenAIFile>;
1023
+ /**
1024
+ *
1025
+ * @type {Array<OpenAIFile>}
1026
+ * @memberof FineTune
1027
+ */
1028
+ 'result_files'?: Array<OpenAIFile>;
1029
+ /**
1030
+ *
1031
+ * @type {Array<FineTuneEvent>}
1032
+ * @memberof FineTune
1033
+ */
1034
+ 'events'?: Array<FineTuneEvent>;
1035
+ }
1036
+ /**
1037
+ *
1038
+ * @export
1039
+ * @interface FineTuneEvent
1040
+ */
1041
+ export interface FineTuneEvent {
1042
+ /**
1043
+ *
1044
+ * @type {string}
1045
+ * @memberof FineTuneEvent
1046
+ */
1047
+ 'object'?: string;
1048
+ /**
1049
+ *
1050
+ * @type {number}
1051
+ * @memberof FineTuneEvent
1052
+ */
1053
+ 'created_at'?: number;
1054
+ /**
1055
+ *
1056
+ * @type {string}
1057
+ * @memberof FineTuneEvent
1058
+ */
1059
+ 'level'?: string;
1060
+ /**
1061
+ *
1062
+ * @type {string}
1063
+ * @memberof FineTuneEvent
1064
+ */
1065
+ 'message'?: string;
1066
+ }
1067
+ /**
1068
+ *
1069
+ * @export
1070
+ * @interface ListEnginesResponse
1071
+ */
1072
+ export interface ListEnginesResponse {
1073
+ /**
1074
+ *
1075
+ * @type {string}
1076
+ * @memberof ListEnginesResponse
1077
+ */
1078
+ 'object'?: string;
1079
+ /**
1080
+ *
1081
+ * @type {Array<Engine>}
1082
+ * @memberof ListEnginesResponse
1083
+ */
1084
+ 'data'?: Array<Engine>;
1085
+ }
1086
+ /**
1087
+ *
1088
+ * @export
1089
+ * @interface ListFilesResponse
1090
+ */
1091
+ export interface ListFilesResponse {
1092
+ /**
1093
+ *
1094
+ * @type {string}
1095
+ * @memberof ListFilesResponse
1096
+ */
1097
+ 'object'?: string;
1098
+ /**
1099
+ *
1100
+ * @type {Array<OpenAIFile>}
1101
+ * @memberof ListFilesResponse
1102
+ */
1103
+ 'data'?: Array<OpenAIFile>;
1104
+ }
1105
+ /**
1106
+ *
1107
+ * @export
1108
+ * @interface ListFineTuneEventsResponse
1109
+ */
1110
+ export interface ListFineTuneEventsResponse {
1111
+ /**
1112
+ *
1113
+ * @type {string}
1114
+ * @memberof ListFineTuneEventsResponse
1115
+ */
1116
+ 'object'?: string;
1117
+ /**
1118
+ *
1119
+ * @type {Array<FineTuneEvent>}
1120
+ * @memberof ListFineTuneEventsResponse
1121
+ */
1122
+ 'data'?: Array<FineTuneEvent>;
1123
+ }
1124
+ /**
1125
+ *
1126
+ * @export
1127
+ * @interface ListFineTunesResponse
1128
+ */
1129
+ export interface ListFineTunesResponse {
1130
+ /**
1131
+ *
1132
+ * @type {string}
1133
+ * @memberof ListFineTunesResponse
1134
+ */
1135
+ 'object'?: string;
1136
+ /**
1137
+ *
1138
+ * @type {Array<FineTune>}
1139
+ * @memberof ListFineTunesResponse
1140
+ */
1141
+ 'data'?: Array<FineTune>;
1142
+ }
1143
+ /**
1144
+ *
1145
+ * @export
1146
+ * @interface OpenAIFile
1147
+ */
1148
+ export interface OpenAIFile {
1149
+ /**
1150
+ *
1151
+ * @type {string}
1152
+ * @memberof OpenAIFile
1153
+ */
1154
+ 'id'?: string;
1155
+ /**
1156
+ *
1157
+ * @type {string}
1158
+ * @memberof OpenAIFile
1159
+ */
1160
+ 'object'?: string;
1161
+ /**
1162
+ *
1163
+ * @type {number}
1164
+ * @memberof OpenAIFile
1165
+ */
1166
+ 'bytes'?: number;
1167
+ /**
1168
+ *
1169
+ * @type {number}
1170
+ * @memberof OpenAIFile
1171
+ */
1172
+ 'created_at'?: number;
1173
+ /**
1174
+ *
1175
+ * @type {string}
1176
+ * @memberof OpenAIFile
1177
+ */
1178
+ 'filename'?: string;
1179
+ /**
1180
+ *
1181
+ * @type {string}
1182
+ * @memberof OpenAIFile
1183
+ */
1184
+ 'purpose'?: string;
1185
+ /**
1186
+ *
1187
+ * @type {string}
1188
+ * @memberof OpenAIFile
1189
+ */
1190
+ 'status'?: string;
1191
+ /**
1192
+ *
1193
+ * @type {object}
1194
+ * @memberof OpenAIFile
1195
+ */
1196
+ 'status_details'?: object | null;
1197
+ }
1198
+
1199
+ /**
1200
+ * OpenAIApi - axios parameter creator
1201
+ * @export
1202
+ */
1203
+ export const OpenAIApiAxiosParamCreator = function (configuration?: Configuration) {
1204
+ return {
1205
+ /**
1206
+ *
1207
+ * @summary Immediately cancel a fine-tune job.
1208
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
1209
+ * @param {*} [options] Override http request option.
1210
+ * @throws {RequiredError}
1211
+ */
1212
+ cancelFineTune: async (fineTuneId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1213
+ // verify required parameter 'fineTuneId' is not null or undefined
1214
+ assertParamExists('cancelFineTune', 'fineTuneId', fineTuneId)
1215
+ const localVarPath = `/fine-tunes/{fine_tune_id}/cancel`
1216
+ .replace(`{${"fine_tune_id"}}`, encodeURIComponent(String(fineTuneId)));
1217
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1218
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1219
+ let baseOptions;
1220
+ if (configuration) {
1221
+ baseOptions = configuration.baseOptions;
1222
+ }
1223
+
1224
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1225
+ const localVarHeaderParameter = {} as any;
1226
+ const localVarQueryParameter = {} as any;
1227
+
1228
+
1229
+
1230
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1231
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1232
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1233
+
1234
+ return {
1235
+ url: toPathString(localVarUrlObj),
1236
+ options: localVarRequestOptions,
1237
+ };
1238
+ },
1239
+ /**
1240
+ *
1241
+ * @summary Answers the specified question using the provided documents and examples. The endpoint first [searches](/docs/api-reference/searches) over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for [completion](/docs/api-reference/completions).
1242
+ * @param {CreateAnswerRequest} createAnswerRequest
1243
+ * @param {*} [options] Override http request option.
1244
+ * @throws {RequiredError}
1245
+ */
1246
+ createAnswer: async (createAnswerRequest: CreateAnswerRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1247
+ // verify required parameter 'createAnswerRequest' is not null or undefined
1248
+ assertParamExists('createAnswer', 'createAnswerRequest', createAnswerRequest)
1249
+ const localVarPath = `/answers`;
1250
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1251
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1252
+ let baseOptions;
1253
+ if (configuration) {
1254
+ baseOptions = configuration.baseOptions;
1255
+ }
1256
+
1257
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1258
+ const localVarHeaderParameter = {} as any;
1259
+ const localVarQueryParameter = {} as any;
1260
+
1261
+
1262
+
1263
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1264
+
1265
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1266
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1267
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1268
+ localVarRequestOptions.data = serializeDataIfNeeded(createAnswerRequest, localVarRequestOptions, configuration)
1269
+
1270
+ return {
1271
+ url: toPathString(localVarUrlObj),
1272
+ options: localVarRequestOptions,
1273
+ };
1274
+ },
1275
+ /**
1276
+ *
1277
+ * @summary Classifies the specified `query` using provided examples. The endpoint first [searches](/docs/api-reference/searches) over the labeled examples to select the ones most relevant for the particular query. Then, the relevant examples are combined with the query to construct a prompt to produce the final label via the [completions](/docs/api-reference/completions) endpoint. Labeled examples can be provided via an uploaded `file`, or explicitly listed in the request using the `examples` parameter for quick tests and small scale use cases.
1278
+ * @param {CreateClassificationRequest} createClassificationRequest
1279
+ * @param {*} [options] Override http request option.
1280
+ * @throws {RequiredError}
1281
+ */
1282
+ createClassification: async (createClassificationRequest: CreateClassificationRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1283
+ // verify required parameter 'createClassificationRequest' is not null or undefined
1284
+ assertParamExists('createClassification', 'createClassificationRequest', createClassificationRequest)
1285
+ const localVarPath = `/classifications`;
1286
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1287
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1288
+ let baseOptions;
1289
+ if (configuration) {
1290
+ baseOptions = configuration.baseOptions;
1291
+ }
1292
+
1293
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1294
+ const localVarHeaderParameter = {} as any;
1295
+ const localVarQueryParameter = {} as any;
1296
+
1297
+
1298
+
1299
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1300
+
1301
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1302
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1303
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1304
+ localVarRequestOptions.data = serializeDataIfNeeded(createClassificationRequest, localVarRequestOptions, configuration)
1305
+
1306
+ return {
1307
+ url: toPathString(localVarUrlObj),
1308
+ options: localVarRequestOptions,
1309
+ };
1310
+ },
1311
+ /**
1312
+ *
1313
+ * @summary Creates a new completion for the provided prompt and parameters
1314
+ * @param {string} engineId The ID of the engine to use for this request
1315
+ * @param {CreateCompletionRequest} createCompletionRequest
1316
+ * @param {*} [options] Override http request option.
1317
+ * @throws {RequiredError}
1318
+ */
1319
+ createCompletion: async (engineId: string, createCompletionRequest: CreateCompletionRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1320
+ // verify required parameter 'engineId' is not null or undefined
1321
+ assertParamExists('createCompletion', 'engineId', engineId)
1322
+ // verify required parameter 'createCompletionRequest' is not null or undefined
1323
+ assertParamExists('createCompletion', 'createCompletionRequest', createCompletionRequest)
1324
+ const localVarPath = `/engines/{engine_id}/completions`
1325
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
1326
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1327
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1328
+ let baseOptions;
1329
+ if (configuration) {
1330
+ baseOptions = configuration.baseOptions;
1331
+ }
1332
+
1333
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1334
+ const localVarHeaderParameter = {} as any;
1335
+ const localVarQueryParameter = {} as any;
1336
+
1337
+
1338
+
1339
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1340
+
1341
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1342
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1343
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1344
+ localVarRequestOptions.data = serializeDataIfNeeded(createCompletionRequest, localVarRequestOptions, configuration)
1345
+
1346
+ return {
1347
+ url: toPathString(localVarUrlObj),
1348
+ options: localVarRequestOptions,
1349
+ };
1350
+ },
1351
+ /**
1352
+ *
1353
+ * @summary Creates a completion using a fine-tuned model
1354
+ * @param {CreateCompletionFromModelRequest} createCompletionFromModelRequest
1355
+ * @param {*} [options] Override http request option.
1356
+ * @throws {RequiredError}
1357
+ */
1358
+ createCompletionFromModel: async (createCompletionFromModelRequest: CreateCompletionFromModelRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1359
+ // verify required parameter 'createCompletionFromModelRequest' is not null or undefined
1360
+ assertParamExists('createCompletionFromModel', 'createCompletionFromModelRequest', createCompletionFromModelRequest)
1361
+ const localVarPath = `/completions`;
1362
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1363
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1364
+ let baseOptions;
1365
+ if (configuration) {
1366
+ baseOptions = configuration.baseOptions;
1367
+ }
1368
+
1369
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1370
+ const localVarHeaderParameter = {} as any;
1371
+ const localVarQueryParameter = {} as any;
1372
+
1373
+
1374
+
1375
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1376
+
1377
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1378
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1379
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1380
+ localVarRequestOptions.data = serializeDataIfNeeded(createCompletionFromModelRequest, localVarRequestOptions, configuration)
1381
+
1382
+ return {
1383
+ url: toPathString(localVarUrlObj),
1384
+ options: localVarRequestOptions,
1385
+ };
1386
+ },
1387
+ /**
1388
+ *
1389
+ * @summary Creates an embedding vector representing the input text.
1390
+ * @param {string} engineId The ID of the engine to use for this request
1391
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
1392
+ * @param {*} [options] Override http request option.
1393
+ * @throws {RequiredError}
1394
+ */
1395
+ createEmbedding: async (engineId: string, createEmbeddingRequest: CreateEmbeddingRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1396
+ // verify required parameter 'engineId' is not null or undefined
1397
+ assertParamExists('createEmbedding', 'engineId', engineId)
1398
+ // verify required parameter 'createEmbeddingRequest' is not null or undefined
1399
+ assertParamExists('createEmbedding', 'createEmbeddingRequest', createEmbeddingRequest)
1400
+ const localVarPath = `/engines/{engine_id}/embeddings`
1401
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
1402
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1403
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1404
+ let baseOptions;
1405
+ if (configuration) {
1406
+ baseOptions = configuration.baseOptions;
1407
+ }
1408
+
1409
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1410
+ const localVarHeaderParameter = {} as any;
1411
+ const localVarQueryParameter = {} as any;
1412
+
1413
+
1414
+
1415
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1416
+
1417
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1418
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1419
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1420
+ localVarRequestOptions.data = serializeDataIfNeeded(createEmbeddingRequest, localVarRequestOptions, configuration)
1421
+
1422
+ return {
1423
+ url: toPathString(localVarUrlObj),
1424
+ options: localVarRequestOptions,
1425
+ };
1426
+ },
1427
+ /**
1428
+ *
1429
+ * @summary Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.
1430
+ * @param {any} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the &#x60;purpose&#x60; is set to \\\&quot;search\\\&quot; or \\\&quot;answers\\\&quot;, each line is a JSON record with a \\\&quot;text\\\&quot; field and an optional \\\&quot;metadata\\\&quot; field. Only \\\&quot;text\\\&quot; field will be used for search. Specially, when the &#x60;purpose&#x60; is \\\&quot;answers\\\&quot;, \\\&quot;\\\\n\\\&quot; is used as a delimiter to chunk contents in the \\\&quot;text\\\&quot; field into multiple documents for finer-grained matching. If the &#x60;purpose&#x60; is set to \\\&quot;classifications\\\&quot;, each line is a JSON record representing a single training example with \\\&quot;text\\\&quot; and \\\&quot;label\\\&quot; fields along with an optional \\\&quot;metadata\\\&quot; field. If the &#x60;purpose&#x60; is set to \\\&quot;fine-tune\\\&quot;, each line is a JSON record with \\\&quot;prompt\\\&quot; and \\\&quot;completion\\\&quot; fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data).
1431
+ * @param {string} purpose The intended purpose of the uploaded documents. Use \\\&quot;search\\\&quot; for [Search](/docs/api-reference/searches), \\\&quot;answers\\\&quot; for [Answers](/docs/api-reference/answers), \\\&quot;classifications\\\&quot; for [Classifications](/docs/api-reference/classifications) and \\\&quot;fine-tune\\\&quot; for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.
1432
+ * @param {*} [options] Override http request option.
1433
+ * @throws {RequiredError}
1434
+ */
1435
+ createFile: async (file: any, purpose: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1436
+ // verify required parameter 'file' is not null or undefined
1437
+ assertParamExists('createFile', 'file', file)
1438
+ // verify required parameter 'purpose' is not null or undefined
1439
+ assertParamExists('createFile', 'purpose', purpose)
1440
+ const localVarPath = `/files`;
1441
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1442
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1443
+ let baseOptions;
1444
+ if (configuration) {
1445
+ baseOptions = configuration.baseOptions;
1446
+ }
1447
+
1448
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1449
+ const localVarHeaderParameter = {} as any;
1450
+ const localVarQueryParameter = {} as any;
1451
+ const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
1452
+
1453
+
1454
+ if (file !== undefined) {
1455
+ localVarFormParams.append('file', file as any);
1456
+ }
1457
+
1458
+ if (purpose !== undefined) {
1459
+ localVarFormParams.append('purpose', purpose as any);
1460
+ }
1461
+
1462
+
1463
+ localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
1464
+
1465
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1466
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1467
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...localVarFormParams.getHeaders(), ...headersFromBaseOptions, ...options.headers};
1468
+ localVarRequestOptions.data = localVarFormParams;
1469
+
1470
+ return {
1471
+ url: toPathString(localVarUrlObj),
1472
+ options: localVarRequestOptions,
1473
+ };
1474
+ },
1475
+ /**
1476
+ *
1477
+ * @summary Creates a job that fine-tunes a specified model from a given dataset. Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
1478
+ * @param {CreateFineTuneRequest} createFineTuneRequest
1479
+ * @param {*} [options] Override http request option.
1480
+ * @throws {RequiredError}
1481
+ */
1482
+ createFineTune: async (createFineTuneRequest: CreateFineTuneRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1483
+ // verify required parameter 'createFineTuneRequest' is not null or undefined
1484
+ assertParamExists('createFineTune', 'createFineTuneRequest', createFineTuneRequest)
1485
+ const localVarPath = `/fine-tunes`;
1486
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1487
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1488
+ let baseOptions;
1489
+ if (configuration) {
1490
+ baseOptions = configuration.baseOptions;
1491
+ }
1492
+
1493
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1494
+ const localVarHeaderParameter = {} as any;
1495
+ const localVarQueryParameter = {} as any;
1496
+
1497
+
1498
+
1499
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1500
+
1501
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1502
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1503
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1504
+ localVarRequestOptions.data = serializeDataIfNeeded(createFineTuneRequest, localVarRequestOptions, configuration)
1505
+
1506
+ return {
1507
+ url: toPathString(localVarUrlObj),
1508
+ options: localVarRequestOptions,
1509
+ };
1510
+ },
1511
+ /**
1512
+ *
1513
+ * @summary The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them. To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When `file` is set, the search endpoint searches over all the documents in the given file and returns up to the `max_rerank` number of documents. These documents will be returned along with their search scores. The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.
1514
+ * @param {string} engineId The ID of the engine to use for this request. You can select one of &#x60;ada&#x60;, &#x60;babbage&#x60;, &#x60;curie&#x60;, or &#x60;davinci&#x60;.
1515
+ * @param {CreateSearchRequest} createSearchRequest
1516
+ * @param {*} [options] Override http request option.
1517
+ * @throws {RequiredError}
1518
+ */
1519
+ createSearch: async (engineId: string, createSearchRequest: CreateSearchRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1520
+ // verify required parameter 'engineId' is not null or undefined
1521
+ assertParamExists('createSearch', 'engineId', engineId)
1522
+ // verify required parameter 'createSearchRequest' is not null or undefined
1523
+ assertParamExists('createSearch', 'createSearchRequest', createSearchRequest)
1524
+ const localVarPath = `/engines/{engine_id}/search`
1525
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
1526
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1527
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1528
+ let baseOptions;
1529
+ if (configuration) {
1530
+ baseOptions = configuration.baseOptions;
1531
+ }
1532
+
1533
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1534
+ const localVarHeaderParameter = {} as any;
1535
+ const localVarQueryParameter = {} as any;
1536
+
1537
+
1538
+
1539
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1540
+
1541
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1542
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1543
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1544
+ localVarRequestOptions.data = serializeDataIfNeeded(createSearchRequest, localVarRequestOptions, configuration)
1545
+
1546
+ return {
1547
+ url: toPathString(localVarUrlObj),
1548
+ options: localVarRequestOptions,
1549
+ };
1550
+ },
1551
+ /**
1552
+ *
1553
+ * @summary Delete a file.
1554
+ * @param {string} fileId The ID of the file to use for this request
1555
+ * @param {*} [options] Override http request option.
1556
+ * @throws {RequiredError}
1557
+ */
1558
+ deleteFile: async (fileId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1559
+ // verify required parameter 'fileId' is not null or undefined
1560
+ assertParamExists('deleteFile', 'fileId', fileId)
1561
+ const localVarPath = `/files/{file_id}`
1562
+ .replace(`{${"file_id"}}`, encodeURIComponent(String(fileId)));
1563
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1564
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1565
+ let baseOptions;
1566
+ if (configuration) {
1567
+ baseOptions = configuration.baseOptions;
1568
+ }
1569
+
1570
+ const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
1571
+ const localVarHeaderParameter = {} as any;
1572
+ const localVarQueryParameter = {} as any;
1573
+
1574
+
1575
+
1576
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1577
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1578
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1579
+
1580
+ return {
1581
+ url: toPathString(localVarUrlObj),
1582
+ options: localVarRequestOptions,
1583
+ };
1584
+ },
1585
+ /**
1586
+ *
1587
+ * @summary Returns the contents of the specified file
1588
+ * @param {string} fileId The ID of the file to use for this request
1589
+ * @param {*} [options] Override http request option.
1590
+ * @throws {RequiredError}
1591
+ */
1592
+ downloadFile: async (fileId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1593
+ // verify required parameter 'fileId' is not null or undefined
1594
+ assertParamExists('downloadFile', 'fileId', fileId)
1595
+ const localVarPath = `/files/{file_id}/content`
1596
+ .replace(`{${"file_id"}}`, encodeURIComponent(String(fileId)));
1597
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1598
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1599
+ let baseOptions;
1600
+ if (configuration) {
1601
+ baseOptions = configuration.baseOptions;
1602
+ }
1603
+
1604
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1605
+ const localVarHeaderParameter = {} as any;
1606
+ const localVarQueryParameter = {} as any;
1607
+
1608
+
1609
+
1610
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1611
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1612
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1613
+
1614
+ return {
1615
+ url: toPathString(localVarUrlObj),
1616
+ options: localVarRequestOptions,
1617
+ };
1618
+ },
1619
+ /**
1620
+ *
1621
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
1622
+ * @param {*} [options] Override http request option.
1623
+ * @throws {RequiredError}
1624
+ */
1625
+ listEngines: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1626
+ const localVarPath = `/engines`;
1627
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1628
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1629
+ let baseOptions;
1630
+ if (configuration) {
1631
+ baseOptions = configuration.baseOptions;
1632
+ }
1633
+
1634
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1635
+ const localVarHeaderParameter = {} as any;
1636
+ const localVarQueryParameter = {} as any;
1637
+
1638
+
1639
+
1640
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1641
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1642
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1643
+
1644
+ return {
1645
+ url: toPathString(localVarUrlObj),
1646
+ options: localVarRequestOptions,
1647
+ };
1648
+ },
1649
+ /**
1650
+ *
1651
+ * @summary Returns a list of files that belong to the user\'s organization.
1652
+ * @param {*} [options] Override http request option.
1653
+ * @throws {RequiredError}
1654
+ */
1655
+ listFiles: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1656
+ const localVarPath = `/files`;
1657
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1658
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1659
+ let baseOptions;
1660
+ if (configuration) {
1661
+ baseOptions = configuration.baseOptions;
1662
+ }
1663
+
1664
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1665
+ const localVarHeaderParameter = {} as any;
1666
+ const localVarQueryParameter = {} as any;
1667
+
1668
+
1669
+
1670
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1671
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1672
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1673
+
1674
+ return {
1675
+ url: toPathString(localVarUrlObj),
1676
+ options: localVarRequestOptions,
1677
+ };
1678
+ },
1679
+ /**
1680
+ *
1681
+ * @summary Get fine-grained status updates for a fine-tune job.
1682
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
1683
+ * @param {boolean} [stream] Whether to stream events for the fine-tune job. If set to true, events will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available. The stream will terminate with a &#x60;data: [DONE]&#x60; message when the job is finished (succeeded, cancelled, or failed). If set to false, only events generated so far will be returned.
1684
+ * @param {*} [options] Override http request option.
1685
+ * @throws {RequiredError}
1686
+ */
1687
+ listFineTuneEvents: async (fineTuneId: string, stream?: boolean, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1688
+ // verify required parameter 'fineTuneId' is not null or undefined
1689
+ assertParamExists('listFineTuneEvents', 'fineTuneId', fineTuneId)
1690
+ const localVarPath = `/fine-tunes/{fine_tune_id}/events`
1691
+ .replace(`{${"fine_tune_id"}}`, encodeURIComponent(String(fineTuneId)));
1692
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1693
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1694
+ let baseOptions;
1695
+ if (configuration) {
1696
+ baseOptions = configuration.baseOptions;
1697
+ }
1698
+
1699
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1700
+ const localVarHeaderParameter = {} as any;
1701
+ const localVarQueryParameter = {} as any;
1702
+
1703
+ if (stream !== undefined) {
1704
+ localVarQueryParameter['stream'] = stream;
1705
+ }
1706
+
1707
+
1708
+
1709
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1710
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1711
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1712
+
1713
+ return {
1714
+ url: toPathString(localVarUrlObj),
1715
+ options: localVarRequestOptions,
1716
+ };
1717
+ },
1718
+ /**
1719
+ *
1720
+ * @summary List your organization\'s fine-tuning jobs
1721
+ * @param {*} [options] Override http request option.
1722
+ * @throws {RequiredError}
1723
+ */
1724
+ listFineTunes: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1725
+ const localVarPath = `/fine-tunes`;
1726
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1727
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1728
+ let baseOptions;
1729
+ if (configuration) {
1730
+ baseOptions = configuration.baseOptions;
1731
+ }
1732
+
1733
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1734
+ const localVarHeaderParameter = {} as any;
1735
+ const localVarQueryParameter = {} as any;
1736
+
1737
+
1738
+
1739
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1740
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1741
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1742
+
1743
+ return {
1744
+ url: toPathString(localVarUrlObj),
1745
+ options: localVarRequestOptions,
1746
+ };
1747
+ },
1748
+ /**
1749
+ *
1750
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
1751
+ * @param {string} engineId The ID of the engine to use for this request
1752
+ * @param {*} [options] Override http request option.
1753
+ * @throws {RequiredError}
1754
+ */
1755
+ retrieveEngine: async (engineId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1756
+ // verify required parameter 'engineId' is not null or undefined
1757
+ assertParamExists('retrieveEngine', 'engineId', engineId)
1758
+ const localVarPath = `/engines/{engine_id}`
1759
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
1760
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1761
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1762
+ let baseOptions;
1763
+ if (configuration) {
1764
+ baseOptions = configuration.baseOptions;
1765
+ }
1766
+
1767
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1768
+ const localVarHeaderParameter = {} as any;
1769
+ const localVarQueryParameter = {} as any;
1770
+
1771
+
1772
+
1773
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1774
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1775
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1776
+
1777
+ return {
1778
+ url: toPathString(localVarUrlObj),
1779
+ options: localVarRequestOptions,
1780
+ };
1781
+ },
1782
+ /**
1783
+ *
1784
+ * @summary Returns information about a specific file.
1785
+ * @param {string} fileId The ID of the file to use for this request
1786
+ * @param {*} [options] Override http request option.
1787
+ * @throws {RequiredError}
1788
+ */
1789
+ retrieveFile: async (fileId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1790
+ // verify required parameter 'fileId' is not null or undefined
1791
+ assertParamExists('retrieveFile', 'fileId', fileId)
1792
+ const localVarPath = `/files/{file_id}`
1793
+ .replace(`{${"file_id"}}`, encodeURIComponent(String(fileId)));
1794
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1795
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1796
+ let baseOptions;
1797
+ if (configuration) {
1798
+ baseOptions = configuration.baseOptions;
1799
+ }
1800
+
1801
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1802
+ const localVarHeaderParameter = {} as any;
1803
+ const localVarQueryParameter = {} as any;
1804
+
1805
+
1806
+
1807
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1808
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1809
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1810
+
1811
+ return {
1812
+ url: toPathString(localVarUrlObj),
1813
+ options: localVarRequestOptions,
1814
+ };
1815
+ },
1816
+ /**
1817
+ *
1818
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
1819
+ * @param {string} fineTuneId The ID of the fine-tune job
1820
+ * @param {*} [options] Override http request option.
1821
+ * @throws {RequiredError}
1822
+ */
1823
+ retrieveFineTune: async (fineTuneId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1824
+ // verify required parameter 'fineTuneId' is not null or undefined
1825
+ assertParamExists('retrieveFineTune', 'fineTuneId', fineTuneId)
1826
+ const localVarPath = `/fine-tunes/{fine_tune_id}`
1827
+ .replace(`{${"fine_tune_id"}}`, encodeURIComponent(String(fineTuneId)));
1828
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1829
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1830
+ let baseOptions;
1831
+ if (configuration) {
1832
+ baseOptions = configuration.baseOptions;
1833
+ }
1834
+
1835
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1836
+ const localVarHeaderParameter = {} as any;
1837
+ const localVarQueryParameter = {} as any;
1838
+
1839
+
1840
+
1841
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1842
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1843
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1844
+
1845
+ return {
1846
+ url: toPathString(localVarUrlObj),
1847
+ options: localVarRequestOptions,
1848
+ };
1849
+ },
1850
+ }
1851
+ };
1852
+
1853
+ /**
1854
+ * OpenAIApi - functional programming interface
1855
+ * @export
1856
+ */
1857
+ export const OpenAIApiFp = function(configuration?: Configuration) {
1858
+ const localVarAxiosParamCreator = OpenAIApiAxiosParamCreator(configuration)
1859
+ return {
1860
+ /**
1861
+ *
1862
+ * @summary Immediately cancel a fine-tune job.
1863
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
1864
+ * @param {*} [options] Override http request option.
1865
+ * @throws {RequiredError}
1866
+ */
1867
+ async cancelFineTune(fineTuneId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FineTune>> {
1868
+ const localVarAxiosArgs = await localVarAxiosParamCreator.cancelFineTune(fineTuneId, options);
1869
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1870
+ },
1871
+ /**
1872
+ *
1873
+ * @summary Answers the specified question using the provided documents and examples. The endpoint first [searches](/docs/api-reference/searches) over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for [completion](/docs/api-reference/completions).
1874
+ * @param {CreateAnswerRequest} createAnswerRequest
1875
+ * @param {*} [options] Override http request option.
1876
+ * @throws {RequiredError}
1877
+ */
1878
+ async createAnswer(createAnswerRequest: CreateAnswerRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateAnswerResponse>> {
1879
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createAnswer(createAnswerRequest, options);
1880
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1881
+ },
1882
+ /**
1883
+ *
1884
+ * @summary Classifies the specified `query` using provided examples. The endpoint first [searches](/docs/api-reference/searches) over the labeled examples to select the ones most relevant for the particular query. Then, the relevant examples are combined with the query to construct a prompt to produce the final label via the [completions](/docs/api-reference/completions) endpoint. Labeled examples can be provided via an uploaded `file`, or explicitly listed in the request using the `examples` parameter for quick tests and small scale use cases.
1885
+ * @param {CreateClassificationRequest} createClassificationRequest
1886
+ * @param {*} [options] Override http request option.
1887
+ * @throws {RequiredError}
1888
+ */
1889
+ async createClassification(createClassificationRequest: CreateClassificationRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateClassificationResponse>> {
1890
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createClassification(createClassificationRequest, options);
1891
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1892
+ },
1893
+ /**
1894
+ *
1895
+ * @summary Creates a new completion for the provided prompt and parameters
1896
+ * @param {string} engineId The ID of the engine to use for this request
1897
+ * @param {CreateCompletionRequest} createCompletionRequest
1898
+ * @param {*} [options] Override http request option.
1899
+ * @throws {RequiredError}
1900
+ */
1901
+ async createCompletion(engineId: string, createCompletionRequest: CreateCompletionRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateCompletionResponse>> {
1902
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createCompletion(engineId, createCompletionRequest, options);
1903
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1904
+ },
1905
+ /**
1906
+ *
1907
+ * @summary Creates a completion using a fine-tuned model
1908
+ * @param {CreateCompletionFromModelRequest} createCompletionFromModelRequest
1909
+ * @param {*} [options] Override http request option.
1910
+ * @throws {RequiredError}
1911
+ */
1912
+ async createCompletionFromModel(createCompletionFromModelRequest: CreateCompletionFromModelRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateCompletionResponse>> {
1913
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createCompletionFromModel(createCompletionFromModelRequest, options);
1914
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1915
+ },
1916
+ /**
1917
+ *
1918
+ * @summary Creates an embedding vector representing the input text.
1919
+ * @param {string} engineId The ID of the engine to use for this request
1920
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
1921
+ * @param {*} [options] Override http request option.
1922
+ * @throws {RequiredError}
1923
+ */
1924
+ async createEmbedding(engineId: string, createEmbeddingRequest: CreateEmbeddingRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateEmbeddingResponse>> {
1925
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createEmbedding(engineId, createEmbeddingRequest, options);
1926
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1927
+ },
1928
+ /**
1929
+ *
1930
+ * @summary Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.
1931
+ * @param {any} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the &#x60;purpose&#x60; is set to \\\&quot;search\\\&quot; or \\\&quot;answers\\\&quot;, each line is a JSON record with a \\\&quot;text\\\&quot; field and an optional \\\&quot;metadata\\\&quot; field. Only \\\&quot;text\\\&quot; field will be used for search. Specially, when the &#x60;purpose&#x60; is \\\&quot;answers\\\&quot;, \\\&quot;\\\\n\\\&quot; is used as a delimiter to chunk contents in the \\\&quot;text\\\&quot; field into multiple documents for finer-grained matching. If the &#x60;purpose&#x60; is set to \\\&quot;classifications\\\&quot;, each line is a JSON record representing a single training example with \\\&quot;text\\\&quot; and \\\&quot;label\\\&quot; fields along with an optional \\\&quot;metadata\\\&quot; field. If the &#x60;purpose&#x60; is set to \\\&quot;fine-tune\\\&quot;, each line is a JSON record with \\\&quot;prompt\\\&quot; and \\\&quot;completion\\\&quot; fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data).
1932
+ * @param {string} purpose The intended purpose of the uploaded documents. Use \\\&quot;search\\\&quot; for [Search](/docs/api-reference/searches), \\\&quot;answers\\\&quot; for [Answers](/docs/api-reference/answers), \\\&quot;classifications\\\&quot; for [Classifications](/docs/api-reference/classifications) and \\\&quot;fine-tune\\\&quot; for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.
1933
+ * @param {*} [options] Override http request option.
1934
+ * @throws {RequiredError}
1935
+ */
1936
+ async createFile(file: any, purpose: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<OpenAIFile>> {
1937
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createFile(file, purpose, options);
1938
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1939
+ },
1940
+ /**
1941
+ *
1942
+ * @summary Creates a job that fine-tunes a specified model from a given dataset. Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
1943
+ * @param {CreateFineTuneRequest} createFineTuneRequest
1944
+ * @param {*} [options] Override http request option.
1945
+ * @throws {RequiredError}
1946
+ */
1947
+ async createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FineTune>> {
1948
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createFineTune(createFineTuneRequest, options);
1949
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1950
+ },
1951
+ /**
1952
+ *
1953
+ * @summary The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them. To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When `file` is set, the search endpoint searches over all the documents in the given file and returns up to the `max_rerank` number of documents. These documents will be returned along with their search scores. The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.
1954
+ * @param {string} engineId The ID of the engine to use for this request. You can select one of &#x60;ada&#x60;, &#x60;babbage&#x60;, &#x60;curie&#x60;, or &#x60;davinci&#x60;.
1955
+ * @param {CreateSearchRequest} createSearchRequest
1956
+ * @param {*} [options] Override http request option.
1957
+ * @throws {RequiredError}
1958
+ */
1959
+ async createSearch(engineId: string, createSearchRequest: CreateSearchRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateSearchResponse>> {
1960
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createSearch(engineId, createSearchRequest, options);
1961
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1962
+ },
1963
+ /**
1964
+ *
1965
+ * @summary Delete a file.
1966
+ * @param {string} fileId The ID of the file to use for this request
1967
+ * @param {*} [options] Override http request option.
1968
+ * @throws {RequiredError}
1969
+ */
1970
+ async deleteFile(fileId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<DeleteFileResponse>> {
1971
+ const localVarAxiosArgs = await localVarAxiosParamCreator.deleteFile(fileId, options);
1972
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1973
+ },
1974
+ /**
1975
+ *
1976
+ * @summary Returns the contents of the specified file
1977
+ * @param {string} fileId The ID of the file to use for this request
1978
+ * @param {*} [options] Override http request option.
1979
+ * @throws {RequiredError}
1980
+ */
1981
+ async downloadFile(fileId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> {
1982
+ const localVarAxiosArgs = await localVarAxiosParamCreator.downloadFile(fileId, options);
1983
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1984
+ },
1985
+ /**
1986
+ *
1987
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
1988
+ * @param {*} [options] Override http request option.
1989
+ * @throws {RequiredError}
1990
+ */
1991
+ async listEngines(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListEnginesResponse>> {
1992
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listEngines(options);
1993
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1994
+ },
1995
+ /**
1996
+ *
1997
+ * @summary Returns a list of files that belong to the user\'s organization.
1998
+ * @param {*} [options] Override http request option.
1999
+ * @throws {RequiredError}
2000
+ */
2001
+ async listFiles(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListFilesResponse>> {
2002
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listFiles(options);
2003
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2004
+ },
2005
+ /**
2006
+ *
2007
+ * @summary Get fine-grained status updates for a fine-tune job.
2008
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
2009
+ * @param {boolean} [stream] Whether to stream events for the fine-tune job. If set to true, events will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available. The stream will terminate with a &#x60;data: [DONE]&#x60; message when the job is finished (succeeded, cancelled, or failed). If set to false, only events generated so far will be returned.
2010
+ * @param {*} [options] Override http request option.
2011
+ * @throws {RequiredError}
2012
+ */
2013
+ async listFineTuneEvents(fineTuneId: string, stream?: boolean, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListFineTuneEventsResponse>> {
2014
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listFineTuneEvents(fineTuneId, stream, options);
2015
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2016
+ },
2017
+ /**
2018
+ *
2019
+ * @summary List your organization\'s fine-tuning jobs
2020
+ * @param {*} [options] Override http request option.
2021
+ * @throws {RequiredError}
2022
+ */
2023
+ async listFineTunes(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListFineTunesResponse>> {
2024
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listFineTunes(options);
2025
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2026
+ },
2027
+ /**
2028
+ *
2029
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
2030
+ * @param {string} engineId The ID of the engine to use for this request
2031
+ * @param {*} [options] Override http request option.
2032
+ * @throws {RequiredError}
2033
+ */
2034
+ async retrieveEngine(engineId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Engine>> {
2035
+ const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveEngine(engineId, options);
2036
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2037
+ },
2038
+ /**
2039
+ *
2040
+ * @summary Returns information about a specific file.
2041
+ * @param {string} fileId The ID of the file to use for this request
2042
+ * @param {*} [options] Override http request option.
2043
+ * @throws {RequiredError}
2044
+ */
2045
+ async retrieveFile(fileId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<OpenAIFile>> {
2046
+ const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveFile(fileId, options);
2047
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2048
+ },
2049
+ /**
2050
+ *
2051
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
2052
+ * @param {string} fineTuneId The ID of the fine-tune job
2053
+ * @param {*} [options] Override http request option.
2054
+ * @throws {RequiredError}
2055
+ */
2056
+ async retrieveFineTune(fineTuneId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FineTune>> {
2057
+ const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveFineTune(fineTuneId, options);
2058
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2059
+ },
2060
+ }
2061
+ };
2062
+
2063
+ /**
2064
+ * OpenAIApi - factory interface
2065
+ * @export
2066
+ */
2067
+ export const OpenAIApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
2068
+ const localVarFp = OpenAIApiFp(configuration)
2069
+ return {
2070
+ /**
2071
+ *
2072
+ * @summary Immediately cancel a fine-tune job.
2073
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
2074
+ * @param {*} [options] Override http request option.
2075
+ * @throws {RequiredError}
2076
+ */
2077
+ cancelFineTune(fineTuneId: string, options?: any): AxiosPromise<FineTune> {
2078
+ return localVarFp.cancelFineTune(fineTuneId, options).then((request) => request(axios, basePath));
2079
+ },
2080
+ /**
2081
+ *
2082
+ * @summary Answers the specified question using the provided documents and examples. The endpoint first [searches](/docs/api-reference/searches) over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for [completion](/docs/api-reference/completions).
2083
+ * @param {CreateAnswerRequest} createAnswerRequest
2084
+ * @param {*} [options] Override http request option.
2085
+ * @throws {RequiredError}
2086
+ */
2087
+ createAnswer(createAnswerRequest: CreateAnswerRequest, options?: any): AxiosPromise<CreateAnswerResponse> {
2088
+ return localVarFp.createAnswer(createAnswerRequest, options).then((request) => request(axios, basePath));
2089
+ },
2090
+ /**
2091
+ *
2092
+ * @summary Classifies the specified `query` using provided examples. The endpoint first [searches](/docs/api-reference/searches) over the labeled examples to select the ones most relevant for the particular query. Then, the relevant examples are combined with the query to construct a prompt to produce the final label via the [completions](/docs/api-reference/completions) endpoint. Labeled examples can be provided via an uploaded `file`, or explicitly listed in the request using the `examples` parameter for quick tests and small scale use cases.
2093
+ * @param {CreateClassificationRequest} createClassificationRequest
2094
+ * @param {*} [options] Override http request option.
2095
+ * @throws {RequiredError}
2096
+ */
2097
+ createClassification(createClassificationRequest: CreateClassificationRequest, options?: any): AxiosPromise<CreateClassificationResponse> {
2098
+ return localVarFp.createClassification(createClassificationRequest, options).then((request) => request(axios, basePath));
2099
+ },
2100
+ /**
2101
+ *
2102
+ * @summary Creates a new completion for the provided prompt and parameters
2103
+ * @param {string} engineId The ID of the engine to use for this request
2104
+ * @param {CreateCompletionRequest} createCompletionRequest
2105
+ * @param {*} [options] Override http request option.
2106
+ * @throws {RequiredError}
2107
+ */
2108
+ createCompletion(engineId: string, createCompletionRequest: CreateCompletionRequest, options?: any): AxiosPromise<CreateCompletionResponse> {
2109
+ return localVarFp.createCompletion(engineId, createCompletionRequest, options).then((request) => request(axios, basePath));
2110
+ },
2111
+ /**
2112
+ *
2113
+ * @summary Creates a completion using a fine-tuned model
2114
+ * @param {CreateCompletionFromModelRequest} createCompletionFromModelRequest
2115
+ * @param {*} [options] Override http request option.
2116
+ * @throws {RequiredError}
2117
+ */
2118
+ createCompletionFromModel(createCompletionFromModelRequest: CreateCompletionFromModelRequest, options?: any): AxiosPromise<CreateCompletionResponse> {
2119
+ return localVarFp.createCompletionFromModel(createCompletionFromModelRequest, options).then((request) => request(axios, basePath));
2120
+ },
2121
+ /**
2122
+ *
2123
+ * @summary Creates an embedding vector representing the input text.
2124
+ * @param {string} engineId The ID of the engine to use for this request
2125
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
2126
+ * @param {*} [options] Override http request option.
2127
+ * @throws {RequiredError}
2128
+ */
2129
+ createEmbedding(engineId: string, createEmbeddingRequest: CreateEmbeddingRequest, options?: any): AxiosPromise<CreateEmbeddingResponse> {
2130
+ return localVarFp.createEmbedding(engineId, createEmbeddingRequest, options).then((request) => request(axios, basePath));
2131
+ },
2132
+ /**
2133
+ *
2134
+ * @summary Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.
2135
+ * @param {any} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the &#x60;purpose&#x60; is set to \\\&quot;search\\\&quot; or \\\&quot;answers\\\&quot;, each line is a JSON record with a \\\&quot;text\\\&quot; field and an optional \\\&quot;metadata\\\&quot; field. Only \\\&quot;text\\\&quot; field will be used for search. Specially, when the &#x60;purpose&#x60; is \\\&quot;answers\\\&quot;, \\\&quot;\\\\n\\\&quot; is used as a delimiter to chunk contents in the \\\&quot;text\\\&quot; field into multiple documents for finer-grained matching. If the &#x60;purpose&#x60; is set to \\\&quot;classifications\\\&quot;, each line is a JSON record representing a single training example with \\\&quot;text\\\&quot; and \\\&quot;label\\\&quot; fields along with an optional \\\&quot;metadata\\\&quot; field. If the &#x60;purpose&#x60; is set to \\\&quot;fine-tune\\\&quot;, each line is a JSON record with \\\&quot;prompt\\\&quot; and \\\&quot;completion\\\&quot; fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data).
2136
+ * @param {string} purpose The intended purpose of the uploaded documents. Use \\\&quot;search\\\&quot; for [Search](/docs/api-reference/searches), \\\&quot;answers\\\&quot; for [Answers](/docs/api-reference/answers), \\\&quot;classifications\\\&quot; for [Classifications](/docs/api-reference/classifications) and \\\&quot;fine-tune\\\&quot; for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.
2137
+ * @param {*} [options] Override http request option.
2138
+ * @throws {RequiredError}
2139
+ */
2140
+ createFile(file: any, purpose: string, options?: any): AxiosPromise<OpenAIFile> {
2141
+ return localVarFp.createFile(file, purpose, options).then((request) => request(axios, basePath));
2142
+ },
2143
+ /**
2144
+ *
2145
+ * @summary Creates a job that fine-tunes a specified model from a given dataset. Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
2146
+ * @param {CreateFineTuneRequest} createFineTuneRequest
2147
+ * @param {*} [options] Override http request option.
2148
+ * @throws {RequiredError}
2149
+ */
2150
+ createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: any): AxiosPromise<FineTune> {
2151
+ return localVarFp.createFineTune(createFineTuneRequest, options).then((request) => request(axios, basePath));
2152
+ },
2153
+ /**
2154
+ *
2155
+ * @summary The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them. To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When `file` is set, the search endpoint searches over all the documents in the given file and returns up to the `max_rerank` number of documents. These documents will be returned along with their search scores. The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.
2156
+ * @param {string} engineId The ID of the engine to use for this request. You can select one of &#x60;ada&#x60;, &#x60;babbage&#x60;, &#x60;curie&#x60;, or &#x60;davinci&#x60;.
2157
+ * @param {CreateSearchRequest} createSearchRequest
2158
+ * @param {*} [options] Override http request option.
2159
+ * @throws {RequiredError}
2160
+ */
2161
+ createSearch(engineId: string, createSearchRequest: CreateSearchRequest, options?: any): AxiosPromise<CreateSearchResponse> {
2162
+ return localVarFp.createSearch(engineId, createSearchRequest, options).then((request) => request(axios, basePath));
2163
+ },
2164
+ /**
2165
+ *
2166
+ * @summary Delete a file.
2167
+ * @param {string} fileId The ID of the file to use for this request
2168
+ * @param {*} [options] Override http request option.
2169
+ * @throws {RequiredError}
2170
+ */
2171
+ deleteFile(fileId: string, options?: any): AxiosPromise<DeleteFileResponse> {
2172
+ return localVarFp.deleteFile(fileId, options).then((request) => request(axios, basePath));
2173
+ },
2174
+ /**
2175
+ *
2176
+ * @summary Returns the contents of the specified file
2177
+ * @param {string} fileId The ID of the file to use for this request
2178
+ * @param {*} [options] Override http request option.
2179
+ * @throws {RequiredError}
2180
+ */
2181
+ downloadFile(fileId: string, options?: any): AxiosPromise<string> {
2182
+ return localVarFp.downloadFile(fileId, options).then((request) => request(axios, basePath));
2183
+ },
2184
+ /**
2185
+ *
2186
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
2187
+ * @param {*} [options] Override http request option.
2188
+ * @throws {RequiredError}
2189
+ */
2190
+ listEngines(options?: any): AxiosPromise<ListEnginesResponse> {
2191
+ return localVarFp.listEngines(options).then((request) => request(axios, basePath));
2192
+ },
2193
+ /**
2194
+ *
2195
+ * @summary Returns a list of files that belong to the user\'s organization.
2196
+ * @param {*} [options] Override http request option.
2197
+ * @throws {RequiredError}
2198
+ */
2199
+ listFiles(options?: any): AxiosPromise<ListFilesResponse> {
2200
+ return localVarFp.listFiles(options).then((request) => request(axios, basePath));
2201
+ },
2202
+ /**
2203
+ *
2204
+ * @summary Get fine-grained status updates for a fine-tune job.
2205
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
2206
+ * @param {boolean} [stream] Whether to stream events for the fine-tune job. If set to true, events will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available. The stream will terminate with a &#x60;data: [DONE]&#x60; message when the job is finished (succeeded, cancelled, or failed). If set to false, only events generated so far will be returned.
2207
+ * @param {*} [options] Override http request option.
2208
+ * @throws {RequiredError}
2209
+ */
2210
+ listFineTuneEvents(fineTuneId: string, stream?: boolean, options?: any): AxiosPromise<ListFineTuneEventsResponse> {
2211
+ return localVarFp.listFineTuneEvents(fineTuneId, stream, options).then((request) => request(axios, basePath));
2212
+ },
2213
+ /**
2214
+ *
2215
+ * @summary List your organization\'s fine-tuning jobs
2216
+ * @param {*} [options] Override http request option.
2217
+ * @throws {RequiredError}
2218
+ */
2219
+ listFineTunes(options?: any): AxiosPromise<ListFineTunesResponse> {
2220
+ return localVarFp.listFineTunes(options).then((request) => request(axios, basePath));
2221
+ },
2222
+ /**
2223
+ *
2224
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
2225
+ * @param {string} engineId The ID of the engine to use for this request
2226
+ * @param {*} [options] Override http request option.
2227
+ * @throws {RequiredError}
2228
+ */
2229
+ retrieveEngine(engineId: string, options?: any): AxiosPromise<Engine> {
2230
+ return localVarFp.retrieveEngine(engineId, options).then((request) => request(axios, basePath));
2231
+ },
2232
+ /**
2233
+ *
2234
+ * @summary Returns information about a specific file.
2235
+ * @param {string} fileId The ID of the file to use for this request
2236
+ * @param {*} [options] Override http request option.
2237
+ * @throws {RequiredError}
2238
+ */
2239
+ retrieveFile(fileId: string, options?: any): AxiosPromise<OpenAIFile> {
2240
+ return localVarFp.retrieveFile(fileId, options).then((request) => request(axios, basePath));
2241
+ },
2242
+ /**
2243
+ *
2244
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
2245
+ * @param {string} fineTuneId The ID of the fine-tune job
2246
+ * @param {*} [options] Override http request option.
2247
+ * @throws {RequiredError}
2248
+ */
2249
+ retrieveFineTune(fineTuneId: string, options?: any): AxiosPromise<FineTune> {
2250
+ return localVarFp.retrieveFineTune(fineTuneId, options).then((request) => request(axios, basePath));
2251
+ },
2252
+ };
2253
+ };
2254
+
2255
+ /**
2256
+ * OpenAIApi - object-oriented interface
2257
+ * @export
2258
+ * @class OpenAIApi
2259
+ * @extends {BaseAPI}
2260
+ */
2261
+ export class OpenAIApi extends BaseAPI {
2262
+ /**
2263
+ *
2264
+ * @summary Immediately cancel a fine-tune job.
2265
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
2266
+ * @param {*} [options] Override http request option.
2267
+ * @throws {RequiredError}
2268
+ * @memberof OpenAIApi
2269
+ */
2270
+ public cancelFineTune(fineTuneId: string, options?: AxiosRequestConfig) {
2271
+ return OpenAIApiFp(this.configuration).cancelFineTune(fineTuneId, options).then((request) => request(this.axios, this.basePath));
2272
+ }
2273
+
2274
+ /**
2275
+ *
2276
+ * @summary Answers the specified question using the provided documents and examples. The endpoint first [searches](/docs/api-reference/searches) over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for [completion](/docs/api-reference/completions).
2277
+ * @param {CreateAnswerRequest} createAnswerRequest
2278
+ * @param {*} [options] Override http request option.
2279
+ * @throws {RequiredError}
2280
+ * @memberof OpenAIApi
2281
+ */
2282
+ public createAnswer(createAnswerRequest: CreateAnswerRequest, options?: AxiosRequestConfig) {
2283
+ return OpenAIApiFp(this.configuration).createAnswer(createAnswerRequest, options).then((request) => request(this.axios, this.basePath));
2284
+ }
2285
+
2286
+ /**
2287
+ *
2288
+ * @summary Classifies the specified `query` using provided examples. The endpoint first [searches](/docs/api-reference/searches) over the labeled examples to select the ones most relevant for the particular query. Then, the relevant examples are combined with the query to construct a prompt to produce the final label via the [completions](/docs/api-reference/completions) endpoint. Labeled examples can be provided via an uploaded `file`, or explicitly listed in the request using the `examples` parameter for quick tests and small scale use cases.
2289
+ * @param {CreateClassificationRequest} createClassificationRequest
2290
+ * @param {*} [options] Override http request option.
2291
+ * @throws {RequiredError}
2292
+ * @memberof OpenAIApi
2293
+ */
2294
+ public createClassification(createClassificationRequest: CreateClassificationRequest, options?: AxiosRequestConfig) {
2295
+ return OpenAIApiFp(this.configuration).createClassification(createClassificationRequest, options).then((request) => request(this.axios, this.basePath));
2296
+ }
2297
+
2298
+ /**
2299
+ *
2300
+ * @summary Creates a new completion for the provided prompt and parameters
2301
+ * @param {string} engineId The ID of the engine to use for this request
2302
+ * @param {CreateCompletionRequest} createCompletionRequest
2303
+ * @param {*} [options] Override http request option.
2304
+ * @throws {RequiredError}
2305
+ * @memberof OpenAIApi
2306
+ */
2307
+ public createCompletion(engineId: string, createCompletionRequest: CreateCompletionRequest, options?: AxiosRequestConfig) {
2308
+ return OpenAIApiFp(this.configuration).createCompletion(engineId, createCompletionRequest, options).then((request) => request(this.axios, this.basePath));
2309
+ }
2310
+
2311
+ /**
2312
+ *
2313
+ * @summary Creates a completion using a fine-tuned model
2314
+ * @param {CreateCompletionFromModelRequest} createCompletionFromModelRequest
2315
+ * @param {*} [options] Override http request option.
2316
+ * @throws {RequiredError}
2317
+ * @memberof OpenAIApi
2318
+ */
2319
+ public createCompletionFromModel(createCompletionFromModelRequest: CreateCompletionFromModelRequest, options?: AxiosRequestConfig) {
2320
+ return OpenAIApiFp(this.configuration).createCompletionFromModel(createCompletionFromModelRequest, options).then((request) => request(this.axios, this.basePath));
2321
+ }
2322
+
2323
+ /**
2324
+ *
2325
+ * @summary Creates an embedding vector representing the input text.
2326
+ * @param {string} engineId The ID of the engine to use for this request
2327
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
2328
+ * @param {*} [options] Override http request option.
2329
+ * @throws {RequiredError}
2330
+ * @memberof OpenAIApi
2331
+ */
2332
+ public createEmbedding(engineId: string, createEmbeddingRequest: CreateEmbeddingRequest, options?: AxiosRequestConfig) {
2333
+ return OpenAIApiFp(this.configuration).createEmbedding(engineId, createEmbeddingRequest, options).then((request) => request(this.axios, this.basePath));
2334
+ }
2335
+
2336
+ /**
2337
+ *
2338
+ * @summary Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.
2339
+ * @param {any} file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. If the &#x60;purpose&#x60; is set to \\\&quot;search\\\&quot; or \\\&quot;answers\\\&quot;, each line is a JSON record with a \\\&quot;text\\\&quot; field and an optional \\\&quot;metadata\\\&quot; field. Only \\\&quot;text\\\&quot; field will be used for search. Specially, when the &#x60;purpose&#x60; is \\\&quot;answers\\\&quot;, \\\&quot;\\\\n\\\&quot; is used as a delimiter to chunk contents in the \\\&quot;text\\\&quot; field into multiple documents for finer-grained matching. If the &#x60;purpose&#x60; is set to \\\&quot;classifications\\\&quot;, each line is a JSON record representing a single training example with \\\&quot;text\\\&quot; and \\\&quot;label\\\&quot; fields along with an optional \\\&quot;metadata\\\&quot; field. If the &#x60;purpose&#x60; is set to \\\&quot;fine-tune\\\&quot;, each line is a JSON record with \\\&quot;prompt\\\&quot; and \\\&quot;completion\\\&quot; fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data).
2340
+ * @param {string} purpose The intended purpose of the uploaded documents. Use \\\&quot;search\\\&quot; for [Search](/docs/api-reference/searches), \\\&quot;answers\\\&quot; for [Answers](/docs/api-reference/answers), \\\&quot;classifications\\\&quot; for [Classifications](/docs/api-reference/classifications) and \\\&quot;fine-tune\\\&quot; for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file.
2341
+ * @param {*} [options] Override http request option.
2342
+ * @throws {RequiredError}
2343
+ * @memberof OpenAIApi
2344
+ */
2345
+ public createFile(file: any, purpose: string, options?: AxiosRequestConfig) {
2346
+ return OpenAIApiFp(this.configuration).createFile(file, purpose, options).then((request) => request(this.axios, this.basePath));
2347
+ }
2348
+
2349
+ /**
2350
+ *
2351
+ * @summary Creates a job that fine-tunes a specified model from a given dataset. Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
2352
+ * @param {CreateFineTuneRequest} createFineTuneRequest
2353
+ * @param {*} [options] Override http request option.
2354
+ * @throws {RequiredError}
2355
+ * @memberof OpenAIApi
2356
+ */
2357
+ public createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: AxiosRequestConfig) {
2358
+ return OpenAIApiFp(this.configuration).createFineTune(createFineTuneRequest, options).then((request) => request(this.axios, this.basePath));
2359
+ }
2360
+
2361
+ /**
2362
+ *
2363
+ * @summary The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them. To go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When `file` is set, the search endpoint searches over all the documents in the given file and returns up to the `max_rerank` number of documents. These documents will be returned along with their search scores. The similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.
2364
+ * @param {string} engineId The ID of the engine to use for this request. You can select one of &#x60;ada&#x60;, &#x60;babbage&#x60;, &#x60;curie&#x60;, or &#x60;davinci&#x60;.
2365
+ * @param {CreateSearchRequest} createSearchRequest
2366
+ * @param {*} [options] Override http request option.
2367
+ * @throws {RequiredError}
2368
+ * @memberof OpenAIApi
2369
+ */
2370
+ public createSearch(engineId: string, createSearchRequest: CreateSearchRequest, options?: AxiosRequestConfig) {
2371
+ return OpenAIApiFp(this.configuration).createSearch(engineId, createSearchRequest, options).then((request) => request(this.axios, this.basePath));
2372
+ }
2373
+
2374
+ /**
2375
+ *
2376
+ * @summary Delete a file.
2377
+ * @param {string} fileId The ID of the file to use for this request
2378
+ * @param {*} [options] Override http request option.
2379
+ * @throws {RequiredError}
2380
+ * @memberof OpenAIApi
2381
+ */
2382
+ public deleteFile(fileId: string, options?: AxiosRequestConfig) {
2383
+ return OpenAIApiFp(this.configuration).deleteFile(fileId, options).then((request) => request(this.axios, this.basePath));
2384
+ }
2385
+
2386
+ /**
2387
+ *
2388
+ * @summary Returns the contents of the specified file
2389
+ * @param {string} fileId The ID of the file to use for this request
2390
+ * @param {*} [options] Override http request option.
2391
+ * @throws {RequiredError}
2392
+ * @memberof OpenAIApi
2393
+ */
2394
+ public downloadFile(fileId: string, options?: AxiosRequestConfig) {
2395
+ return OpenAIApiFp(this.configuration).downloadFile(fileId, options).then((request) => request(this.axios, this.basePath));
2396
+ }
2397
+
2398
+ /**
2399
+ *
2400
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
2401
+ * @param {*} [options] Override http request option.
2402
+ * @throws {RequiredError}
2403
+ * @memberof OpenAIApi
2404
+ */
2405
+ public listEngines(options?: AxiosRequestConfig) {
2406
+ return OpenAIApiFp(this.configuration).listEngines(options).then((request) => request(this.axios, this.basePath));
2407
+ }
2408
+
2409
+ /**
2410
+ *
2411
+ * @summary Returns a list of files that belong to the user\'s organization.
2412
+ * @param {*} [options] Override http request option.
2413
+ * @throws {RequiredError}
2414
+ * @memberof OpenAIApi
2415
+ */
2416
+ public listFiles(options?: AxiosRequestConfig) {
2417
+ return OpenAIApiFp(this.configuration).listFiles(options).then((request) => request(this.axios, this.basePath));
2418
+ }
2419
+
2420
+ /**
2421
+ *
2422
+ * @summary Get fine-grained status updates for a fine-tune job.
2423
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
2424
+ * @param {boolean} [stream] Whether to stream events for the fine-tune job. If set to true, events will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available. The stream will terminate with a &#x60;data: [DONE]&#x60; message when the job is finished (succeeded, cancelled, or failed). If set to false, only events generated so far will be returned.
2425
+ * @param {*} [options] Override http request option.
2426
+ * @throws {RequiredError}
2427
+ * @memberof OpenAIApi
2428
+ */
2429
+ public listFineTuneEvents(fineTuneId: string, stream?: boolean, options?: AxiosRequestConfig) {
2430
+ return OpenAIApiFp(this.configuration).listFineTuneEvents(fineTuneId, stream, options).then((request) => request(this.axios, this.basePath));
2431
+ }
2432
+
2433
+ /**
2434
+ *
2435
+ * @summary List your organization\'s fine-tuning jobs
2436
+ * @param {*} [options] Override http request option.
2437
+ * @throws {RequiredError}
2438
+ * @memberof OpenAIApi
2439
+ */
2440
+ public listFineTunes(options?: AxiosRequestConfig) {
2441
+ return OpenAIApiFp(this.configuration).listFineTunes(options).then((request) => request(this.axios, this.basePath));
2442
+ }
2443
+
2444
+ /**
2445
+ *
2446
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
2447
+ * @param {string} engineId The ID of the engine to use for this request
2448
+ * @param {*} [options] Override http request option.
2449
+ * @throws {RequiredError}
2450
+ * @memberof OpenAIApi
2451
+ */
2452
+ public retrieveEngine(engineId: string, options?: AxiosRequestConfig) {
2453
+ return OpenAIApiFp(this.configuration).retrieveEngine(engineId, options).then((request) => request(this.axios, this.basePath));
2454
+ }
2455
+
2456
+ /**
2457
+ *
2458
+ * @summary Returns information about a specific file.
2459
+ * @param {string} fileId The ID of the file to use for this request
2460
+ * @param {*} [options] Override http request option.
2461
+ * @throws {RequiredError}
2462
+ * @memberof OpenAIApi
2463
+ */
2464
+ public retrieveFile(fileId: string, options?: AxiosRequestConfig) {
2465
+ return OpenAIApiFp(this.configuration).retrieveFile(fileId, options).then((request) => request(this.axios, this.basePath));
2466
+ }
2467
+
2468
+ /**
2469
+ *
2470
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
2471
+ * @param {string} fineTuneId The ID of the fine-tune job
2472
+ * @param {*} [options] Override http request option.
2473
+ * @throws {RequiredError}
2474
+ * @memberof OpenAIApi
2475
+ */
2476
+ public retrieveFineTune(fineTuneId: string, options?: AxiosRequestConfig) {
2477
+ return OpenAIApiFp(this.configuration).retrieveFineTune(fineTuneId, options).then((request) => request(this.axios, this.basePath));
2478
+ }
2479
+ }
2480
+
2481
+