openai 1.1.1 → 2.0.2

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,2445 @@
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.0
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
+ /**
134
+ *
135
+ * @export
136
+ * @interface CreateAnswerResponse
137
+ */
138
+ export interface CreateAnswerResponse {
139
+ /**
140
+ *
141
+ * @type {string}
142
+ * @memberof CreateAnswerResponse
143
+ */
144
+ 'object'?: string;
145
+ /**
146
+ *
147
+ * @type {string}
148
+ * @memberof CreateAnswerResponse
149
+ */
150
+ 'model'?: string;
151
+ /**
152
+ *
153
+ * @type {string}
154
+ * @memberof CreateAnswerResponse
155
+ */
156
+ 'search_model'?: string;
157
+ /**
158
+ *
159
+ * @type {string}
160
+ * @memberof CreateAnswerResponse
161
+ */
162
+ 'completion'?: string;
163
+ /**
164
+ *
165
+ * @type {Array<string>}
166
+ * @memberof CreateAnswerResponse
167
+ */
168
+ 'answers'?: Array<string>;
169
+ /**
170
+ *
171
+ * @type {Array<CreateAnswerResponseSelectedDocuments>}
172
+ * @memberof CreateAnswerResponse
173
+ */
174
+ 'selected_documents'?: Array<CreateAnswerResponseSelectedDocuments>;
175
+ }
176
+ /**
177
+ *
178
+ * @export
179
+ * @interface CreateAnswerResponseSelectedDocuments
180
+ */
181
+ export interface CreateAnswerResponseSelectedDocuments {
182
+ /**
183
+ *
184
+ * @type {number}
185
+ * @memberof CreateAnswerResponseSelectedDocuments
186
+ */
187
+ 'document'?: number;
188
+ /**
189
+ *
190
+ * @type {string}
191
+ * @memberof CreateAnswerResponseSelectedDocuments
192
+ */
193
+ 'text'?: string;
194
+ }
195
+ /**
196
+ *
197
+ * @export
198
+ * @interface CreateClassificationRequest
199
+ */
200
+ export interface CreateClassificationRequest {
201
+ /**
202
+ * ID of the engine to use for completion. You can select one of `ada`, `babbage`, `curie`, or `davinci`.
203
+ * @type {string}
204
+ * @memberof CreateClassificationRequest
205
+ */
206
+ 'model'?: string;
207
+ /**
208
+ * Query to be classified.
209
+ * @type {string}
210
+ * @memberof CreateClassificationRequest
211
+ */
212
+ 'query'?: string;
213
+ /**
214
+ * 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.
215
+ * @type {Array<any>}
216
+ * @memberof CreateClassificationRequest
217
+ */
218
+ 'examples'?: Array<any> | null;
219
+ /**
220
+ * 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.
221
+ * @type {string}
222
+ * @memberof CreateClassificationRequest
223
+ */
224
+ 'file'?: string | null;
225
+ /**
226
+ * 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.
227
+ * @type {Array<string>}
228
+ * @memberof CreateClassificationRequest
229
+ */
230
+ 'labels'?: Array<string> | null;
231
+ /**
232
+ * ID of the engine to use for [Search](/docs/api-reference/searches/create). You can select one of `ada`, `babbage`, `curie`, or `davinci`.
233
+ * @type {string}
234
+ * @memberof CreateClassificationRequest
235
+ */
236
+ 'search_model'?: string | null;
237
+ /**
238
+ * 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.
239
+ * @type {number}
240
+ * @memberof CreateClassificationRequest
241
+ */
242
+ 'temperature'?: number | null;
243
+ /**
244
+ * 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.
245
+ * @type {number}
246
+ * @memberof CreateClassificationRequest
247
+ */
248
+ 'logprobs'?: number | null;
249
+ /**
250
+ * 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.
251
+ * @type {number}
252
+ * @memberof CreateClassificationRequest
253
+ */
254
+ 'max_examples'?: number | null;
255
+ /**
256
+ * 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.
257
+ * @type {object}
258
+ * @memberof CreateClassificationRequest
259
+ */
260
+ 'logit_bias'?: object | null;
261
+ /**
262
+ * 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.
263
+ * @type {boolean}
264
+ * @memberof CreateClassificationRequest
265
+ */
266
+ 'return_prompt'?: boolean | null;
267
+ /**
268
+ * 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.
269
+ * @type {boolean}
270
+ * @memberof CreateClassificationRequest
271
+ */
272
+ 'return_metadata'?: boolean | null;
273
+ /**
274
+ * 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.
275
+ * @type {Array<any>}
276
+ * @memberof CreateClassificationRequest
277
+ */
278
+ 'expand'?: Array<any> | null;
279
+ }
280
+ /**
281
+ *
282
+ * @export
283
+ * @interface CreateClassificationResponse
284
+ */
285
+ export interface CreateClassificationResponse {
286
+ /**
287
+ *
288
+ * @type {string}
289
+ * @memberof CreateClassificationResponse
290
+ */
291
+ 'object'?: string;
292
+ /**
293
+ *
294
+ * @type {string}
295
+ * @memberof CreateClassificationResponse
296
+ */
297
+ 'model'?: string;
298
+ /**
299
+ *
300
+ * @type {string}
301
+ * @memberof CreateClassificationResponse
302
+ */
303
+ 'search_model'?: string;
304
+ /**
305
+ *
306
+ * @type {string}
307
+ * @memberof CreateClassificationResponse
308
+ */
309
+ 'completion'?: string;
310
+ /**
311
+ *
312
+ * @type {string}
313
+ * @memberof CreateClassificationResponse
314
+ */
315
+ 'label'?: string;
316
+ /**
317
+ *
318
+ * @type {Array<CreateClassificationResponseSelectedExamples>}
319
+ * @memberof CreateClassificationResponse
320
+ */
321
+ 'selected_examples'?: Array<CreateClassificationResponseSelectedExamples>;
322
+ }
323
+ /**
324
+ *
325
+ * @export
326
+ * @interface CreateClassificationResponseSelectedExamples
327
+ */
328
+ export interface CreateClassificationResponseSelectedExamples {
329
+ /**
330
+ *
331
+ * @type {number}
332
+ * @memberof CreateClassificationResponseSelectedExamples
333
+ */
334
+ 'document'?: number;
335
+ /**
336
+ *
337
+ * @type {string}
338
+ * @memberof CreateClassificationResponseSelectedExamples
339
+ */
340
+ 'text'?: string;
341
+ /**
342
+ *
343
+ * @type {string}
344
+ * @memberof CreateClassificationResponseSelectedExamples
345
+ */
346
+ 'label'?: string;
347
+ }
348
+ /**
349
+ *
350
+ * @export
351
+ * @interface CreateCompletionFromModelRequest
352
+ */
353
+ export interface CreateCompletionFromModelRequest {
354
+ /**
355
+ * 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.
356
+ * @type {string | Array<string> | Array<number> | Array<any>}
357
+ * @memberof CreateCompletionFromModelRequest
358
+ */
359
+ 'prompt'?: string | Array<string> | Array<number> | Array<any> | null;
360
+ /**
361
+ * 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).
362
+ * @type {number}
363
+ * @memberof CreateCompletionFromModelRequest
364
+ */
365
+ 'max_tokens'?: number | null;
366
+ /**
367
+ * 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.
368
+ * @type {number}
369
+ * @memberof CreateCompletionFromModelRequest
370
+ */
371
+ 'temperature'?: number | null;
372
+ /**
373
+ * 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.
374
+ * @type {number}
375
+ * @memberof CreateCompletionFromModelRequest
376
+ */
377
+ 'top_p'?: number | null;
378
+ /**
379
+ * 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`.
380
+ * @type {number}
381
+ * @memberof CreateCompletionFromModelRequest
382
+ */
383
+ 'n'?: number | null;
384
+ /**
385
+ * 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.
386
+ * @type {boolean}
387
+ * @memberof CreateCompletionFromModelRequest
388
+ */
389
+ 'stream'?: boolean | null;
390
+ /**
391
+ * 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.
392
+ * @type {number}
393
+ * @memberof CreateCompletionFromModelRequest
394
+ */
395
+ 'logprobs'?: number | null;
396
+ /**
397
+ * Echo back the prompt in addition to the completion
398
+ * @type {boolean}
399
+ * @memberof CreateCompletionFromModelRequest
400
+ */
401
+ 'echo'?: boolean | null;
402
+ /**
403
+ * Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
404
+ * @type {string | Array<string>}
405
+ * @memberof CreateCompletionFromModelRequest
406
+ */
407
+ 'stop'?: string | Array<string> | null;
408
+ /**
409
+ * 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)
410
+ * @type {number}
411
+ * @memberof CreateCompletionFromModelRequest
412
+ */
413
+ 'presence_penalty'?: number | null;
414
+ /**
415
+ * 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)
416
+ * @type {number}
417
+ * @memberof CreateCompletionFromModelRequest
418
+ */
419
+ 'frequency_penalty'?: number | null;
420
+ /**
421
+ * 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`.
422
+ * @type {number}
423
+ * @memberof CreateCompletionFromModelRequest
424
+ */
425
+ 'best_of'?: number | null;
426
+ /**
427
+ * 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.
428
+ * @type {object}
429
+ * @memberof CreateCompletionFromModelRequest
430
+ */
431
+ 'logit_bias'?: object | null;
432
+ /**
433
+ * ID of the model to use for completion.
434
+ * @type {string}
435
+ * @memberof CreateCompletionFromModelRequest
436
+ */
437
+ 'model'?: string;
438
+ }
439
+ /**
440
+ *
441
+ * @export
442
+ * @interface CreateCompletionFromModelRequestAllOf
443
+ */
444
+ export interface CreateCompletionFromModelRequestAllOf {
445
+ /**
446
+ * ID of the model to use for completion.
447
+ * @type {string}
448
+ * @memberof CreateCompletionFromModelRequestAllOf
449
+ */
450
+ 'model'?: string;
451
+ }
452
+ /**
453
+ *
454
+ * @export
455
+ * @interface CreateCompletionRequest
456
+ */
457
+ export interface CreateCompletionRequest {
458
+ /**
459
+ * 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.
460
+ * @type {string | Array<string> | Array<number> | Array<any>}
461
+ * @memberof CreateCompletionRequest
462
+ */
463
+ 'prompt'?: string | Array<string> | Array<number> | Array<any> | null;
464
+ /**
465
+ * 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).
466
+ * @type {number}
467
+ * @memberof CreateCompletionRequest
468
+ */
469
+ 'max_tokens'?: number | null;
470
+ /**
471
+ * 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.
472
+ * @type {number}
473
+ * @memberof CreateCompletionRequest
474
+ */
475
+ 'temperature'?: number | null;
476
+ /**
477
+ * 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.
478
+ * @type {number}
479
+ * @memberof CreateCompletionRequest
480
+ */
481
+ 'top_p'?: number | null;
482
+ /**
483
+ * 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`.
484
+ * @type {number}
485
+ * @memberof CreateCompletionRequest
486
+ */
487
+ 'n'?: number | null;
488
+ /**
489
+ * 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.
490
+ * @type {boolean}
491
+ * @memberof CreateCompletionRequest
492
+ */
493
+ 'stream'?: boolean | null;
494
+ /**
495
+ * 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.
496
+ * @type {number}
497
+ * @memberof CreateCompletionRequest
498
+ */
499
+ 'logprobs'?: number | null;
500
+ /**
501
+ * Echo back the prompt in addition to the completion
502
+ * @type {boolean}
503
+ * @memberof CreateCompletionRequest
504
+ */
505
+ 'echo'?: boolean | null;
506
+ /**
507
+ * Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence.
508
+ * @type {string | Array<string>}
509
+ * @memberof CreateCompletionRequest
510
+ */
511
+ 'stop'?: string | Array<string> | null;
512
+ /**
513
+ * 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)
514
+ * @type {number}
515
+ * @memberof CreateCompletionRequest
516
+ */
517
+ 'presence_penalty'?: number | null;
518
+ /**
519
+ * 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)
520
+ * @type {number}
521
+ * @memberof CreateCompletionRequest
522
+ */
523
+ 'frequency_penalty'?: number | null;
524
+ /**
525
+ * 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`.
526
+ * @type {number}
527
+ * @memberof CreateCompletionRequest
528
+ */
529
+ 'best_of'?: number | null;
530
+ /**
531
+ * 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.
532
+ * @type {object}
533
+ * @memberof CreateCompletionRequest
534
+ */
535
+ 'logit_bias'?: object | null;
536
+ }
537
+ /**
538
+ *
539
+ * @export
540
+ * @interface CreateCompletionResponse
541
+ */
542
+ export interface CreateCompletionResponse {
543
+ /**
544
+ *
545
+ * @type {string}
546
+ * @memberof CreateCompletionResponse
547
+ */
548
+ 'id'?: string;
549
+ /**
550
+ *
551
+ * @type {string}
552
+ * @memberof CreateCompletionResponse
553
+ */
554
+ 'object'?: string;
555
+ /**
556
+ *
557
+ * @type {number}
558
+ * @memberof CreateCompletionResponse
559
+ */
560
+ 'created'?: number;
561
+ /**
562
+ *
563
+ * @type {string}
564
+ * @memberof CreateCompletionResponse
565
+ */
566
+ 'model'?: string;
567
+ /**
568
+ *
569
+ * @type {Array<CreateCompletionResponseChoices>}
570
+ * @memberof CreateCompletionResponse
571
+ */
572
+ 'choices'?: Array<CreateCompletionResponseChoices>;
573
+ }
574
+ /**
575
+ *
576
+ * @export
577
+ * @interface CreateCompletionResponseChoices
578
+ */
579
+ export interface CreateCompletionResponseChoices {
580
+ /**
581
+ *
582
+ * @type {string}
583
+ * @memberof CreateCompletionResponseChoices
584
+ */
585
+ 'text'?: string;
586
+ /**
587
+ *
588
+ * @type {number}
589
+ * @memberof CreateCompletionResponseChoices
590
+ */
591
+ 'index'?: number;
592
+ /**
593
+ *
594
+ * @type {CreateCompletionResponseLogprobs}
595
+ * @memberof CreateCompletionResponseChoices
596
+ */
597
+ 'logprobs'?: CreateCompletionResponseLogprobs | null;
598
+ /**
599
+ *
600
+ * @type {string}
601
+ * @memberof CreateCompletionResponseChoices
602
+ */
603
+ 'finish_reason'?: string;
604
+ }
605
+ /**
606
+ *
607
+ * @export
608
+ * @interface CreateCompletionResponseLogprobs
609
+ */
610
+ export interface CreateCompletionResponseLogprobs {
611
+ /**
612
+ *
613
+ * @type {Array<string>}
614
+ * @memberof CreateCompletionResponseLogprobs
615
+ */
616
+ 'tokens'?: Array<string>;
617
+ /**
618
+ *
619
+ * @type {Array<number>}
620
+ * @memberof CreateCompletionResponseLogprobs
621
+ */
622
+ 'token_logprobs'?: Array<number>;
623
+ /**
624
+ *
625
+ * @type {Array<object>}
626
+ * @memberof CreateCompletionResponseLogprobs
627
+ */
628
+ 'top_logprobs'?: Array<object>;
629
+ /**
630
+ *
631
+ * @type {Array<number>}
632
+ * @memberof CreateCompletionResponseLogprobs
633
+ */
634
+ 'text_offset'?: Array<number>;
635
+ }
636
+ /**
637
+ *
638
+ * @export
639
+ * @interface CreateEmbeddingRequest
640
+ */
641
+ export interface CreateEmbeddingRequest {
642
+ /**
643
+ * 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. We suggest replacing newlines (`\\n`) in your input with a single space, as we have observed inferior results when newlines are present.
644
+ * @type {string | Array<string> | Array<number> | Array<any>}
645
+ * @memberof CreateEmbeddingRequest
646
+ */
647
+ 'input'?: string | Array<string> | Array<number> | Array<any>;
648
+ }
649
+ /**
650
+ *
651
+ * @export
652
+ * @interface CreateEmbeddingResponse
653
+ */
654
+ export interface CreateEmbeddingResponse {
655
+ /**
656
+ *
657
+ * @type {string}
658
+ * @memberof CreateEmbeddingResponse
659
+ */
660
+ 'object'?: string;
661
+ /**
662
+ *
663
+ * @type {string}
664
+ * @memberof CreateEmbeddingResponse
665
+ */
666
+ 'model'?: string;
667
+ /**
668
+ *
669
+ * @type {Array<CreateEmbeddingResponseData>}
670
+ * @memberof CreateEmbeddingResponse
671
+ */
672
+ 'data'?: Array<CreateEmbeddingResponseData>;
673
+ }
674
+ /**
675
+ *
676
+ * @export
677
+ * @interface CreateEmbeddingResponseData
678
+ */
679
+ export interface CreateEmbeddingResponseData {
680
+ /**
681
+ *
682
+ * @type {number}
683
+ * @memberof CreateEmbeddingResponseData
684
+ */
685
+ 'index'?: number;
686
+ /**
687
+ *
688
+ * @type {string}
689
+ * @memberof CreateEmbeddingResponseData
690
+ */
691
+ 'object'?: string;
692
+ /**
693
+ *
694
+ * @type {Array<number>}
695
+ * @memberof CreateEmbeddingResponseData
696
+ */
697
+ 'embedding'?: Array<number>;
698
+ }
699
+ /**
700
+ *
701
+ * @export
702
+ * @interface CreateFineTuneRequest
703
+ */
704
+ export interface CreateFineTuneRequest {
705
+ /**
706
+ * 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.
707
+ * @type {string}
708
+ * @memberof CreateFineTuneRequest
709
+ */
710
+ 'training_file'?: string;
711
+ /**
712
+ * 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.
713
+ * @type {string}
714
+ * @memberof CreateFineTuneRequest
715
+ */
716
+ 'validation_file'?: string | null;
717
+ /**
718
+ * 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.
719
+ * @type {string}
720
+ * @memberof CreateFineTuneRequest
721
+ */
722
+ 'model'?: string | null;
723
+ /**
724
+ * The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
725
+ * @type {number}
726
+ * @memberof CreateFineTuneRequest
727
+ */
728
+ 'n_epochs'?: number | null;
729
+ /**
730
+ * 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.
731
+ * @type {number}
732
+ * @memberof CreateFineTuneRequest
733
+ */
734
+ 'batch_size'?: number | null;
735
+ /**
736
+ * 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.
737
+ * @type {number}
738
+ * @memberof CreateFineTuneRequest
739
+ */
740
+ 'learning_rate_multiplier'?: number | null;
741
+ /**
742
+ * 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.
743
+ * @type {number}
744
+ * @memberof CreateFineTuneRequest
745
+ */
746
+ 'prompt_loss_weight'?: number | null;
747
+ /**
748
+ * 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.
749
+ * @type {boolean}
750
+ * @memberof CreateFineTuneRequest
751
+ */
752
+ 'compute_classification_metrics'?: boolean | null;
753
+ /**
754
+ * The number of classes in a classification task. This parameter is required for multiclass classification.
755
+ * @type {number}
756
+ * @memberof CreateFineTuneRequest
757
+ */
758
+ 'classification_n_classes'?: number | null;
759
+ /**
760
+ * The positive class in binary classification. This parameter is needed to generate precision, recall, and F1 metrics when doing binary classification.
761
+ * @type {string}
762
+ * @memberof CreateFineTuneRequest
763
+ */
764
+ 'classification_positive_class'?: string | null;
765
+ /**
766
+ * 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.
767
+ * @type {Array<number>}
768
+ * @memberof CreateFineTuneRequest
769
+ */
770
+ 'classification_betas'?: Array<number> | null;
771
+ }
772
+ /**
773
+ *
774
+ * @export
775
+ * @interface CreateSearchRequest
776
+ */
777
+ export interface CreateSearchRequest {
778
+ /**
779
+ * 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.
780
+ * @type {Array<string>}
781
+ * @memberof CreateSearchRequest
782
+ */
783
+ 'documents'?: Array<string> | null;
784
+ /**
785
+ * The ID of an uploaded file that contains documents to search over. You should specify either `documents` or a `file`, but not both.
786
+ * @type {string}
787
+ * @memberof CreateSearchRequest
788
+ */
789
+ 'file'?: string | null;
790
+ /**
791
+ * Query to search against the documents.
792
+ * @type {string}
793
+ * @memberof CreateSearchRequest
794
+ */
795
+ 'query'?: string;
796
+ /**
797
+ * The maximum number of documents to be re-ranked and returned by search. This flag only takes effect when `file` is set.
798
+ * @type {number}
799
+ * @memberof CreateSearchRequest
800
+ */
801
+ 'max_rerank'?: number | null;
802
+ /**
803
+ * 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.
804
+ * @type {boolean}
805
+ * @memberof CreateSearchRequest
806
+ */
807
+ 'return_metadata'?: boolean | null;
808
+ }
809
+ /**
810
+ *
811
+ * @export
812
+ * @interface CreateSearchResponse
813
+ */
814
+ export interface CreateSearchResponse {
815
+ /**
816
+ *
817
+ * @type {string}
818
+ * @memberof CreateSearchResponse
819
+ */
820
+ 'object'?: string;
821
+ /**
822
+ *
823
+ * @type {string}
824
+ * @memberof CreateSearchResponse
825
+ */
826
+ 'model'?: string;
827
+ /**
828
+ *
829
+ * @type {Array<CreateSearchResponseData>}
830
+ * @memberof CreateSearchResponse
831
+ */
832
+ 'data'?: Array<CreateSearchResponseData>;
833
+ }
834
+ /**
835
+ *
836
+ * @export
837
+ * @interface CreateSearchResponseData
838
+ */
839
+ export interface CreateSearchResponseData {
840
+ /**
841
+ *
842
+ * @type {string}
843
+ * @memberof CreateSearchResponseData
844
+ */
845
+ 'object'?: string;
846
+ /**
847
+ *
848
+ * @type {number}
849
+ * @memberof CreateSearchResponseData
850
+ */
851
+ 'document'?: number;
852
+ /**
853
+ *
854
+ * @type {number}
855
+ * @memberof CreateSearchResponseData
856
+ */
857
+ 'score'?: number;
858
+ }
859
+ /**
860
+ *
861
+ * @export
862
+ * @interface DeleteFileResponse
863
+ */
864
+ export interface DeleteFileResponse {
865
+ /**
866
+ *
867
+ * @type {string}
868
+ * @memberof DeleteFileResponse
869
+ */
870
+ 'id'?: string;
871
+ /**
872
+ *
873
+ * @type {string}
874
+ * @memberof DeleteFileResponse
875
+ */
876
+ 'object'?: string;
877
+ /**
878
+ *
879
+ * @type {boolean}
880
+ * @memberof DeleteFileResponse
881
+ */
882
+ 'deleted'?: boolean;
883
+ }
884
+ /**
885
+ *
886
+ * @export
887
+ * @interface Engine
888
+ */
889
+ export interface Engine {
890
+ /**
891
+ *
892
+ * @type {string}
893
+ * @memberof Engine
894
+ */
895
+ 'id'?: string;
896
+ /**
897
+ *
898
+ * @type {string}
899
+ * @memberof Engine
900
+ */
901
+ 'object'?: string;
902
+ /**
903
+ *
904
+ * @type {number}
905
+ * @memberof Engine
906
+ */
907
+ 'created'?: number;
908
+ /**
909
+ *
910
+ * @type {boolean}
911
+ * @memberof Engine
912
+ */
913
+ 'ready'?: boolean;
914
+ }
915
+ /**
916
+ *
917
+ * @export
918
+ * @interface FineTune
919
+ */
920
+ export interface FineTune {
921
+ /**
922
+ *
923
+ * @type {string}
924
+ * @memberof FineTune
925
+ */
926
+ 'id'?: string;
927
+ /**
928
+ *
929
+ * @type {string}
930
+ * @memberof FineTune
931
+ */
932
+ 'object'?: string;
933
+ /**
934
+ *
935
+ * @type {number}
936
+ * @memberof FineTune
937
+ */
938
+ 'created_at'?: number;
939
+ /**
940
+ *
941
+ * @type {number}
942
+ * @memberof FineTune
943
+ */
944
+ 'updated_at'?: number;
945
+ /**
946
+ *
947
+ * @type {string}
948
+ * @memberof FineTune
949
+ */
950
+ 'model'?: string;
951
+ /**
952
+ *
953
+ * @type {string}
954
+ * @memberof FineTune
955
+ */
956
+ 'fine_tuned_model'?: string | null;
957
+ /**
958
+ *
959
+ * @type {string}
960
+ * @memberof FineTune
961
+ */
962
+ 'organization_id'?: string;
963
+ /**
964
+ *
965
+ * @type {string}
966
+ * @memberof FineTune
967
+ */
968
+ 'status'?: string;
969
+ /**
970
+ *
971
+ * @type {object}
972
+ * @memberof FineTune
973
+ */
974
+ 'hyperparams'?: object;
975
+ /**
976
+ *
977
+ * @type {Array<OpenAIFile>}
978
+ * @memberof FineTune
979
+ */
980
+ 'training_files'?: Array<OpenAIFile>;
981
+ /**
982
+ *
983
+ * @type {Array<OpenAIFile>}
984
+ * @memberof FineTune
985
+ */
986
+ 'validation_files'?: Array<OpenAIFile>;
987
+ /**
988
+ *
989
+ * @type {Array<OpenAIFile>}
990
+ * @memberof FineTune
991
+ */
992
+ 'result_files'?: Array<OpenAIFile>;
993
+ /**
994
+ *
995
+ * @type {Array<FineTuneEvent>}
996
+ * @memberof FineTune
997
+ */
998
+ 'events'?: Array<FineTuneEvent>;
999
+ }
1000
+ /**
1001
+ *
1002
+ * @export
1003
+ * @interface FineTuneEvent
1004
+ */
1005
+ export interface FineTuneEvent {
1006
+ /**
1007
+ *
1008
+ * @type {string}
1009
+ * @memberof FineTuneEvent
1010
+ */
1011
+ 'object'?: string;
1012
+ /**
1013
+ *
1014
+ * @type {number}
1015
+ * @memberof FineTuneEvent
1016
+ */
1017
+ 'created_at'?: number;
1018
+ /**
1019
+ *
1020
+ * @type {string}
1021
+ * @memberof FineTuneEvent
1022
+ */
1023
+ 'level'?: string;
1024
+ /**
1025
+ *
1026
+ * @type {string}
1027
+ * @memberof FineTuneEvent
1028
+ */
1029
+ 'message'?: string;
1030
+ }
1031
+ /**
1032
+ *
1033
+ * @export
1034
+ * @interface ListEnginesResponse
1035
+ */
1036
+ export interface ListEnginesResponse {
1037
+ /**
1038
+ *
1039
+ * @type {string}
1040
+ * @memberof ListEnginesResponse
1041
+ */
1042
+ 'object'?: string;
1043
+ /**
1044
+ *
1045
+ * @type {Array<Engine>}
1046
+ * @memberof ListEnginesResponse
1047
+ */
1048
+ 'data'?: Array<Engine>;
1049
+ }
1050
+ /**
1051
+ *
1052
+ * @export
1053
+ * @interface ListFilesResponse
1054
+ */
1055
+ export interface ListFilesResponse {
1056
+ /**
1057
+ *
1058
+ * @type {string}
1059
+ * @memberof ListFilesResponse
1060
+ */
1061
+ 'object'?: string;
1062
+ /**
1063
+ *
1064
+ * @type {Array<OpenAIFile>}
1065
+ * @memberof ListFilesResponse
1066
+ */
1067
+ 'data'?: Array<OpenAIFile>;
1068
+ }
1069
+ /**
1070
+ *
1071
+ * @export
1072
+ * @interface ListFineTuneEventsResponse
1073
+ */
1074
+ export interface ListFineTuneEventsResponse {
1075
+ /**
1076
+ *
1077
+ * @type {string}
1078
+ * @memberof ListFineTuneEventsResponse
1079
+ */
1080
+ 'object'?: string;
1081
+ /**
1082
+ *
1083
+ * @type {Array<FineTuneEvent>}
1084
+ * @memberof ListFineTuneEventsResponse
1085
+ */
1086
+ 'data'?: Array<FineTuneEvent>;
1087
+ }
1088
+ /**
1089
+ *
1090
+ * @export
1091
+ * @interface ListFineTunesResponse
1092
+ */
1093
+ export interface ListFineTunesResponse {
1094
+ /**
1095
+ *
1096
+ * @type {string}
1097
+ * @memberof ListFineTunesResponse
1098
+ */
1099
+ 'object'?: string;
1100
+ /**
1101
+ *
1102
+ * @type {Array<FineTune>}
1103
+ * @memberof ListFineTunesResponse
1104
+ */
1105
+ 'data'?: Array<FineTune>;
1106
+ }
1107
+ /**
1108
+ *
1109
+ * @export
1110
+ * @interface OpenAIFile
1111
+ */
1112
+ export interface OpenAIFile {
1113
+ /**
1114
+ *
1115
+ * @type {string}
1116
+ * @memberof OpenAIFile
1117
+ */
1118
+ 'id'?: string;
1119
+ /**
1120
+ *
1121
+ * @type {string}
1122
+ * @memberof OpenAIFile
1123
+ */
1124
+ 'object'?: string;
1125
+ /**
1126
+ *
1127
+ * @type {number}
1128
+ * @memberof OpenAIFile
1129
+ */
1130
+ 'bytes'?: number;
1131
+ /**
1132
+ *
1133
+ * @type {number}
1134
+ * @memberof OpenAIFile
1135
+ */
1136
+ 'created_at'?: number;
1137
+ /**
1138
+ *
1139
+ * @type {string}
1140
+ * @memberof OpenAIFile
1141
+ */
1142
+ 'filename'?: string;
1143
+ /**
1144
+ *
1145
+ * @type {string}
1146
+ * @memberof OpenAIFile
1147
+ */
1148
+ 'purpose'?: string;
1149
+ /**
1150
+ *
1151
+ * @type {string}
1152
+ * @memberof OpenAIFile
1153
+ */
1154
+ 'status'?: string;
1155
+ /**
1156
+ *
1157
+ * @type {object}
1158
+ * @memberof OpenAIFile
1159
+ */
1160
+ 'status_details'?: object | null;
1161
+ }
1162
+
1163
+ /**
1164
+ * OpenAIApi - axios parameter creator
1165
+ * @export
1166
+ */
1167
+ export const OpenAIApiAxiosParamCreator = function (configuration?: Configuration) {
1168
+ return {
1169
+ /**
1170
+ *
1171
+ * @summary Immediately cancel a fine-tune job.
1172
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
1173
+ * @param {*} [options] Override http request option.
1174
+ * @throws {RequiredError}
1175
+ */
1176
+ cancelFineTune: async (fineTuneId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1177
+ // verify required parameter 'fineTuneId' is not null or undefined
1178
+ assertParamExists('cancelFineTune', 'fineTuneId', fineTuneId)
1179
+ const localVarPath = `/fine-tunes/{fine_tune_id}/cancel`
1180
+ .replace(`{${"fine_tune_id"}}`, encodeURIComponent(String(fineTuneId)));
1181
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1182
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1183
+ let baseOptions;
1184
+ if (configuration) {
1185
+ baseOptions = configuration.baseOptions;
1186
+ }
1187
+
1188
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1189
+ const localVarHeaderParameter = {} as any;
1190
+ const localVarQueryParameter = {} as any;
1191
+
1192
+
1193
+
1194
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1195
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1196
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1197
+
1198
+ return {
1199
+ url: toPathString(localVarUrlObj),
1200
+ options: localVarRequestOptions,
1201
+ };
1202
+ },
1203
+ /**
1204
+ *
1205
+ * @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).
1206
+ * @param {CreateAnswerRequest} createAnswerRequest
1207
+ * @param {*} [options] Override http request option.
1208
+ * @throws {RequiredError}
1209
+ */
1210
+ createAnswer: async (createAnswerRequest: CreateAnswerRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1211
+ // verify required parameter 'createAnswerRequest' is not null or undefined
1212
+ assertParamExists('createAnswer', 'createAnswerRequest', createAnswerRequest)
1213
+ const localVarPath = `/answers`;
1214
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1215
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1216
+ let baseOptions;
1217
+ if (configuration) {
1218
+ baseOptions = configuration.baseOptions;
1219
+ }
1220
+
1221
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1222
+ const localVarHeaderParameter = {} as any;
1223
+ const localVarQueryParameter = {} as any;
1224
+
1225
+
1226
+
1227
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1228
+
1229
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1230
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1231
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1232
+ localVarRequestOptions.data = serializeDataIfNeeded(createAnswerRequest, localVarRequestOptions, configuration)
1233
+
1234
+ return {
1235
+ url: toPathString(localVarUrlObj),
1236
+ options: localVarRequestOptions,
1237
+ };
1238
+ },
1239
+ /**
1240
+ *
1241
+ * @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.
1242
+ * @param {CreateClassificationRequest} createClassificationRequest
1243
+ * @param {*} [options] Override http request option.
1244
+ * @throws {RequiredError}
1245
+ */
1246
+ createClassification: async (createClassificationRequest: CreateClassificationRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1247
+ // verify required parameter 'createClassificationRequest' is not null or undefined
1248
+ assertParamExists('createClassification', 'createClassificationRequest', createClassificationRequest)
1249
+ const localVarPath = `/classifications`;
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(createClassificationRequest, localVarRequestOptions, configuration)
1269
+
1270
+ return {
1271
+ url: toPathString(localVarUrlObj),
1272
+ options: localVarRequestOptions,
1273
+ };
1274
+ },
1275
+ /**
1276
+ *
1277
+ * @summary Creates a new completion for the provided prompt and parameters
1278
+ * @param {string} engineId The ID of the engine to use for this request
1279
+ * @param {CreateCompletionRequest} createCompletionRequest
1280
+ * @param {*} [options] Override http request option.
1281
+ * @throws {RequiredError}
1282
+ */
1283
+ createCompletion: async (engineId: string, createCompletionRequest: CreateCompletionRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1284
+ // verify required parameter 'engineId' is not null or undefined
1285
+ assertParamExists('createCompletion', 'engineId', engineId)
1286
+ // verify required parameter 'createCompletionRequest' is not null or undefined
1287
+ assertParamExists('createCompletion', 'createCompletionRequest', createCompletionRequest)
1288
+ const localVarPath = `/engines/{engine_id}/completions`
1289
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
1290
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1291
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1292
+ let baseOptions;
1293
+ if (configuration) {
1294
+ baseOptions = configuration.baseOptions;
1295
+ }
1296
+
1297
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1298
+ const localVarHeaderParameter = {} as any;
1299
+ const localVarQueryParameter = {} as any;
1300
+
1301
+
1302
+
1303
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1304
+
1305
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1306
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1307
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1308
+ localVarRequestOptions.data = serializeDataIfNeeded(createCompletionRequest, localVarRequestOptions, configuration)
1309
+
1310
+ return {
1311
+ url: toPathString(localVarUrlObj),
1312
+ options: localVarRequestOptions,
1313
+ };
1314
+ },
1315
+ /**
1316
+ *
1317
+ * @summary Creates a completion using a fine-tuned model
1318
+ * @param {CreateCompletionFromModelRequest} createCompletionFromModelRequest
1319
+ * @param {*} [options] Override http request option.
1320
+ * @throws {RequiredError}
1321
+ */
1322
+ createCompletionFromModel: async (createCompletionFromModelRequest: CreateCompletionFromModelRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1323
+ // verify required parameter 'createCompletionFromModelRequest' is not null or undefined
1324
+ assertParamExists('createCompletionFromModel', 'createCompletionFromModelRequest', createCompletionFromModelRequest)
1325
+ const localVarPath = `/completions`;
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(createCompletionFromModelRequest, localVarRequestOptions, configuration)
1345
+
1346
+ return {
1347
+ url: toPathString(localVarUrlObj),
1348
+ options: localVarRequestOptions,
1349
+ };
1350
+ },
1351
+ /**
1352
+ *
1353
+ * @summary Creates an embedding vector representing the input text.
1354
+ * @param {string} engineId The ID of the engine to use for this request
1355
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
1356
+ * @param {*} [options] Override http request option.
1357
+ * @throws {RequiredError}
1358
+ */
1359
+ createEmbedding: async (engineId: string, createEmbeddingRequest: CreateEmbeddingRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1360
+ // verify required parameter 'engineId' is not null or undefined
1361
+ assertParamExists('createEmbedding', 'engineId', engineId)
1362
+ // verify required parameter 'createEmbeddingRequest' is not null or undefined
1363
+ assertParamExists('createEmbedding', 'createEmbeddingRequest', createEmbeddingRequest)
1364
+ const localVarPath = `/engines/{engine_id}/embeddings`
1365
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
1366
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1367
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1368
+ let baseOptions;
1369
+ if (configuration) {
1370
+ baseOptions = configuration.baseOptions;
1371
+ }
1372
+
1373
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1374
+ const localVarHeaderParameter = {} as any;
1375
+ const localVarQueryParameter = {} as any;
1376
+
1377
+
1378
+
1379
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1380
+
1381
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1382
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1383
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1384
+ localVarRequestOptions.data = serializeDataIfNeeded(createEmbeddingRequest, localVarRequestOptions, configuration)
1385
+
1386
+ return {
1387
+ url: toPathString(localVarUrlObj),
1388
+ options: localVarRequestOptions,
1389
+ };
1390
+ },
1391
+ /**
1392
+ *
1393
+ * @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.
1394
+ * @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).
1395
+ * @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.
1396
+ * @param {*} [options] Override http request option.
1397
+ * @throws {RequiredError}
1398
+ */
1399
+ createFile: async (file: any, purpose: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1400
+ // verify required parameter 'file' is not null or undefined
1401
+ assertParamExists('createFile', 'file', file)
1402
+ // verify required parameter 'purpose' is not null or undefined
1403
+ assertParamExists('createFile', 'purpose', purpose)
1404
+ const localVarPath = `/files`;
1405
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1406
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1407
+ let baseOptions;
1408
+ if (configuration) {
1409
+ baseOptions = configuration.baseOptions;
1410
+ }
1411
+
1412
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1413
+ const localVarHeaderParameter = {} as any;
1414
+ const localVarQueryParameter = {} as any;
1415
+ const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
1416
+
1417
+
1418
+ if (file !== undefined) {
1419
+ localVarFormParams.append('file', file as any);
1420
+ }
1421
+
1422
+ if (purpose !== undefined) {
1423
+ localVarFormParams.append('purpose', purpose as any);
1424
+ }
1425
+
1426
+
1427
+ localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
1428
+
1429
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1430
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1431
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...localVarFormParams.getHeaders(), ...headersFromBaseOptions, ...options.headers};
1432
+ localVarRequestOptions.data = localVarFormParams;
1433
+
1434
+ return {
1435
+ url: toPathString(localVarUrlObj),
1436
+ options: localVarRequestOptions,
1437
+ };
1438
+ },
1439
+ /**
1440
+ *
1441
+ * @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)
1442
+ * @param {CreateFineTuneRequest} createFineTuneRequest
1443
+ * @param {*} [options] Override http request option.
1444
+ * @throws {RequiredError}
1445
+ */
1446
+ createFineTune: async (createFineTuneRequest: CreateFineTuneRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1447
+ // verify required parameter 'createFineTuneRequest' is not null or undefined
1448
+ assertParamExists('createFineTune', 'createFineTuneRequest', createFineTuneRequest)
1449
+ const localVarPath = `/fine-tunes`;
1450
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1451
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1452
+ let baseOptions;
1453
+ if (configuration) {
1454
+ baseOptions = configuration.baseOptions;
1455
+ }
1456
+
1457
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1458
+ const localVarHeaderParameter = {} as any;
1459
+ const localVarQueryParameter = {} as any;
1460
+
1461
+
1462
+
1463
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1464
+
1465
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1466
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1467
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1468
+ localVarRequestOptions.data = serializeDataIfNeeded(createFineTuneRequest, localVarRequestOptions, configuration)
1469
+
1470
+ return {
1471
+ url: toPathString(localVarUrlObj),
1472
+ options: localVarRequestOptions,
1473
+ };
1474
+ },
1475
+ /**
1476
+ *
1477
+ * @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.
1478
+ * @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;.
1479
+ * @param {CreateSearchRequest} createSearchRequest
1480
+ * @param {*} [options] Override http request option.
1481
+ * @throws {RequiredError}
1482
+ */
1483
+ createSearch: async (engineId: string, createSearchRequest: CreateSearchRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1484
+ // verify required parameter 'engineId' is not null or undefined
1485
+ assertParamExists('createSearch', 'engineId', engineId)
1486
+ // verify required parameter 'createSearchRequest' is not null or undefined
1487
+ assertParamExists('createSearch', 'createSearchRequest', createSearchRequest)
1488
+ const localVarPath = `/engines/{engine_id}/search`
1489
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
1490
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1491
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1492
+ let baseOptions;
1493
+ if (configuration) {
1494
+ baseOptions = configuration.baseOptions;
1495
+ }
1496
+
1497
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1498
+ const localVarHeaderParameter = {} as any;
1499
+ const localVarQueryParameter = {} as any;
1500
+
1501
+
1502
+
1503
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1504
+
1505
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1506
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1507
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1508
+ localVarRequestOptions.data = serializeDataIfNeeded(createSearchRequest, localVarRequestOptions, configuration)
1509
+
1510
+ return {
1511
+ url: toPathString(localVarUrlObj),
1512
+ options: localVarRequestOptions,
1513
+ };
1514
+ },
1515
+ /**
1516
+ *
1517
+ * @summary Delete a file.
1518
+ * @param {string} fileId The ID of the file to use for this request
1519
+ * @param {*} [options] Override http request option.
1520
+ * @throws {RequiredError}
1521
+ */
1522
+ deleteFile: async (fileId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1523
+ // verify required parameter 'fileId' is not null or undefined
1524
+ assertParamExists('deleteFile', 'fileId', fileId)
1525
+ const localVarPath = `/files/{file_id}`
1526
+ .replace(`{${"file_id"}}`, encodeURIComponent(String(fileId)));
1527
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1528
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1529
+ let baseOptions;
1530
+ if (configuration) {
1531
+ baseOptions = configuration.baseOptions;
1532
+ }
1533
+
1534
+ const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
1535
+ const localVarHeaderParameter = {} as any;
1536
+ const localVarQueryParameter = {} as any;
1537
+
1538
+
1539
+
1540
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1541
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1542
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1543
+
1544
+ return {
1545
+ url: toPathString(localVarUrlObj),
1546
+ options: localVarRequestOptions,
1547
+ };
1548
+ },
1549
+ /**
1550
+ *
1551
+ * @summary Returns the contents of the specified file
1552
+ * @param {string} fileId The ID of the file to use for this request
1553
+ * @param {*} [options] Override http request option.
1554
+ * @throws {RequiredError}
1555
+ */
1556
+ downloadFile: async (fileId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1557
+ // verify required parameter 'fileId' is not null or undefined
1558
+ assertParamExists('downloadFile', 'fileId', fileId)
1559
+ const localVarPath = `/files/{file_id}/content`
1560
+ .replace(`{${"file_id"}}`, encodeURIComponent(String(fileId)));
1561
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1562
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1563
+ let baseOptions;
1564
+ if (configuration) {
1565
+ baseOptions = configuration.baseOptions;
1566
+ }
1567
+
1568
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1569
+ const localVarHeaderParameter = {} as any;
1570
+ const localVarQueryParameter = {} as any;
1571
+
1572
+
1573
+
1574
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1575
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1576
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1577
+
1578
+ return {
1579
+ url: toPathString(localVarUrlObj),
1580
+ options: localVarRequestOptions,
1581
+ };
1582
+ },
1583
+ /**
1584
+ *
1585
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
1586
+ * @param {*} [options] Override http request option.
1587
+ * @throws {RequiredError}
1588
+ */
1589
+ listEngines: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1590
+ const localVarPath = `/engines`;
1591
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1592
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1593
+ let baseOptions;
1594
+ if (configuration) {
1595
+ baseOptions = configuration.baseOptions;
1596
+ }
1597
+
1598
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1599
+ const localVarHeaderParameter = {} as any;
1600
+ const localVarQueryParameter = {} as any;
1601
+
1602
+
1603
+
1604
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1605
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1606
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1607
+
1608
+ return {
1609
+ url: toPathString(localVarUrlObj),
1610
+ options: localVarRequestOptions,
1611
+ };
1612
+ },
1613
+ /**
1614
+ *
1615
+ * @summary Returns a list of files that belong to the user\'s organization.
1616
+ * @param {*} [options] Override http request option.
1617
+ * @throws {RequiredError}
1618
+ */
1619
+ listFiles: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1620
+ const localVarPath = `/files`;
1621
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1622
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1623
+ let baseOptions;
1624
+ if (configuration) {
1625
+ baseOptions = configuration.baseOptions;
1626
+ }
1627
+
1628
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1629
+ const localVarHeaderParameter = {} as any;
1630
+ const localVarQueryParameter = {} as any;
1631
+
1632
+
1633
+
1634
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1635
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1636
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1637
+
1638
+ return {
1639
+ url: toPathString(localVarUrlObj),
1640
+ options: localVarRequestOptions,
1641
+ };
1642
+ },
1643
+ /**
1644
+ *
1645
+ * @summary Get fine-grained status updates for a fine-tune job.
1646
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
1647
+ * @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.
1648
+ * @param {*} [options] Override http request option.
1649
+ * @throws {RequiredError}
1650
+ */
1651
+ listFineTuneEvents: async (fineTuneId: string, stream?: boolean, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1652
+ // verify required parameter 'fineTuneId' is not null or undefined
1653
+ assertParamExists('listFineTuneEvents', 'fineTuneId', fineTuneId)
1654
+ const localVarPath = `/fine-tunes/{fine_tune_id}/events`
1655
+ .replace(`{${"fine_tune_id"}}`, encodeURIComponent(String(fineTuneId)));
1656
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1657
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1658
+ let baseOptions;
1659
+ if (configuration) {
1660
+ baseOptions = configuration.baseOptions;
1661
+ }
1662
+
1663
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1664
+ const localVarHeaderParameter = {} as any;
1665
+ const localVarQueryParameter = {} as any;
1666
+
1667
+ if (stream !== undefined) {
1668
+ localVarQueryParameter['stream'] = stream;
1669
+ }
1670
+
1671
+
1672
+
1673
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1674
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1675
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1676
+
1677
+ return {
1678
+ url: toPathString(localVarUrlObj),
1679
+ options: localVarRequestOptions,
1680
+ };
1681
+ },
1682
+ /**
1683
+ *
1684
+ * @summary List your organization\'s fine-tuning jobs
1685
+ * @param {*} [options] Override http request option.
1686
+ * @throws {RequiredError}
1687
+ */
1688
+ listFineTunes: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1689
+ const localVarPath = `/fine-tunes`;
1690
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1691
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1692
+ let baseOptions;
1693
+ if (configuration) {
1694
+ baseOptions = configuration.baseOptions;
1695
+ }
1696
+
1697
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1698
+ const localVarHeaderParameter = {} as any;
1699
+ const localVarQueryParameter = {} as any;
1700
+
1701
+
1702
+
1703
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1704
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1705
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1706
+
1707
+ return {
1708
+ url: toPathString(localVarUrlObj),
1709
+ options: localVarRequestOptions,
1710
+ };
1711
+ },
1712
+ /**
1713
+ *
1714
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
1715
+ * @param {string} engineId The ID of the engine to use for this request
1716
+ * @param {*} [options] Override http request option.
1717
+ * @throws {RequiredError}
1718
+ */
1719
+ retrieveEngine: async (engineId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1720
+ // verify required parameter 'engineId' is not null or undefined
1721
+ assertParamExists('retrieveEngine', 'engineId', engineId)
1722
+ const localVarPath = `/engines/{engine_id}`
1723
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
1724
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1725
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1726
+ let baseOptions;
1727
+ if (configuration) {
1728
+ baseOptions = configuration.baseOptions;
1729
+ }
1730
+
1731
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1732
+ const localVarHeaderParameter = {} as any;
1733
+ const localVarQueryParameter = {} as any;
1734
+
1735
+
1736
+
1737
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1738
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1739
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1740
+
1741
+ return {
1742
+ url: toPathString(localVarUrlObj),
1743
+ options: localVarRequestOptions,
1744
+ };
1745
+ },
1746
+ /**
1747
+ *
1748
+ * @summary Returns information about a specific file.
1749
+ * @param {string} fileId The ID of the file to use for this request
1750
+ * @param {*} [options] Override http request option.
1751
+ * @throws {RequiredError}
1752
+ */
1753
+ retrieveFile: async (fileId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1754
+ // verify required parameter 'fileId' is not null or undefined
1755
+ assertParamExists('retrieveFile', 'fileId', fileId)
1756
+ const localVarPath = `/files/{file_id}`
1757
+ .replace(`{${"file_id"}}`, encodeURIComponent(String(fileId)));
1758
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1759
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1760
+ let baseOptions;
1761
+ if (configuration) {
1762
+ baseOptions = configuration.baseOptions;
1763
+ }
1764
+
1765
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1766
+ const localVarHeaderParameter = {} as any;
1767
+ const localVarQueryParameter = {} as any;
1768
+
1769
+
1770
+
1771
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1772
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1773
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1774
+
1775
+ return {
1776
+ url: toPathString(localVarUrlObj),
1777
+ options: localVarRequestOptions,
1778
+ };
1779
+ },
1780
+ /**
1781
+ *
1782
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
1783
+ * @param {string} fineTuneId The ID of the fine-tune job
1784
+ * @param {*} [options] Override http request option.
1785
+ * @throws {RequiredError}
1786
+ */
1787
+ retrieveFineTune: async (fineTuneId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1788
+ // verify required parameter 'fineTuneId' is not null or undefined
1789
+ assertParamExists('retrieveFineTune', 'fineTuneId', fineTuneId)
1790
+ const localVarPath = `/fine-tunes/{fine_tune_id}`
1791
+ .replace(`{${"fine_tune_id"}}`, encodeURIComponent(String(fineTuneId)));
1792
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1793
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1794
+ let baseOptions;
1795
+ if (configuration) {
1796
+ baseOptions = configuration.baseOptions;
1797
+ }
1798
+
1799
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1800
+ const localVarHeaderParameter = {} as any;
1801
+ const localVarQueryParameter = {} as any;
1802
+
1803
+
1804
+
1805
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1806
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1807
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1808
+
1809
+ return {
1810
+ url: toPathString(localVarUrlObj),
1811
+ options: localVarRequestOptions,
1812
+ };
1813
+ },
1814
+ }
1815
+ };
1816
+
1817
+ /**
1818
+ * OpenAIApi - functional programming interface
1819
+ * @export
1820
+ */
1821
+ export const OpenAIApiFp = function(configuration?: Configuration) {
1822
+ const localVarAxiosParamCreator = OpenAIApiAxiosParamCreator(configuration)
1823
+ return {
1824
+ /**
1825
+ *
1826
+ * @summary Immediately cancel a fine-tune job.
1827
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
1828
+ * @param {*} [options] Override http request option.
1829
+ * @throws {RequiredError}
1830
+ */
1831
+ async cancelFineTune(fineTuneId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FineTune>> {
1832
+ const localVarAxiosArgs = await localVarAxiosParamCreator.cancelFineTune(fineTuneId, options);
1833
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1834
+ },
1835
+ /**
1836
+ *
1837
+ * @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).
1838
+ * @param {CreateAnswerRequest} createAnswerRequest
1839
+ * @param {*} [options] Override http request option.
1840
+ * @throws {RequiredError}
1841
+ */
1842
+ async createAnswer(createAnswerRequest: CreateAnswerRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateAnswerResponse>> {
1843
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createAnswer(createAnswerRequest, options);
1844
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1845
+ },
1846
+ /**
1847
+ *
1848
+ * @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.
1849
+ * @param {CreateClassificationRequest} createClassificationRequest
1850
+ * @param {*} [options] Override http request option.
1851
+ * @throws {RequiredError}
1852
+ */
1853
+ async createClassification(createClassificationRequest: CreateClassificationRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateClassificationResponse>> {
1854
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createClassification(createClassificationRequest, options);
1855
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1856
+ },
1857
+ /**
1858
+ *
1859
+ * @summary Creates a new completion for the provided prompt and parameters
1860
+ * @param {string} engineId The ID of the engine to use for this request
1861
+ * @param {CreateCompletionRequest} createCompletionRequest
1862
+ * @param {*} [options] Override http request option.
1863
+ * @throws {RequiredError}
1864
+ */
1865
+ async createCompletion(engineId: string, createCompletionRequest: CreateCompletionRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateCompletionResponse>> {
1866
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createCompletion(engineId, createCompletionRequest, options);
1867
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1868
+ },
1869
+ /**
1870
+ *
1871
+ * @summary Creates a completion using a fine-tuned model
1872
+ * @param {CreateCompletionFromModelRequest} createCompletionFromModelRequest
1873
+ * @param {*} [options] Override http request option.
1874
+ * @throws {RequiredError}
1875
+ */
1876
+ async createCompletionFromModel(createCompletionFromModelRequest: CreateCompletionFromModelRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateCompletionResponse>> {
1877
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createCompletionFromModel(createCompletionFromModelRequest, options);
1878
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1879
+ },
1880
+ /**
1881
+ *
1882
+ * @summary Creates an embedding vector representing the input text.
1883
+ * @param {string} engineId The ID of the engine to use for this request
1884
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
1885
+ * @param {*} [options] Override http request option.
1886
+ * @throws {RequiredError}
1887
+ */
1888
+ async createEmbedding(engineId: string, createEmbeddingRequest: CreateEmbeddingRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateEmbeddingResponse>> {
1889
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createEmbedding(engineId, createEmbeddingRequest, options);
1890
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1891
+ },
1892
+ /**
1893
+ *
1894
+ * @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.
1895
+ * @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).
1896
+ * @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.
1897
+ * @param {*} [options] Override http request option.
1898
+ * @throws {RequiredError}
1899
+ */
1900
+ async createFile(file: any, purpose: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<OpenAIFile>> {
1901
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createFile(file, purpose, options);
1902
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1903
+ },
1904
+ /**
1905
+ *
1906
+ * @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)
1907
+ * @param {CreateFineTuneRequest} createFineTuneRequest
1908
+ * @param {*} [options] Override http request option.
1909
+ * @throws {RequiredError}
1910
+ */
1911
+ async createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FineTune>> {
1912
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createFineTune(createFineTuneRequest, options);
1913
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1914
+ },
1915
+ /**
1916
+ *
1917
+ * @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.
1918
+ * @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;.
1919
+ * @param {CreateSearchRequest} createSearchRequest
1920
+ * @param {*} [options] Override http request option.
1921
+ * @throws {RequiredError}
1922
+ */
1923
+ async createSearch(engineId: string, createSearchRequest: CreateSearchRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateSearchResponse>> {
1924
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createSearch(engineId, createSearchRequest, options);
1925
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1926
+ },
1927
+ /**
1928
+ *
1929
+ * @summary Delete a file.
1930
+ * @param {string} fileId The ID of the file to use for this request
1931
+ * @param {*} [options] Override http request option.
1932
+ * @throws {RequiredError}
1933
+ */
1934
+ async deleteFile(fileId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<DeleteFileResponse>> {
1935
+ const localVarAxiosArgs = await localVarAxiosParamCreator.deleteFile(fileId, options);
1936
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1937
+ },
1938
+ /**
1939
+ *
1940
+ * @summary Returns the contents of the specified file
1941
+ * @param {string} fileId The ID of the file to use for this request
1942
+ * @param {*} [options] Override http request option.
1943
+ * @throws {RequiredError}
1944
+ */
1945
+ async downloadFile(fileId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> {
1946
+ const localVarAxiosArgs = await localVarAxiosParamCreator.downloadFile(fileId, options);
1947
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1948
+ },
1949
+ /**
1950
+ *
1951
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
1952
+ * @param {*} [options] Override http request option.
1953
+ * @throws {RequiredError}
1954
+ */
1955
+ async listEngines(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListEnginesResponse>> {
1956
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listEngines(options);
1957
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1958
+ },
1959
+ /**
1960
+ *
1961
+ * @summary Returns a list of files that belong to the user\'s organization.
1962
+ * @param {*} [options] Override http request option.
1963
+ * @throws {RequiredError}
1964
+ */
1965
+ async listFiles(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListFilesResponse>> {
1966
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listFiles(options);
1967
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1968
+ },
1969
+ /**
1970
+ *
1971
+ * @summary Get fine-grained status updates for a fine-tune job.
1972
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
1973
+ * @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.
1974
+ * @param {*} [options] Override http request option.
1975
+ * @throws {RequiredError}
1976
+ */
1977
+ async listFineTuneEvents(fineTuneId: string, stream?: boolean, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListFineTuneEventsResponse>> {
1978
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listFineTuneEvents(fineTuneId, stream, options);
1979
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1980
+ },
1981
+ /**
1982
+ *
1983
+ * @summary List your organization\'s fine-tuning jobs
1984
+ * @param {*} [options] Override http request option.
1985
+ * @throws {RequiredError}
1986
+ */
1987
+ async listFineTunes(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListFineTunesResponse>> {
1988
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listFineTunes(options);
1989
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1990
+ },
1991
+ /**
1992
+ *
1993
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
1994
+ * @param {string} engineId The ID of the engine to use for this request
1995
+ * @param {*} [options] Override http request option.
1996
+ * @throws {RequiredError}
1997
+ */
1998
+ async retrieveEngine(engineId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Engine>> {
1999
+ const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveEngine(engineId, options);
2000
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2001
+ },
2002
+ /**
2003
+ *
2004
+ * @summary Returns information about a specific file.
2005
+ * @param {string} fileId The ID of the file to use for this request
2006
+ * @param {*} [options] Override http request option.
2007
+ * @throws {RequiredError}
2008
+ */
2009
+ async retrieveFile(fileId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<OpenAIFile>> {
2010
+ const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveFile(fileId, options);
2011
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2012
+ },
2013
+ /**
2014
+ *
2015
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
2016
+ * @param {string} fineTuneId The ID of the fine-tune job
2017
+ * @param {*} [options] Override http request option.
2018
+ * @throws {RequiredError}
2019
+ */
2020
+ async retrieveFineTune(fineTuneId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FineTune>> {
2021
+ const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveFineTune(fineTuneId, options);
2022
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2023
+ },
2024
+ }
2025
+ };
2026
+
2027
+ /**
2028
+ * OpenAIApi - factory interface
2029
+ * @export
2030
+ */
2031
+ export const OpenAIApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
2032
+ const localVarFp = OpenAIApiFp(configuration)
2033
+ return {
2034
+ /**
2035
+ *
2036
+ * @summary Immediately cancel a fine-tune job.
2037
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
2038
+ * @param {*} [options] Override http request option.
2039
+ * @throws {RequiredError}
2040
+ */
2041
+ cancelFineTune(fineTuneId: string, options?: any): AxiosPromise<FineTune> {
2042
+ return localVarFp.cancelFineTune(fineTuneId, options).then((request) => request(axios, basePath));
2043
+ },
2044
+ /**
2045
+ *
2046
+ * @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).
2047
+ * @param {CreateAnswerRequest} createAnswerRequest
2048
+ * @param {*} [options] Override http request option.
2049
+ * @throws {RequiredError}
2050
+ */
2051
+ createAnswer(createAnswerRequest: CreateAnswerRequest, options?: any): AxiosPromise<CreateAnswerResponse> {
2052
+ return localVarFp.createAnswer(createAnswerRequest, options).then((request) => request(axios, basePath));
2053
+ },
2054
+ /**
2055
+ *
2056
+ * @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.
2057
+ * @param {CreateClassificationRequest} createClassificationRequest
2058
+ * @param {*} [options] Override http request option.
2059
+ * @throws {RequiredError}
2060
+ */
2061
+ createClassification(createClassificationRequest: CreateClassificationRequest, options?: any): AxiosPromise<CreateClassificationResponse> {
2062
+ return localVarFp.createClassification(createClassificationRequest, options).then((request) => request(axios, basePath));
2063
+ },
2064
+ /**
2065
+ *
2066
+ * @summary Creates a new completion for the provided prompt and parameters
2067
+ * @param {string} engineId The ID of the engine to use for this request
2068
+ * @param {CreateCompletionRequest} createCompletionRequest
2069
+ * @param {*} [options] Override http request option.
2070
+ * @throws {RequiredError}
2071
+ */
2072
+ createCompletion(engineId: string, createCompletionRequest: CreateCompletionRequest, options?: any): AxiosPromise<CreateCompletionResponse> {
2073
+ return localVarFp.createCompletion(engineId, createCompletionRequest, options).then((request) => request(axios, basePath));
2074
+ },
2075
+ /**
2076
+ *
2077
+ * @summary Creates a completion using a fine-tuned model
2078
+ * @param {CreateCompletionFromModelRequest} createCompletionFromModelRequest
2079
+ * @param {*} [options] Override http request option.
2080
+ * @throws {RequiredError}
2081
+ */
2082
+ createCompletionFromModel(createCompletionFromModelRequest: CreateCompletionFromModelRequest, options?: any): AxiosPromise<CreateCompletionResponse> {
2083
+ return localVarFp.createCompletionFromModel(createCompletionFromModelRequest, options).then((request) => request(axios, basePath));
2084
+ },
2085
+ /**
2086
+ *
2087
+ * @summary Creates an embedding vector representing the input text.
2088
+ * @param {string} engineId The ID of the engine to use for this request
2089
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
2090
+ * @param {*} [options] Override http request option.
2091
+ * @throws {RequiredError}
2092
+ */
2093
+ createEmbedding(engineId: string, createEmbeddingRequest: CreateEmbeddingRequest, options?: any): AxiosPromise<CreateEmbeddingResponse> {
2094
+ return localVarFp.createEmbedding(engineId, createEmbeddingRequest, options).then((request) => request(axios, basePath));
2095
+ },
2096
+ /**
2097
+ *
2098
+ * @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.
2099
+ * @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).
2100
+ * @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.
2101
+ * @param {*} [options] Override http request option.
2102
+ * @throws {RequiredError}
2103
+ */
2104
+ createFile(file: any, purpose: string, options?: any): AxiosPromise<OpenAIFile> {
2105
+ return localVarFp.createFile(file, purpose, options).then((request) => request(axios, basePath));
2106
+ },
2107
+ /**
2108
+ *
2109
+ * @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)
2110
+ * @param {CreateFineTuneRequest} createFineTuneRequest
2111
+ * @param {*} [options] Override http request option.
2112
+ * @throws {RequiredError}
2113
+ */
2114
+ createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: any): AxiosPromise<FineTune> {
2115
+ return localVarFp.createFineTune(createFineTuneRequest, options).then((request) => request(axios, basePath));
2116
+ },
2117
+ /**
2118
+ *
2119
+ * @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.
2120
+ * @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;.
2121
+ * @param {CreateSearchRequest} createSearchRequest
2122
+ * @param {*} [options] Override http request option.
2123
+ * @throws {RequiredError}
2124
+ */
2125
+ createSearch(engineId: string, createSearchRequest: CreateSearchRequest, options?: any): AxiosPromise<CreateSearchResponse> {
2126
+ return localVarFp.createSearch(engineId, createSearchRequest, options).then((request) => request(axios, basePath));
2127
+ },
2128
+ /**
2129
+ *
2130
+ * @summary Delete a file.
2131
+ * @param {string} fileId The ID of the file to use for this request
2132
+ * @param {*} [options] Override http request option.
2133
+ * @throws {RequiredError}
2134
+ */
2135
+ deleteFile(fileId: string, options?: any): AxiosPromise<DeleteFileResponse> {
2136
+ return localVarFp.deleteFile(fileId, options).then((request) => request(axios, basePath));
2137
+ },
2138
+ /**
2139
+ *
2140
+ * @summary Returns the contents of the specified file
2141
+ * @param {string} fileId The ID of the file to use for this request
2142
+ * @param {*} [options] Override http request option.
2143
+ * @throws {RequiredError}
2144
+ */
2145
+ downloadFile(fileId: string, options?: any): AxiosPromise<string> {
2146
+ return localVarFp.downloadFile(fileId, options).then((request) => request(axios, basePath));
2147
+ },
2148
+ /**
2149
+ *
2150
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
2151
+ * @param {*} [options] Override http request option.
2152
+ * @throws {RequiredError}
2153
+ */
2154
+ listEngines(options?: any): AxiosPromise<ListEnginesResponse> {
2155
+ return localVarFp.listEngines(options).then((request) => request(axios, basePath));
2156
+ },
2157
+ /**
2158
+ *
2159
+ * @summary Returns a list of files that belong to the user\'s organization.
2160
+ * @param {*} [options] Override http request option.
2161
+ * @throws {RequiredError}
2162
+ */
2163
+ listFiles(options?: any): AxiosPromise<ListFilesResponse> {
2164
+ return localVarFp.listFiles(options).then((request) => request(axios, basePath));
2165
+ },
2166
+ /**
2167
+ *
2168
+ * @summary Get fine-grained status updates for a fine-tune job.
2169
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
2170
+ * @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.
2171
+ * @param {*} [options] Override http request option.
2172
+ * @throws {RequiredError}
2173
+ */
2174
+ listFineTuneEvents(fineTuneId: string, stream?: boolean, options?: any): AxiosPromise<ListFineTuneEventsResponse> {
2175
+ return localVarFp.listFineTuneEvents(fineTuneId, stream, options).then((request) => request(axios, basePath));
2176
+ },
2177
+ /**
2178
+ *
2179
+ * @summary List your organization\'s fine-tuning jobs
2180
+ * @param {*} [options] Override http request option.
2181
+ * @throws {RequiredError}
2182
+ */
2183
+ listFineTunes(options?: any): AxiosPromise<ListFineTunesResponse> {
2184
+ return localVarFp.listFineTunes(options).then((request) => request(axios, basePath));
2185
+ },
2186
+ /**
2187
+ *
2188
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
2189
+ * @param {string} engineId The ID of the engine to use for this request
2190
+ * @param {*} [options] Override http request option.
2191
+ * @throws {RequiredError}
2192
+ */
2193
+ retrieveEngine(engineId: string, options?: any): AxiosPromise<Engine> {
2194
+ return localVarFp.retrieveEngine(engineId, options).then((request) => request(axios, basePath));
2195
+ },
2196
+ /**
2197
+ *
2198
+ * @summary Returns information about a specific file.
2199
+ * @param {string} fileId The ID of the file to use for this request
2200
+ * @param {*} [options] Override http request option.
2201
+ * @throws {RequiredError}
2202
+ */
2203
+ retrieveFile(fileId: string, options?: any): AxiosPromise<OpenAIFile> {
2204
+ return localVarFp.retrieveFile(fileId, options).then((request) => request(axios, basePath));
2205
+ },
2206
+ /**
2207
+ *
2208
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
2209
+ * @param {string} fineTuneId The ID of the fine-tune job
2210
+ * @param {*} [options] Override http request option.
2211
+ * @throws {RequiredError}
2212
+ */
2213
+ retrieveFineTune(fineTuneId: string, options?: any): AxiosPromise<FineTune> {
2214
+ return localVarFp.retrieveFineTune(fineTuneId, options).then((request) => request(axios, basePath));
2215
+ },
2216
+ };
2217
+ };
2218
+
2219
+ /**
2220
+ * OpenAIApi - object-oriented interface
2221
+ * @export
2222
+ * @class OpenAIApi
2223
+ * @extends {BaseAPI}
2224
+ */
2225
+ export class OpenAIApi extends BaseAPI {
2226
+ /**
2227
+ *
2228
+ * @summary Immediately cancel a fine-tune job.
2229
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
2230
+ * @param {*} [options] Override http request option.
2231
+ * @throws {RequiredError}
2232
+ * @memberof OpenAIApi
2233
+ */
2234
+ public cancelFineTune(fineTuneId: string, options?: AxiosRequestConfig) {
2235
+ return OpenAIApiFp(this.configuration).cancelFineTune(fineTuneId, options).then((request) => request(this.axios, this.basePath));
2236
+ }
2237
+
2238
+ /**
2239
+ *
2240
+ * @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).
2241
+ * @param {CreateAnswerRequest} createAnswerRequest
2242
+ * @param {*} [options] Override http request option.
2243
+ * @throws {RequiredError}
2244
+ * @memberof OpenAIApi
2245
+ */
2246
+ public createAnswer(createAnswerRequest: CreateAnswerRequest, options?: AxiosRequestConfig) {
2247
+ return OpenAIApiFp(this.configuration).createAnswer(createAnswerRequest, options).then((request) => request(this.axios, this.basePath));
2248
+ }
2249
+
2250
+ /**
2251
+ *
2252
+ * @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.
2253
+ * @param {CreateClassificationRequest} createClassificationRequest
2254
+ * @param {*} [options] Override http request option.
2255
+ * @throws {RequiredError}
2256
+ * @memberof OpenAIApi
2257
+ */
2258
+ public createClassification(createClassificationRequest: CreateClassificationRequest, options?: AxiosRequestConfig) {
2259
+ return OpenAIApiFp(this.configuration).createClassification(createClassificationRequest, options).then((request) => request(this.axios, this.basePath));
2260
+ }
2261
+
2262
+ /**
2263
+ *
2264
+ * @summary Creates a new completion for the provided prompt and parameters
2265
+ * @param {string} engineId The ID of the engine to use for this request
2266
+ * @param {CreateCompletionRequest} createCompletionRequest
2267
+ * @param {*} [options] Override http request option.
2268
+ * @throws {RequiredError}
2269
+ * @memberof OpenAIApi
2270
+ */
2271
+ public createCompletion(engineId: string, createCompletionRequest: CreateCompletionRequest, options?: AxiosRequestConfig) {
2272
+ return OpenAIApiFp(this.configuration).createCompletion(engineId, createCompletionRequest, options).then((request) => request(this.axios, this.basePath));
2273
+ }
2274
+
2275
+ /**
2276
+ *
2277
+ * @summary Creates a completion using a fine-tuned model
2278
+ * @param {CreateCompletionFromModelRequest} createCompletionFromModelRequest
2279
+ * @param {*} [options] Override http request option.
2280
+ * @throws {RequiredError}
2281
+ * @memberof OpenAIApi
2282
+ */
2283
+ public createCompletionFromModel(createCompletionFromModelRequest: CreateCompletionFromModelRequest, options?: AxiosRequestConfig) {
2284
+ return OpenAIApiFp(this.configuration).createCompletionFromModel(createCompletionFromModelRequest, options).then((request) => request(this.axios, this.basePath));
2285
+ }
2286
+
2287
+ /**
2288
+ *
2289
+ * @summary Creates an embedding vector representing the input text.
2290
+ * @param {string} engineId The ID of the engine to use for this request
2291
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
2292
+ * @param {*} [options] Override http request option.
2293
+ * @throws {RequiredError}
2294
+ * @memberof OpenAIApi
2295
+ */
2296
+ public createEmbedding(engineId: string, createEmbeddingRequest: CreateEmbeddingRequest, options?: AxiosRequestConfig) {
2297
+ return OpenAIApiFp(this.configuration).createEmbedding(engineId, createEmbeddingRequest, options).then((request) => request(this.axios, this.basePath));
2298
+ }
2299
+
2300
+ /**
2301
+ *
2302
+ * @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.
2303
+ * @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).
2304
+ * @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.
2305
+ * @param {*} [options] Override http request option.
2306
+ * @throws {RequiredError}
2307
+ * @memberof OpenAIApi
2308
+ */
2309
+ public createFile(file: any, purpose: string, options?: AxiosRequestConfig) {
2310
+ return OpenAIApiFp(this.configuration).createFile(file, purpose, options).then((request) => request(this.axios, this.basePath));
2311
+ }
2312
+
2313
+ /**
2314
+ *
2315
+ * @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)
2316
+ * @param {CreateFineTuneRequest} createFineTuneRequest
2317
+ * @param {*} [options] Override http request option.
2318
+ * @throws {RequiredError}
2319
+ * @memberof OpenAIApi
2320
+ */
2321
+ public createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: AxiosRequestConfig) {
2322
+ return OpenAIApiFp(this.configuration).createFineTune(createFineTuneRequest, options).then((request) => request(this.axios, this.basePath));
2323
+ }
2324
+
2325
+ /**
2326
+ *
2327
+ * @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.
2328
+ * @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;.
2329
+ * @param {CreateSearchRequest} createSearchRequest
2330
+ * @param {*} [options] Override http request option.
2331
+ * @throws {RequiredError}
2332
+ * @memberof OpenAIApi
2333
+ */
2334
+ public createSearch(engineId: string, createSearchRequest: CreateSearchRequest, options?: AxiosRequestConfig) {
2335
+ return OpenAIApiFp(this.configuration).createSearch(engineId, createSearchRequest, options).then((request) => request(this.axios, this.basePath));
2336
+ }
2337
+
2338
+ /**
2339
+ *
2340
+ * @summary Delete a file.
2341
+ * @param {string} fileId The ID of the file to use for this request
2342
+ * @param {*} [options] Override http request option.
2343
+ * @throws {RequiredError}
2344
+ * @memberof OpenAIApi
2345
+ */
2346
+ public deleteFile(fileId: string, options?: AxiosRequestConfig) {
2347
+ return OpenAIApiFp(this.configuration).deleteFile(fileId, options).then((request) => request(this.axios, this.basePath));
2348
+ }
2349
+
2350
+ /**
2351
+ *
2352
+ * @summary Returns the contents of the specified file
2353
+ * @param {string} fileId The ID of the file to use for this request
2354
+ * @param {*} [options] Override http request option.
2355
+ * @throws {RequiredError}
2356
+ * @memberof OpenAIApi
2357
+ */
2358
+ public downloadFile(fileId: string, options?: AxiosRequestConfig) {
2359
+ return OpenAIApiFp(this.configuration).downloadFile(fileId, options).then((request) => request(this.axios, this.basePath));
2360
+ }
2361
+
2362
+ /**
2363
+ *
2364
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
2365
+ * @param {*} [options] Override http request option.
2366
+ * @throws {RequiredError}
2367
+ * @memberof OpenAIApi
2368
+ */
2369
+ public listEngines(options?: AxiosRequestConfig) {
2370
+ return OpenAIApiFp(this.configuration).listEngines(options).then((request) => request(this.axios, this.basePath));
2371
+ }
2372
+
2373
+ /**
2374
+ *
2375
+ * @summary Returns a list of files that belong to the user\'s organization.
2376
+ * @param {*} [options] Override http request option.
2377
+ * @throws {RequiredError}
2378
+ * @memberof OpenAIApi
2379
+ */
2380
+ public listFiles(options?: AxiosRequestConfig) {
2381
+ return OpenAIApiFp(this.configuration).listFiles(options).then((request) => request(this.axios, this.basePath));
2382
+ }
2383
+
2384
+ /**
2385
+ *
2386
+ * @summary Get fine-grained status updates for a fine-tune job.
2387
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
2388
+ * @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.
2389
+ * @param {*} [options] Override http request option.
2390
+ * @throws {RequiredError}
2391
+ * @memberof OpenAIApi
2392
+ */
2393
+ public listFineTuneEvents(fineTuneId: string, stream?: boolean, options?: AxiosRequestConfig) {
2394
+ return OpenAIApiFp(this.configuration).listFineTuneEvents(fineTuneId, stream, options).then((request) => request(this.axios, this.basePath));
2395
+ }
2396
+
2397
+ /**
2398
+ *
2399
+ * @summary List your organization\'s fine-tuning jobs
2400
+ * @param {*} [options] Override http request option.
2401
+ * @throws {RequiredError}
2402
+ * @memberof OpenAIApi
2403
+ */
2404
+ public listFineTunes(options?: AxiosRequestConfig) {
2405
+ return OpenAIApiFp(this.configuration).listFineTunes(options).then((request) => request(this.axios, this.basePath));
2406
+ }
2407
+
2408
+ /**
2409
+ *
2410
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
2411
+ * @param {string} engineId The ID of the engine to use for this request
2412
+ * @param {*} [options] Override http request option.
2413
+ * @throws {RequiredError}
2414
+ * @memberof OpenAIApi
2415
+ */
2416
+ public retrieveEngine(engineId: string, options?: AxiosRequestConfig) {
2417
+ return OpenAIApiFp(this.configuration).retrieveEngine(engineId, options).then((request) => request(this.axios, this.basePath));
2418
+ }
2419
+
2420
+ /**
2421
+ *
2422
+ * @summary Returns information about a specific file.
2423
+ * @param {string} fileId The ID of the file to use for this request
2424
+ * @param {*} [options] Override http request option.
2425
+ * @throws {RequiredError}
2426
+ * @memberof OpenAIApi
2427
+ */
2428
+ public retrieveFile(fileId: string, options?: AxiosRequestConfig) {
2429
+ return OpenAIApiFp(this.configuration).retrieveFile(fileId, options).then((request) => request(this.axios, this.basePath));
2430
+ }
2431
+
2432
+ /**
2433
+ *
2434
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
2435
+ * @param {string} fineTuneId The ID of the fine-tune job
2436
+ * @param {*} [options] Override http request option.
2437
+ * @throws {RequiredError}
2438
+ * @memberof OpenAIApi
2439
+ */
2440
+ public retrieveFineTune(fineTuneId: string, options?: AxiosRequestConfig) {
2441
+ return OpenAIApiFp(this.configuration).retrieveFineTune(fineTuneId, options).then((request) => request(this.axios, this.basePath));
2442
+ }
2443
+ }
2444
+
2445
+