openai 1.0.0 → 2.0.0

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,2272 @@
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.
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).
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.
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).
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 CreateCompletionRequest
352
+ */
353
+ export interface CreateCompletionRequest {
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 CreateCompletionRequest
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 `davinci-codex`, which supports 4096).
362
+ * @type {number}
363
+ * @memberof CreateCompletionRequest
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 CreateCompletionRequest
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 CreateCompletionRequest
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 CreateCompletionRequest
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 CreateCompletionRequest
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 CreateCompletionRequest
394
+ */
395
+ 'logprobs'?: number | null;
396
+ /**
397
+ * Echo back the prompt in addition to the completion
398
+ * @type {boolean}
399
+ * @memberof CreateCompletionRequest
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 CreateCompletionRequest
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 CreateCompletionRequest
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 CreateCompletionRequest
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 CreateCompletionRequest
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 CreateCompletionRequest
430
+ */
431
+ 'logit_bias'?: object | null;
432
+ }
433
+ /**
434
+ *
435
+ * @export
436
+ * @interface CreateCompletionResponse
437
+ */
438
+ export interface CreateCompletionResponse {
439
+ /**
440
+ *
441
+ * @type {string}
442
+ * @memberof CreateCompletionResponse
443
+ */
444
+ 'id'?: string;
445
+ /**
446
+ *
447
+ * @type {string}
448
+ * @memberof CreateCompletionResponse
449
+ */
450
+ 'object'?: string;
451
+ /**
452
+ *
453
+ * @type {number}
454
+ * @memberof CreateCompletionResponse
455
+ */
456
+ 'created'?: number;
457
+ /**
458
+ *
459
+ * @type {string}
460
+ * @memberof CreateCompletionResponse
461
+ */
462
+ 'model'?: string;
463
+ /**
464
+ *
465
+ * @type {Array<CreateCompletionResponseChoices>}
466
+ * @memberof CreateCompletionResponse
467
+ */
468
+ 'choices'?: Array<CreateCompletionResponseChoices>;
469
+ }
470
+ /**
471
+ *
472
+ * @export
473
+ * @interface CreateCompletionResponseChoices
474
+ */
475
+ export interface CreateCompletionResponseChoices {
476
+ /**
477
+ *
478
+ * @type {string}
479
+ * @memberof CreateCompletionResponseChoices
480
+ */
481
+ 'text'?: string;
482
+ /**
483
+ *
484
+ * @type {number}
485
+ * @memberof CreateCompletionResponseChoices
486
+ */
487
+ 'index'?: number;
488
+ /**
489
+ *
490
+ * @type {CreateCompletionResponseLogprobs}
491
+ * @memberof CreateCompletionResponseChoices
492
+ */
493
+ 'logprobs'?: CreateCompletionResponseLogprobs | null;
494
+ /**
495
+ *
496
+ * @type {string}
497
+ * @memberof CreateCompletionResponseChoices
498
+ */
499
+ 'finish_reason'?: string;
500
+ }
501
+ /**
502
+ *
503
+ * @export
504
+ * @interface CreateCompletionResponseLogprobs
505
+ */
506
+ export interface CreateCompletionResponseLogprobs {
507
+ /**
508
+ *
509
+ * @type {Array<string>}
510
+ * @memberof CreateCompletionResponseLogprobs
511
+ */
512
+ 'tokens'?: Array<string>;
513
+ /**
514
+ *
515
+ * @type {Array<number>}
516
+ * @memberof CreateCompletionResponseLogprobs
517
+ */
518
+ 'token_logprobs'?: Array<number>;
519
+ /**
520
+ *
521
+ * @type {Array<object>}
522
+ * @memberof CreateCompletionResponseLogprobs
523
+ */
524
+ 'top_logprobs'?: Array<object>;
525
+ /**
526
+ *
527
+ * @type {Array<number>}
528
+ * @memberof CreateCompletionResponseLogprobs
529
+ */
530
+ 'text_offset'?: Array<number>;
531
+ }
532
+ /**
533
+ *
534
+ * @export
535
+ * @interface CreateEmbeddingRequest
536
+ */
537
+ export interface CreateEmbeddingRequest {
538
+ /**
539
+ * 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.
540
+ * @type {string | Array<string> | Array<number> | Array<any>}
541
+ * @memberof CreateEmbeddingRequest
542
+ */
543
+ 'input'?: string | Array<string> | Array<number> | Array<any>;
544
+ }
545
+ /**
546
+ *
547
+ * @export
548
+ * @interface CreateEmbeddingResponse
549
+ */
550
+ export interface CreateEmbeddingResponse {
551
+ /**
552
+ *
553
+ * @type {string}
554
+ * @memberof CreateEmbeddingResponse
555
+ */
556
+ 'object'?: string;
557
+ /**
558
+ *
559
+ * @type {string}
560
+ * @memberof CreateEmbeddingResponse
561
+ */
562
+ 'model'?: string;
563
+ /**
564
+ *
565
+ * @type {Array<CreateEmbeddingResponseData>}
566
+ * @memberof CreateEmbeddingResponse
567
+ */
568
+ 'data'?: Array<CreateEmbeddingResponseData>;
569
+ }
570
+ /**
571
+ *
572
+ * @export
573
+ * @interface CreateEmbeddingResponseData
574
+ */
575
+ export interface CreateEmbeddingResponseData {
576
+ /**
577
+ *
578
+ * @type {number}
579
+ * @memberof CreateEmbeddingResponseData
580
+ */
581
+ 'index'?: number;
582
+ /**
583
+ *
584
+ * @type {string}
585
+ * @memberof CreateEmbeddingResponseData
586
+ */
587
+ 'object'?: string;
588
+ /**
589
+ *
590
+ * @type {Array<number>}
591
+ * @memberof CreateEmbeddingResponseData
592
+ */
593
+ 'embedding'?: Array<number>;
594
+ }
595
+ /**
596
+ *
597
+ * @export
598
+ * @interface CreateFineTuneRequest
599
+ */
600
+ export interface CreateFineTuneRequest {
601
+ /**
602
+ * 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.
603
+ * @type {string}
604
+ * @memberof CreateFineTuneRequest
605
+ */
606
+ 'training_file'?: string;
607
+ /**
608
+ * 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.
609
+ * @type {string}
610
+ * @memberof CreateFineTuneRequest
611
+ */
612
+ 'validation_file'?: string | null;
613
+ /**
614
+ * 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.
615
+ * @type {string}
616
+ * @memberof CreateFineTuneRequest
617
+ */
618
+ 'model'?: string | null;
619
+ /**
620
+ * The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.
621
+ * @type {number}
622
+ * @memberof CreateFineTuneRequest
623
+ */
624
+ 'n_epochs'?: number | null;
625
+ /**
626
+ * 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.
627
+ * @type {number}
628
+ * @memberof CreateFineTuneRequest
629
+ */
630
+ 'batch_size'?: number | null;
631
+ /**
632
+ * 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.
633
+ * @type {number}
634
+ * @memberof CreateFineTuneRequest
635
+ */
636
+ 'learning_rate_multiplier'?: number | null;
637
+ /**
638
+ * 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.
639
+ * @type {number}
640
+ * @memberof CreateFineTuneRequest
641
+ */
642
+ 'prompt_loss_weight'?: number | null;
643
+ /**
644
+ * 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.
645
+ * @type {boolean}
646
+ * @memberof CreateFineTuneRequest
647
+ */
648
+ 'compute_classification_metrics'?: boolean | null;
649
+ /**
650
+ * The number of classes in a classification task. This parameter is required for multiclass classification.
651
+ * @type {number}
652
+ * @memberof CreateFineTuneRequest
653
+ */
654
+ 'classification_n_classes'?: number | null;
655
+ /**
656
+ * The positive class in binary classification. This parameter is needed to generate precision, recall, and F1 metrics when doing binary classification.
657
+ * @type {string}
658
+ * @memberof CreateFineTuneRequest
659
+ */
660
+ 'classification_positive_class'?: string | null;
661
+ /**
662
+ * 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.
663
+ * @type {Array<number>}
664
+ * @memberof CreateFineTuneRequest
665
+ */
666
+ 'classification_betas'?: Array<number> | null;
667
+ }
668
+ /**
669
+ *
670
+ * @export
671
+ * @interface CreateSearchRequest
672
+ */
673
+ export interface CreateSearchRequest {
674
+ /**
675
+ * 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.
676
+ * @type {Array<string>}
677
+ * @memberof CreateSearchRequest
678
+ */
679
+ 'documents'?: Array<string> | null;
680
+ /**
681
+ * The ID of an uploaded file that contains documents to search over. You should specify either `documents` or a `file`, but not both.
682
+ * @type {string}
683
+ * @memberof CreateSearchRequest
684
+ */
685
+ 'file'?: string | null;
686
+ /**
687
+ * Query to search against the documents.
688
+ * @type {string}
689
+ * @memberof CreateSearchRequest
690
+ */
691
+ 'query'?: string;
692
+ /**
693
+ * The maximum number of documents to be re-ranked and returned by search. This flag only takes effect when `file` is set.
694
+ * @type {number}
695
+ * @memberof CreateSearchRequest
696
+ */
697
+ 'max_rerank'?: number | null;
698
+ /**
699
+ * 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.
700
+ * @type {boolean}
701
+ * @memberof CreateSearchRequest
702
+ */
703
+ 'return_metadata'?: boolean | null;
704
+ }
705
+ /**
706
+ *
707
+ * @export
708
+ * @interface CreateSearchResponse
709
+ */
710
+ export interface CreateSearchResponse {
711
+ /**
712
+ *
713
+ * @type {string}
714
+ * @memberof CreateSearchResponse
715
+ */
716
+ 'object'?: string;
717
+ /**
718
+ *
719
+ * @type {string}
720
+ * @memberof CreateSearchResponse
721
+ */
722
+ 'model'?: string;
723
+ /**
724
+ *
725
+ * @type {Array<CreateSearchResponseData>}
726
+ * @memberof CreateSearchResponse
727
+ */
728
+ 'data'?: Array<CreateSearchResponseData>;
729
+ }
730
+ /**
731
+ *
732
+ * @export
733
+ * @interface CreateSearchResponseData
734
+ */
735
+ export interface CreateSearchResponseData {
736
+ /**
737
+ *
738
+ * @type {string}
739
+ * @memberof CreateSearchResponseData
740
+ */
741
+ 'object'?: string;
742
+ /**
743
+ *
744
+ * @type {number}
745
+ * @memberof CreateSearchResponseData
746
+ */
747
+ 'document'?: number;
748
+ /**
749
+ *
750
+ * @type {number}
751
+ * @memberof CreateSearchResponseData
752
+ */
753
+ 'score'?: number;
754
+ }
755
+ /**
756
+ *
757
+ * @export
758
+ * @interface DeleteFileResponse
759
+ */
760
+ export interface DeleteFileResponse {
761
+ /**
762
+ *
763
+ * @type {string}
764
+ * @memberof DeleteFileResponse
765
+ */
766
+ 'id'?: string;
767
+ /**
768
+ *
769
+ * @type {string}
770
+ * @memberof DeleteFileResponse
771
+ */
772
+ 'object'?: string;
773
+ /**
774
+ *
775
+ * @type {boolean}
776
+ * @memberof DeleteFileResponse
777
+ */
778
+ 'deleted'?: boolean;
779
+ }
780
+ /**
781
+ *
782
+ * @export
783
+ * @interface Engine
784
+ */
785
+ export interface Engine {
786
+ /**
787
+ *
788
+ * @type {string}
789
+ * @memberof Engine
790
+ */
791
+ 'id'?: string;
792
+ /**
793
+ *
794
+ * @type {string}
795
+ * @memberof Engine
796
+ */
797
+ 'object'?: string;
798
+ /**
799
+ *
800
+ * @type {number}
801
+ * @memberof Engine
802
+ */
803
+ 'created'?: number;
804
+ /**
805
+ *
806
+ * @type {boolean}
807
+ * @memberof Engine
808
+ */
809
+ 'ready'?: boolean;
810
+ }
811
+ /**
812
+ *
813
+ * @export
814
+ * @interface FineTune
815
+ */
816
+ export interface FineTune {
817
+ /**
818
+ *
819
+ * @type {string}
820
+ * @memberof FineTune
821
+ */
822
+ 'id'?: string;
823
+ /**
824
+ *
825
+ * @type {string}
826
+ * @memberof FineTune
827
+ */
828
+ 'object'?: string;
829
+ /**
830
+ *
831
+ * @type {number}
832
+ * @memberof FineTune
833
+ */
834
+ 'created_at'?: number;
835
+ /**
836
+ *
837
+ * @type {number}
838
+ * @memberof FineTune
839
+ */
840
+ 'updated_at'?: number;
841
+ /**
842
+ *
843
+ * @type {string}
844
+ * @memberof FineTune
845
+ */
846
+ 'model'?: string;
847
+ /**
848
+ *
849
+ * @type {string}
850
+ * @memberof FineTune
851
+ */
852
+ 'fine_tuned_model'?: string | null;
853
+ /**
854
+ *
855
+ * @type {string}
856
+ * @memberof FineTune
857
+ */
858
+ 'organization_id'?: string;
859
+ /**
860
+ *
861
+ * @type {string}
862
+ * @memberof FineTune
863
+ */
864
+ 'status'?: string;
865
+ /**
866
+ *
867
+ * @type {object}
868
+ * @memberof FineTune
869
+ */
870
+ 'hyperparams'?: object;
871
+ /**
872
+ *
873
+ * @type {Array<OpenAIFile>}
874
+ * @memberof FineTune
875
+ */
876
+ 'training_files'?: Array<OpenAIFile>;
877
+ /**
878
+ *
879
+ * @type {Array<OpenAIFile>}
880
+ * @memberof FineTune
881
+ */
882
+ 'validation_files'?: Array<OpenAIFile>;
883
+ /**
884
+ *
885
+ * @type {Array<OpenAIFile>}
886
+ * @memberof FineTune
887
+ */
888
+ 'result_files'?: Array<OpenAIFile>;
889
+ /**
890
+ *
891
+ * @type {Array<FineTuneEvent>}
892
+ * @memberof FineTune
893
+ */
894
+ 'events'?: Array<FineTuneEvent>;
895
+ }
896
+ /**
897
+ *
898
+ * @export
899
+ * @interface FineTuneEvent
900
+ */
901
+ export interface FineTuneEvent {
902
+ /**
903
+ *
904
+ * @type {string}
905
+ * @memberof FineTuneEvent
906
+ */
907
+ 'object'?: string;
908
+ /**
909
+ *
910
+ * @type {number}
911
+ * @memberof FineTuneEvent
912
+ */
913
+ 'created_at'?: number;
914
+ /**
915
+ *
916
+ * @type {string}
917
+ * @memberof FineTuneEvent
918
+ */
919
+ 'level'?: string;
920
+ /**
921
+ *
922
+ * @type {string}
923
+ * @memberof FineTuneEvent
924
+ */
925
+ 'message'?: string;
926
+ }
927
+ /**
928
+ *
929
+ * @export
930
+ * @interface ListEnginesResponse
931
+ */
932
+ export interface ListEnginesResponse {
933
+ /**
934
+ *
935
+ * @type {string}
936
+ * @memberof ListEnginesResponse
937
+ */
938
+ 'object'?: string;
939
+ /**
940
+ *
941
+ * @type {Array<Engine>}
942
+ * @memberof ListEnginesResponse
943
+ */
944
+ 'data'?: Array<Engine>;
945
+ }
946
+ /**
947
+ *
948
+ * @export
949
+ * @interface ListFilesResponse
950
+ */
951
+ export interface ListFilesResponse {
952
+ /**
953
+ *
954
+ * @type {string}
955
+ * @memberof ListFilesResponse
956
+ */
957
+ 'object'?: string;
958
+ /**
959
+ *
960
+ * @type {Array<OpenAIFile>}
961
+ * @memberof ListFilesResponse
962
+ */
963
+ 'data'?: Array<OpenAIFile>;
964
+ }
965
+ /**
966
+ *
967
+ * @export
968
+ * @interface ListFineTuneEventsResponse
969
+ */
970
+ export interface ListFineTuneEventsResponse {
971
+ /**
972
+ *
973
+ * @type {string}
974
+ * @memberof ListFineTuneEventsResponse
975
+ */
976
+ 'object'?: string;
977
+ /**
978
+ *
979
+ * @type {Array<FineTuneEvent>}
980
+ * @memberof ListFineTuneEventsResponse
981
+ */
982
+ 'data'?: Array<FineTuneEvent>;
983
+ }
984
+ /**
985
+ *
986
+ * @export
987
+ * @interface ListFineTunesResponse
988
+ */
989
+ export interface ListFineTunesResponse {
990
+ /**
991
+ *
992
+ * @type {string}
993
+ * @memberof ListFineTunesResponse
994
+ */
995
+ 'object'?: string;
996
+ /**
997
+ *
998
+ * @type {Array<FineTune>}
999
+ * @memberof ListFineTunesResponse
1000
+ */
1001
+ 'data'?: Array<FineTune>;
1002
+ }
1003
+ /**
1004
+ *
1005
+ * @export
1006
+ * @interface OpenAIFile
1007
+ */
1008
+ export interface OpenAIFile {
1009
+ /**
1010
+ *
1011
+ * @type {string}
1012
+ * @memberof OpenAIFile
1013
+ */
1014
+ 'id'?: string;
1015
+ /**
1016
+ *
1017
+ * @type {string}
1018
+ * @memberof OpenAIFile
1019
+ */
1020
+ 'object'?: string;
1021
+ /**
1022
+ *
1023
+ * @type {number}
1024
+ * @memberof OpenAIFile
1025
+ */
1026
+ 'bytes'?: number;
1027
+ /**
1028
+ *
1029
+ * @type {number}
1030
+ * @memberof OpenAIFile
1031
+ */
1032
+ 'created_at'?: number;
1033
+ /**
1034
+ *
1035
+ * @type {string}
1036
+ * @memberof OpenAIFile
1037
+ */
1038
+ 'filename'?: string;
1039
+ /**
1040
+ *
1041
+ * @type {string}
1042
+ * @memberof OpenAIFile
1043
+ */
1044
+ 'purpose'?: string;
1045
+ /**
1046
+ *
1047
+ * @type {string}
1048
+ * @memberof OpenAIFile
1049
+ */
1050
+ 'status'?: string;
1051
+ /**
1052
+ *
1053
+ * @type {object}
1054
+ * @memberof OpenAIFile
1055
+ */
1056
+ 'status_details'?: object | null;
1057
+ }
1058
+
1059
+ /**
1060
+ * OpenAIApi - axios parameter creator
1061
+ * @export
1062
+ */
1063
+ export const OpenAIApiAxiosParamCreator = function (configuration?: Configuration) {
1064
+ return {
1065
+ /**
1066
+ *
1067
+ * @summary Immediately cancel a fine-tune job.
1068
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
1069
+ * @param {*} [options] Override http request option.
1070
+ * @throws {RequiredError}
1071
+ */
1072
+ cancelFineTune: async (fineTuneId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1073
+ // verify required parameter 'fineTuneId' is not null or undefined
1074
+ assertParamExists('cancelFineTune', 'fineTuneId', fineTuneId)
1075
+ const localVarPath = `/fine-tunes/{fine_tune_id}/cancel`
1076
+ .replace(`{${"fine_tune_id"}}`, encodeURIComponent(String(fineTuneId)));
1077
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1078
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1079
+ let baseOptions;
1080
+ if (configuration) {
1081
+ baseOptions = configuration.baseOptions;
1082
+ }
1083
+
1084
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1085
+ const localVarHeaderParameter = {} as any;
1086
+ const localVarQueryParameter = {} as any;
1087
+
1088
+
1089
+
1090
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1091
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1092
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1093
+
1094
+ return {
1095
+ url: toPathString(localVarUrlObj),
1096
+ options: localVarRequestOptions,
1097
+ };
1098
+ },
1099
+ /**
1100
+ *
1101
+ * @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).
1102
+ * @param {CreateAnswerRequest} createAnswerRequest
1103
+ * @param {*} [options] Override http request option.
1104
+ * @throws {RequiredError}
1105
+ */
1106
+ createAnswer: async (createAnswerRequest: CreateAnswerRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1107
+ // verify required parameter 'createAnswerRequest' is not null or undefined
1108
+ assertParamExists('createAnswer', 'createAnswerRequest', createAnswerRequest)
1109
+ const localVarPath = `/answers`;
1110
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1111
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1112
+ let baseOptions;
1113
+ if (configuration) {
1114
+ baseOptions = configuration.baseOptions;
1115
+ }
1116
+
1117
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1118
+ const localVarHeaderParameter = {} as any;
1119
+ const localVarQueryParameter = {} as any;
1120
+
1121
+
1122
+
1123
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1124
+
1125
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1126
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1127
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1128
+ localVarRequestOptions.data = serializeDataIfNeeded(createAnswerRequest, localVarRequestOptions, configuration)
1129
+
1130
+ return {
1131
+ url: toPathString(localVarUrlObj),
1132
+ options: localVarRequestOptions,
1133
+ };
1134
+ },
1135
+ /**
1136
+ *
1137
+ * @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.
1138
+ * @param {CreateClassificationRequest} createClassificationRequest
1139
+ * @param {*} [options] Override http request option.
1140
+ * @throws {RequiredError}
1141
+ */
1142
+ createClassification: async (createClassificationRequest: CreateClassificationRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1143
+ // verify required parameter 'createClassificationRequest' is not null or undefined
1144
+ assertParamExists('createClassification', 'createClassificationRequest', createClassificationRequest)
1145
+ const localVarPath = `/classifications`;
1146
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1147
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1148
+ let baseOptions;
1149
+ if (configuration) {
1150
+ baseOptions = configuration.baseOptions;
1151
+ }
1152
+
1153
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1154
+ const localVarHeaderParameter = {} as any;
1155
+ const localVarQueryParameter = {} as any;
1156
+
1157
+
1158
+
1159
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1160
+
1161
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1162
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1163
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1164
+ localVarRequestOptions.data = serializeDataIfNeeded(createClassificationRequest, localVarRequestOptions, configuration)
1165
+
1166
+ return {
1167
+ url: toPathString(localVarUrlObj),
1168
+ options: localVarRequestOptions,
1169
+ };
1170
+ },
1171
+ /**
1172
+ *
1173
+ * @summary Creates a new completion for the provided prompt and parameters
1174
+ * @param {string} engineId The ID of the engine to use for this request
1175
+ * @param {CreateCompletionRequest} createCompletionRequest
1176
+ * @param {*} [options] Override http request option.
1177
+ * @throws {RequiredError}
1178
+ */
1179
+ createCompletion: async (engineId: string, createCompletionRequest: CreateCompletionRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1180
+ // verify required parameter 'engineId' is not null or undefined
1181
+ assertParamExists('createCompletion', 'engineId', engineId)
1182
+ // verify required parameter 'createCompletionRequest' is not null or undefined
1183
+ assertParamExists('createCompletion', 'createCompletionRequest', createCompletionRequest)
1184
+ const localVarPath = `/engines/{engine_id}/completions`
1185
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
1186
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1187
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1188
+ let baseOptions;
1189
+ if (configuration) {
1190
+ baseOptions = configuration.baseOptions;
1191
+ }
1192
+
1193
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1194
+ const localVarHeaderParameter = {} as any;
1195
+ const localVarQueryParameter = {} as any;
1196
+
1197
+
1198
+
1199
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1200
+
1201
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1202
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1203
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1204
+ localVarRequestOptions.data = serializeDataIfNeeded(createCompletionRequest, localVarRequestOptions, configuration)
1205
+
1206
+ return {
1207
+ url: toPathString(localVarUrlObj),
1208
+ options: localVarRequestOptions,
1209
+ };
1210
+ },
1211
+ /**
1212
+ *
1213
+ * @summary Creates an embedding vector representing the input text.
1214
+ * @param {string} engineId The ID of the engine to use for this request
1215
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
1216
+ * @param {*} [options] Override http request option.
1217
+ * @throws {RequiredError}
1218
+ */
1219
+ createEmbedding: async (engineId: string, createEmbeddingRequest: CreateEmbeddingRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1220
+ // verify required parameter 'engineId' is not null or undefined
1221
+ assertParamExists('createEmbedding', 'engineId', engineId)
1222
+ // verify required parameter 'createEmbeddingRequest' is not null or undefined
1223
+ assertParamExists('createEmbedding', 'createEmbeddingRequest', createEmbeddingRequest)
1224
+ const localVarPath = `/engines/{engine_id}/embeddings`
1225
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
1226
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1227
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1228
+ let baseOptions;
1229
+ if (configuration) {
1230
+ baseOptions = configuration.baseOptions;
1231
+ }
1232
+
1233
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1234
+ const localVarHeaderParameter = {} as any;
1235
+ const localVarQueryParameter = {} as any;
1236
+
1237
+
1238
+
1239
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1240
+
1241
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1242
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1243
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1244
+ localVarRequestOptions.data = serializeDataIfNeeded(createEmbeddingRequest, localVarRequestOptions, configuration)
1245
+
1246
+ return {
1247
+ url: toPathString(localVarUrlObj),
1248
+ options: localVarRequestOptions,
1249
+ };
1250
+ },
1251
+ /**
1252
+ *
1253
+ * @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.
1254
+ * @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).
1255
+ * @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.
1256
+ * @param {*} [options] Override http request option.
1257
+ * @throws {RequiredError}
1258
+ */
1259
+ createFile: async (file: any, purpose: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1260
+ // verify required parameter 'file' is not null or undefined
1261
+ assertParamExists('createFile', 'file', file)
1262
+ // verify required parameter 'purpose' is not null or undefined
1263
+ assertParamExists('createFile', 'purpose', purpose)
1264
+ const localVarPath = `/files`;
1265
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1266
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1267
+ let baseOptions;
1268
+ if (configuration) {
1269
+ baseOptions = configuration.baseOptions;
1270
+ }
1271
+
1272
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1273
+ const localVarHeaderParameter = {} as any;
1274
+ const localVarQueryParameter = {} as any;
1275
+ const localVarFormParams = new ((configuration && configuration.formDataCtor) || FormData)();
1276
+
1277
+
1278
+ if (file !== undefined) {
1279
+ localVarFormParams.append('file', file as any);
1280
+ }
1281
+
1282
+ if (purpose !== undefined) {
1283
+ localVarFormParams.append('purpose', purpose as any);
1284
+ }
1285
+
1286
+
1287
+ localVarHeaderParameter['Content-Type'] = 'multipart/form-data';
1288
+
1289
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1290
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1291
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...localVarFormParams.getHeaders(), ...headersFromBaseOptions, ...options.headers};
1292
+ localVarRequestOptions.data = localVarFormParams;
1293
+
1294
+ return {
1295
+ url: toPathString(localVarUrlObj),
1296
+ options: localVarRequestOptions,
1297
+ };
1298
+ },
1299
+ /**
1300
+ *
1301
+ * @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)
1302
+ * @param {CreateFineTuneRequest} createFineTuneRequest
1303
+ * @param {*} [options] Override http request option.
1304
+ * @throws {RequiredError}
1305
+ */
1306
+ createFineTune: async (createFineTuneRequest: CreateFineTuneRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1307
+ // verify required parameter 'createFineTuneRequest' is not null or undefined
1308
+ assertParamExists('createFineTune', 'createFineTuneRequest', createFineTuneRequest)
1309
+ const localVarPath = `/fine-tunes`;
1310
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1311
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1312
+ let baseOptions;
1313
+ if (configuration) {
1314
+ baseOptions = configuration.baseOptions;
1315
+ }
1316
+
1317
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1318
+ const localVarHeaderParameter = {} as any;
1319
+ const localVarQueryParameter = {} as any;
1320
+
1321
+
1322
+
1323
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1324
+
1325
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1326
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1327
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1328
+ localVarRequestOptions.data = serializeDataIfNeeded(createFineTuneRequest, localVarRequestOptions, configuration)
1329
+
1330
+ return {
1331
+ url: toPathString(localVarUrlObj),
1332
+ options: localVarRequestOptions,
1333
+ };
1334
+ },
1335
+ /**
1336
+ *
1337
+ * @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.
1338
+ * @param {string} engineId The ID of the engine to use for this request
1339
+ * @param {CreateSearchRequest} createSearchRequest
1340
+ * @param {*} [options] Override http request option.
1341
+ * @throws {RequiredError}
1342
+ */
1343
+ createSearch: async (engineId: string, createSearchRequest: CreateSearchRequest, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1344
+ // verify required parameter 'engineId' is not null or undefined
1345
+ assertParamExists('createSearch', 'engineId', engineId)
1346
+ // verify required parameter 'createSearchRequest' is not null or undefined
1347
+ assertParamExists('createSearch', 'createSearchRequest', createSearchRequest)
1348
+ const localVarPath = `/engines/{engine_id}/search`
1349
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
1350
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1351
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1352
+ let baseOptions;
1353
+ if (configuration) {
1354
+ baseOptions = configuration.baseOptions;
1355
+ }
1356
+
1357
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
1358
+ const localVarHeaderParameter = {} as any;
1359
+ const localVarQueryParameter = {} as any;
1360
+
1361
+
1362
+
1363
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1364
+
1365
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1366
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1367
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1368
+ localVarRequestOptions.data = serializeDataIfNeeded(createSearchRequest, localVarRequestOptions, configuration)
1369
+
1370
+ return {
1371
+ url: toPathString(localVarUrlObj),
1372
+ options: localVarRequestOptions,
1373
+ };
1374
+ },
1375
+ /**
1376
+ *
1377
+ * @summary Delete a file.
1378
+ * @param {string} fileId The ID of the file to use for this request
1379
+ * @param {*} [options] Override http request option.
1380
+ * @throws {RequiredError}
1381
+ */
1382
+ deleteFile: async (fileId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1383
+ // verify required parameter 'fileId' is not null or undefined
1384
+ assertParamExists('deleteFile', 'fileId', fileId)
1385
+ const localVarPath = `/files/{file_id}`
1386
+ .replace(`{${"file_id"}}`, encodeURIComponent(String(fileId)));
1387
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1388
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1389
+ let baseOptions;
1390
+ if (configuration) {
1391
+ baseOptions = configuration.baseOptions;
1392
+ }
1393
+
1394
+ const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
1395
+ const localVarHeaderParameter = {} as any;
1396
+ const localVarQueryParameter = {} as any;
1397
+
1398
+
1399
+
1400
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1401
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1402
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1403
+
1404
+ return {
1405
+ url: toPathString(localVarUrlObj),
1406
+ options: localVarRequestOptions,
1407
+ };
1408
+ },
1409
+ /**
1410
+ *
1411
+ * @summary Returns the contents of the specified file
1412
+ * @param {string} fileId The ID of the file to use for this request
1413
+ * @param {*} [options] Override http request option.
1414
+ * @throws {RequiredError}
1415
+ */
1416
+ downloadFile: async (fileId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1417
+ // verify required parameter 'fileId' is not null or undefined
1418
+ assertParamExists('downloadFile', 'fileId', fileId)
1419
+ const localVarPath = `/files/{file_id}/content`
1420
+ .replace(`{${"file_id"}}`, encodeURIComponent(String(fileId)));
1421
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1422
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1423
+ let baseOptions;
1424
+ if (configuration) {
1425
+ baseOptions = configuration.baseOptions;
1426
+ }
1427
+
1428
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1429
+ const localVarHeaderParameter = {} as any;
1430
+ const localVarQueryParameter = {} as any;
1431
+
1432
+
1433
+
1434
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1435
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1436
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1437
+
1438
+ return {
1439
+ url: toPathString(localVarUrlObj),
1440
+ options: localVarRequestOptions,
1441
+ };
1442
+ },
1443
+ /**
1444
+ *
1445
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
1446
+ * @param {*} [options] Override http request option.
1447
+ * @throws {RequiredError}
1448
+ */
1449
+ listEngines: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1450
+ const localVarPath = `/engines`;
1451
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1452
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1453
+ let baseOptions;
1454
+ if (configuration) {
1455
+ baseOptions = configuration.baseOptions;
1456
+ }
1457
+
1458
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1459
+ const localVarHeaderParameter = {} as any;
1460
+ const localVarQueryParameter = {} as any;
1461
+
1462
+
1463
+
1464
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1465
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1466
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1467
+
1468
+ return {
1469
+ url: toPathString(localVarUrlObj),
1470
+ options: localVarRequestOptions,
1471
+ };
1472
+ },
1473
+ /**
1474
+ *
1475
+ * @summary Returns a list of files that belong to the user\'s organization.
1476
+ * @param {*} [options] Override http request option.
1477
+ * @throws {RequiredError}
1478
+ */
1479
+ listFiles: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1480
+ const localVarPath = `/files`;
1481
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1482
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1483
+ let baseOptions;
1484
+ if (configuration) {
1485
+ baseOptions = configuration.baseOptions;
1486
+ }
1487
+
1488
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1489
+ const localVarHeaderParameter = {} as any;
1490
+ const localVarQueryParameter = {} as any;
1491
+
1492
+
1493
+
1494
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1495
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1496
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1497
+
1498
+ return {
1499
+ url: toPathString(localVarUrlObj),
1500
+ options: localVarRequestOptions,
1501
+ };
1502
+ },
1503
+ /**
1504
+ *
1505
+ * @summary Get fine-grained status updates for a fine-tune job.
1506
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
1507
+ * @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.
1508
+ * @param {*} [options] Override http request option.
1509
+ * @throws {RequiredError}
1510
+ */
1511
+ listFineTuneEvents: async (fineTuneId: string, stream?: boolean, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1512
+ // verify required parameter 'fineTuneId' is not null or undefined
1513
+ assertParamExists('listFineTuneEvents', 'fineTuneId', fineTuneId)
1514
+ const localVarPath = `/fine-tunes/{fine_tune_id}/events`
1515
+ .replace(`{${"fine_tune_id"}}`, encodeURIComponent(String(fineTuneId)));
1516
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1517
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1518
+ let baseOptions;
1519
+ if (configuration) {
1520
+ baseOptions = configuration.baseOptions;
1521
+ }
1522
+
1523
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1524
+ const localVarHeaderParameter = {} as any;
1525
+ const localVarQueryParameter = {} as any;
1526
+
1527
+ if (stream !== undefined) {
1528
+ localVarQueryParameter['stream'] = stream;
1529
+ }
1530
+
1531
+
1532
+
1533
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1534
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1535
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1536
+
1537
+ return {
1538
+ url: toPathString(localVarUrlObj),
1539
+ options: localVarRequestOptions,
1540
+ };
1541
+ },
1542
+ /**
1543
+ *
1544
+ * @summary List your organization\'s fine-tuning jobs
1545
+ * @param {*} [options] Override http request option.
1546
+ * @throws {RequiredError}
1547
+ */
1548
+ listFineTunes: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1549
+ const localVarPath = `/fine-tunes`;
1550
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1551
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1552
+ let baseOptions;
1553
+ if (configuration) {
1554
+ baseOptions = configuration.baseOptions;
1555
+ }
1556
+
1557
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1558
+ const localVarHeaderParameter = {} as any;
1559
+ const localVarQueryParameter = {} as any;
1560
+
1561
+
1562
+
1563
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1564
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1565
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1566
+
1567
+ return {
1568
+ url: toPathString(localVarUrlObj),
1569
+ options: localVarRequestOptions,
1570
+ };
1571
+ },
1572
+ /**
1573
+ *
1574
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
1575
+ * @param {string} engineId The ID of the engine to use for this request
1576
+ * @param {*} [options] Override http request option.
1577
+ * @throws {RequiredError}
1578
+ */
1579
+ retrieveEngine: async (engineId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1580
+ // verify required parameter 'engineId' is not null or undefined
1581
+ assertParamExists('retrieveEngine', 'engineId', engineId)
1582
+ const localVarPath = `/engines/{engine_id}`
1583
+ .replace(`{${"engine_id"}}`, encodeURIComponent(String(engineId)));
1584
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1585
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1586
+ let baseOptions;
1587
+ if (configuration) {
1588
+ baseOptions = configuration.baseOptions;
1589
+ }
1590
+
1591
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1592
+ const localVarHeaderParameter = {} as any;
1593
+ const localVarQueryParameter = {} as any;
1594
+
1595
+
1596
+
1597
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1598
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1599
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1600
+
1601
+ return {
1602
+ url: toPathString(localVarUrlObj),
1603
+ options: localVarRequestOptions,
1604
+ };
1605
+ },
1606
+ /**
1607
+ *
1608
+ * @summary Returns information about a specific file.
1609
+ * @param {string} fileId The ID of the file to use for this request
1610
+ * @param {*} [options] Override http request option.
1611
+ * @throws {RequiredError}
1612
+ */
1613
+ retrieveFile: async (fileId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1614
+ // verify required parameter 'fileId' is not null or undefined
1615
+ assertParamExists('retrieveFile', 'fileId', fileId)
1616
+ const localVarPath = `/files/{file_id}`
1617
+ .replace(`{${"file_id"}}`, encodeURIComponent(String(fileId)));
1618
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1619
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1620
+ let baseOptions;
1621
+ if (configuration) {
1622
+ baseOptions = configuration.baseOptions;
1623
+ }
1624
+
1625
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1626
+ const localVarHeaderParameter = {} as any;
1627
+ const localVarQueryParameter = {} as any;
1628
+
1629
+
1630
+
1631
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1632
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1633
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1634
+
1635
+ return {
1636
+ url: toPathString(localVarUrlObj),
1637
+ options: localVarRequestOptions,
1638
+ };
1639
+ },
1640
+ /**
1641
+ *
1642
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
1643
+ * @param {string} fineTuneId The ID of the fine-tune job
1644
+ * @param {*} [options] Override http request option.
1645
+ * @throws {RequiredError}
1646
+ */
1647
+ retrieveFineTune: async (fineTuneId: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
1648
+ // verify required parameter 'fineTuneId' is not null or undefined
1649
+ assertParamExists('retrieveFineTune', 'fineTuneId', fineTuneId)
1650
+ const localVarPath = `/fine-tunes/{fine_tune_id}`
1651
+ .replace(`{${"fine_tune_id"}}`, encodeURIComponent(String(fineTuneId)));
1652
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1653
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1654
+ let baseOptions;
1655
+ if (configuration) {
1656
+ baseOptions = configuration.baseOptions;
1657
+ }
1658
+
1659
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
1660
+ const localVarHeaderParameter = {} as any;
1661
+ const localVarQueryParameter = {} as any;
1662
+
1663
+
1664
+
1665
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1666
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1667
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
1668
+
1669
+ return {
1670
+ url: toPathString(localVarUrlObj),
1671
+ options: localVarRequestOptions,
1672
+ };
1673
+ },
1674
+ }
1675
+ };
1676
+
1677
+ /**
1678
+ * OpenAIApi - functional programming interface
1679
+ * @export
1680
+ */
1681
+ export const OpenAIApiFp = function(configuration?: Configuration) {
1682
+ const localVarAxiosParamCreator = OpenAIApiAxiosParamCreator(configuration)
1683
+ return {
1684
+ /**
1685
+ *
1686
+ * @summary Immediately cancel a fine-tune job.
1687
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
1688
+ * @param {*} [options] Override http request option.
1689
+ * @throws {RequiredError}
1690
+ */
1691
+ async cancelFineTune(fineTuneId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FineTune>> {
1692
+ const localVarAxiosArgs = await localVarAxiosParamCreator.cancelFineTune(fineTuneId, options);
1693
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1694
+ },
1695
+ /**
1696
+ *
1697
+ * @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).
1698
+ * @param {CreateAnswerRequest} createAnswerRequest
1699
+ * @param {*} [options] Override http request option.
1700
+ * @throws {RequiredError}
1701
+ */
1702
+ async createAnswer(createAnswerRequest: CreateAnswerRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateAnswerResponse>> {
1703
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createAnswer(createAnswerRequest, options);
1704
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1705
+ },
1706
+ /**
1707
+ *
1708
+ * @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.
1709
+ * @param {CreateClassificationRequest} createClassificationRequest
1710
+ * @param {*} [options] Override http request option.
1711
+ * @throws {RequiredError}
1712
+ */
1713
+ async createClassification(createClassificationRequest: CreateClassificationRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateClassificationResponse>> {
1714
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createClassification(createClassificationRequest, options);
1715
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1716
+ },
1717
+ /**
1718
+ *
1719
+ * @summary Creates a new completion for the provided prompt and parameters
1720
+ * @param {string} engineId The ID of the engine to use for this request
1721
+ * @param {CreateCompletionRequest} createCompletionRequest
1722
+ * @param {*} [options] Override http request option.
1723
+ * @throws {RequiredError}
1724
+ */
1725
+ async createCompletion(engineId: string, createCompletionRequest: CreateCompletionRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateCompletionResponse>> {
1726
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createCompletion(engineId, createCompletionRequest, options);
1727
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1728
+ },
1729
+ /**
1730
+ *
1731
+ * @summary Creates an embedding vector representing the input text.
1732
+ * @param {string} engineId The ID of the engine to use for this request
1733
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
1734
+ * @param {*} [options] Override http request option.
1735
+ * @throws {RequiredError}
1736
+ */
1737
+ async createEmbedding(engineId: string, createEmbeddingRequest: CreateEmbeddingRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateEmbeddingResponse>> {
1738
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createEmbedding(engineId, createEmbeddingRequest, options);
1739
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1740
+ },
1741
+ /**
1742
+ *
1743
+ * @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.
1744
+ * @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).
1745
+ * @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.
1746
+ * @param {*} [options] Override http request option.
1747
+ * @throws {RequiredError}
1748
+ */
1749
+ async createFile(file: any, purpose: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<OpenAIFile>> {
1750
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createFile(file, purpose, options);
1751
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1752
+ },
1753
+ /**
1754
+ *
1755
+ * @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)
1756
+ * @param {CreateFineTuneRequest} createFineTuneRequest
1757
+ * @param {*} [options] Override http request option.
1758
+ * @throws {RequiredError}
1759
+ */
1760
+ async createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FineTune>> {
1761
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createFineTune(createFineTuneRequest, options);
1762
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1763
+ },
1764
+ /**
1765
+ *
1766
+ * @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.
1767
+ * @param {string} engineId The ID of the engine to use for this request
1768
+ * @param {CreateSearchRequest} createSearchRequest
1769
+ * @param {*} [options] Override http request option.
1770
+ * @throws {RequiredError}
1771
+ */
1772
+ async createSearch(engineId: string, createSearchRequest: CreateSearchRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateSearchResponse>> {
1773
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createSearch(engineId, createSearchRequest, options);
1774
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1775
+ },
1776
+ /**
1777
+ *
1778
+ * @summary Delete a file.
1779
+ * @param {string} fileId The ID of the file to use for this request
1780
+ * @param {*} [options] Override http request option.
1781
+ * @throws {RequiredError}
1782
+ */
1783
+ async deleteFile(fileId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<DeleteFileResponse>> {
1784
+ const localVarAxiosArgs = await localVarAxiosParamCreator.deleteFile(fileId, options);
1785
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1786
+ },
1787
+ /**
1788
+ *
1789
+ * @summary Returns the contents of the specified file
1790
+ * @param {string} fileId The ID of the file to use for this request
1791
+ * @param {*} [options] Override http request option.
1792
+ * @throws {RequiredError}
1793
+ */
1794
+ async downloadFile(fileId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> {
1795
+ const localVarAxiosArgs = await localVarAxiosParamCreator.downloadFile(fileId, options);
1796
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1797
+ },
1798
+ /**
1799
+ *
1800
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
1801
+ * @param {*} [options] Override http request option.
1802
+ * @throws {RequiredError}
1803
+ */
1804
+ async listEngines(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListEnginesResponse>> {
1805
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listEngines(options);
1806
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1807
+ },
1808
+ /**
1809
+ *
1810
+ * @summary Returns a list of files that belong to the user\'s organization.
1811
+ * @param {*} [options] Override http request option.
1812
+ * @throws {RequiredError}
1813
+ */
1814
+ async listFiles(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListFilesResponse>> {
1815
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listFiles(options);
1816
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1817
+ },
1818
+ /**
1819
+ *
1820
+ * @summary Get fine-grained status updates for a fine-tune job.
1821
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
1822
+ * @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.
1823
+ * @param {*} [options] Override http request option.
1824
+ * @throws {RequiredError}
1825
+ */
1826
+ async listFineTuneEvents(fineTuneId: string, stream?: boolean, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListFineTuneEventsResponse>> {
1827
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listFineTuneEvents(fineTuneId, stream, options);
1828
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1829
+ },
1830
+ /**
1831
+ *
1832
+ * @summary List your organization\'s fine-tuning jobs
1833
+ * @param {*} [options] Override http request option.
1834
+ * @throws {RequiredError}
1835
+ */
1836
+ async listFineTunes(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListFineTunesResponse>> {
1837
+ const localVarAxiosArgs = await localVarAxiosParamCreator.listFineTunes(options);
1838
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1839
+ },
1840
+ /**
1841
+ *
1842
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
1843
+ * @param {string} engineId The ID of the engine to use for this request
1844
+ * @param {*} [options] Override http request option.
1845
+ * @throws {RequiredError}
1846
+ */
1847
+ async retrieveEngine(engineId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Engine>> {
1848
+ const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveEngine(engineId, options);
1849
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1850
+ },
1851
+ /**
1852
+ *
1853
+ * @summary Returns information about a specific file.
1854
+ * @param {string} fileId The ID of the file to use for this request
1855
+ * @param {*} [options] Override http request option.
1856
+ * @throws {RequiredError}
1857
+ */
1858
+ async retrieveFile(fileId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<OpenAIFile>> {
1859
+ const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveFile(fileId, options);
1860
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1861
+ },
1862
+ /**
1863
+ *
1864
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
1865
+ * @param {string} fineTuneId The ID of the fine-tune job
1866
+ * @param {*} [options] Override http request option.
1867
+ * @throws {RequiredError}
1868
+ */
1869
+ async retrieveFineTune(fineTuneId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<FineTune>> {
1870
+ const localVarAxiosArgs = await localVarAxiosParamCreator.retrieveFineTune(fineTuneId, options);
1871
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1872
+ },
1873
+ }
1874
+ };
1875
+
1876
+ /**
1877
+ * OpenAIApi - factory interface
1878
+ * @export
1879
+ */
1880
+ export const OpenAIApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
1881
+ const localVarFp = OpenAIApiFp(configuration)
1882
+ return {
1883
+ /**
1884
+ *
1885
+ * @summary Immediately cancel a fine-tune job.
1886
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
1887
+ * @param {*} [options] Override http request option.
1888
+ * @throws {RequiredError}
1889
+ */
1890
+ cancelFineTune(fineTuneId: string, options?: any): AxiosPromise<FineTune> {
1891
+ return localVarFp.cancelFineTune(fineTuneId, options).then((request) => request(axios, basePath));
1892
+ },
1893
+ /**
1894
+ *
1895
+ * @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).
1896
+ * @param {CreateAnswerRequest} createAnswerRequest
1897
+ * @param {*} [options] Override http request option.
1898
+ * @throws {RequiredError}
1899
+ */
1900
+ createAnswer(createAnswerRequest: CreateAnswerRequest, options?: any): AxiosPromise<CreateAnswerResponse> {
1901
+ return localVarFp.createAnswer(createAnswerRequest, options).then((request) => request(axios, basePath));
1902
+ },
1903
+ /**
1904
+ *
1905
+ * @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.
1906
+ * @param {CreateClassificationRequest} createClassificationRequest
1907
+ * @param {*} [options] Override http request option.
1908
+ * @throws {RequiredError}
1909
+ */
1910
+ createClassification(createClassificationRequest: CreateClassificationRequest, options?: any): AxiosPromise<CreateClassificationResponse> {
1911
+ return localVarFp.createClassification(createClassificationRequest, options).then((request) => request(axios, basePath));
1912
+ },
1913
+ /**
1914
+ *
1915
+ * @summary Creates a new completion for the provided prompt and parameters
1916
+ * @param {string} engineId The ID of the engine to use for this request
1917
+ * @param {CreateCompletionRequest} createCompletionRequest
1918
+ * @param {*} [options] Override http request option.
1919
+ * @throws {RequiredError}
1920
+ */
1921
+ createCompletion(engineId: string, createCompletionRequest: CreateCompletionRequest, options?: any): AxiosPromise<CreateCompletionResponse> {
1922
+ return localVarFp.createCompletion(engineId, createCompletionRequest, options).then((request) => request(axios, basePath));
1923
+ },
1924
+ /**
1925
+ *
1926
+ * @summary Creates an embedding vector representing the input text.
1927
+ * @param {string} engineId The ID of the engine to use for this request
1928
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
1929
+ * @param {*} [options] Override http request option.
1930
+ * @throws {RequiredError}
1931
+ */
1932
+ createEmbedding(engineId: string, createEmbeddingRequest: CreateEmbeddingRequest, options?: any): AxiosPromise<CreateEmbeddingResponse> {
1933
+ return localVarFp.createEmbedding(engineId, createEmbeddingRequest, options).then((request) => request(axios, basePath));
1934
+ },
1935
+ /**
1936
+ *
1937
+ * @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.
1938
+ * @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).
1939
+ * @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.
1940
+ * @param {*} [options] Override http request option.
1941
+ * @throws {RequiredError}
1942
+ */
1943
+ createFile(file: any, purpose: string, options?: any): AxiosPromise<OpenAIFile> {
1944
+ return localVarFp.createFile(file, purpose, options).then((request) => request(axios, basePath));
1945
+ },
1946
+ /**
1947
+ *
1948
+ * @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)
1949
+ * @param {CreateFineTuneRequest} createFineTuneRequest
1950
+ * @param {*} [options] Override http request option.
1951
+ * @throws {RequiredError}
1952
+ */
1953
+ createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: any): AxiosPromise<FineTune> {
1954
+ return localVarFp.createFineTune(createFineTuneRequest, options).then((request) => request(axios, basePath));
1955
+ },
1956
+ /**
1957
+ *
1958
+ * @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.
1959
+ * @param {string} engineId The ID of the engine to use for this request
1960
+ * @param {CreateSearchRequest} createSearchRequest
1961
+ * @param {*} [options] Override http request option.
1962
+ * @throws {RequiredError}
1963
+ */
1964
+ createSearch(engineId: string, createSearchRequest: CreateSearchRequest, options?: any): AxiosPromise<CreateSearchResponse> {
1965
+ return localVarFp.createSearch(engineId, createSearchRequest, options).then((request) => request(axios, basePath));
1966
+ },
1967
+ /**
1968
+ *
1969
+ * @summary Delete a file.
1970
+ * @param {string} fileId The ID of the file to use for this request
1971
+ * @param {*} [options] Override http request option.
1972
+ * @throws {RequiredError}
1973
+ */
1974
+ deleteFile(fileId: string, options?: any): AxiosPromise<DeleteFileResponse> {
1975
+ return localVarFp.deleteFile(fileId, options).then((request) => request(axios, basePath));
1976
+ },
1977
+ /**
1978
+ *
1979
+ * @summary Returns the contents of the specified file
1980
+ * @param {string} fileId The ID of the file to use for this request
1981
+ * @param {*} [options] Override http request option.
1982
+ * @throws {RequiredError}
1983
+ */
1984
+ downloadFile(fileId: string, options?: any): AxiosPromise<string> {
1985
+ return localVarFp.downloadFile(fileId, options).then((request) => request(axios, basePath));
1986
+ },
1987
+ /**
1988
+ *
1989
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
1990
+ * @param {*} [options] Override http request option.
1991
+ * @throws {RequiredError}
1992
+ */
1993
+ listEngines(options?: any): AxiosPromise<ListEnginesResponse> {
1994
+ return localVarFp.listEngines(options).then((request) => request(axios, basePath));
1995
+ },
1996
+ /**
1997
+ *
1998
+ * @summary Returns a list of files that belong to the user\'s organization.
1999
+ * @param {*} [options] Override http request option.
2000
+ * @throws {RequiredError}
2001
+ */
2002
+ listFiles(options?: any): AxiosPromise<ListFilesResponse> {
2003
+ return localVarFp.listFiles(options).then((request) => request(axios, basePath));
2004
+ },
2005
+ /**
2006
+ *
2007
+ * @summary Get fine-grained status updates for a fine-tune job.
2008
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
2009
+ * @param {boolean} [stream] Whether to stream events for the fine-tune job. If set to true, events will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available. The stream will terminate with a &#x60;data: [DONE]&#x60; message when the job is finished (succeeded, cancelled, or failed). If set to false, only events generated so far will be returned.
2010
+ * @param {*} [options] Override http request option.
2011
+ * @throws {RequiredError}
2012
+ */
2013
+ listFineTuneEvents(fineTuneId: string, stream?: boolean, options?: any): AxiosPromise<ListFineTuneEventsResponse> {
2014
+ return localVarFp.listFineTuneEvents(fineTuneId, stream, options).then((request) => request(axios, basePath));
2015
+ },
2016
+ /**
2017
+ *
2018
+ * @summary List your organization\'s fine-tuning jobs
2019
+ * @param {*} [options] Override http request option.
2020
+ * @throws {RequiredError}
2021
+ */
2022
+ listFineTunes(options?: any): AxiosPromise<ListFineTunesResponse> {
2023
+ return localVarFp.listFineTunes(options).then((request) => request(axios, basePath));
2024
+ },
2025
+ /**
2026
+ *
2027
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
2028
+ * @param {string} engineId The ID of the engine to use for this request
2029
+ * @param {*} [options] Override http request option.
2030
+ * @throws {RequiredError}
2031
+ */
2032
+ retrieveEngine(engineId: string, options?: any): AxiosPromise<Engine> {
2033
+ return localVarFp.retrieveEngine(engineId, options).then((request) => request(axios, basePath));
2034
+ },
2035
+ /**
2036
+ *
2037
+ * @summary Returns information about a specific file.
2038
+ * @param {string} fileId The ID of the file to use for this request
2039
+ * @param {*} [options] Override http request option.
2040
+ * @throws {RequiredError}
2041
+ */
2042
+ retrieveFile(fileId: string, options?: any): AxiosPromise<OpenAIFile> {
2043
+ return localVarFp.retrieveFile(fileId, options).then((request) => request(axios, basePath));
2044
+ },
2045
+ /**
2046
+ *
2047
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
2048
+ * @param {string} fineTuneId The ID of the fine-tune job
2049
+ * @param {*} [options] Override http request option.
2050
+ * @throws {RequiredError}
2051
+ */
2052
+ retrieveFineTune(fineTuneId: string, options?: any): AxiosPromise<FineTune> {
2053
+ return localVarFp.retrieveFineTune(fineTuneId, options).then((request) => request(axios, basePath));
2054
+ },
2055
+ };
2056
+ };
2057
+
2058
+ /**
2059
+ * OpenAIApi - object-oriented interface
2060
+ * @export
2061
+ * @class OpenAIApi
2062
+ * @extends {BaseAPI}
2063
+ */
2064
+ export class OpenAIApi extends BaseAPI {
2065
+ /**
2066
+ *
2067
+ * @summary Immediately cancel a fine-tune job.
2068
+ * @param {string} fineTuneId The ID of the fine-tune job to cancel
2069
+ * @param {*} [options] Override http request option.
2070
+ * @throws {RequiredError}
2071
+ * @memberof OpenAIApi
2072
+ */
2073
+ public cancelFineTune(fineTuneId: string, options?: AxiosRequestConfig) {
2074
+ return OpenAIApiFp(this.configuration).cancelFineTune(fineTuneId, options).then((request) => request(this.axios, this.basePath));
2075
+ }
2076
+
2077
+ /**
2078
+ *
2079
+ * @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).
2080
+ * @param {CreateAnswerRequest} createAnswerRequest
2081
+ * @param {*} [options] Override http request option.
2082
+ * @throws {RequiredError}
2083
+ * @memberof OpenAIApi
2084
+ */
2085
+ public createAnswer(createAnswerRequest: CreateAnswerRequest, options?: AxiosRequestConfig) {
2086
+ return OpenAIApiFp(this.configuration).createAnswer(createAnswerRequest, options).then((request) => request(this.axios, this.basePath));
2087
+ }
2088
+
2089
+ /**
2090
+ *
2091
+ * @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.
2092
+ * @param {CreateClassificationRequest} createClassificationRequest
2093
+ * @param {*} [options] Override http request option.
2094
+ * @throws {RequiredError}
2095
+ * @memberof OpenAIApi
2096
+ */
2097
+ public createClassification(createClassificationRequest: CreateClassificationRequest, options?: AxiosRequestConfig) {
2098
+ return OpenAIApiFp(this.configuration).createClassification(createClassificationRequest, options).then((request) => request(this.axios, this.basePath));
2099
+ }
2100
+
2101
+ /**
2102
+ *
2103
+ * @summary Creates a new completion for the provided prompt and parameters
2104
+ * @param {string} engineId The ID of the engine to use for this request
2105
+ * @param {CreateCompletionRequest} createCompletionRequest
2106
+ * @param {*} [options] Override http request option.
2107
+ * @throws {RequiredError}
2108
+ * @memberof OpenAIApi
2109
+ */
2110
+ public createCompletion(engineId: string, createCompletionRequest: CreateCompletionRequest, options?: AxiosRequestConfig) {
2111
+ return OpenAIApiFp(this.configuration).createCompletion(engineId, createCompletionRequest, options).then((request) => request(this.axios, this.basePath));
2112
+ }
2113
+
2114
+ /**
2115
+ *
2116
+ * @summary Creates an embedding vector representing the input text.
2117
+ * @param {string} engineId The ID of the engine to use for this request
2118
+ * @param {CreateEmbeddingRequest} createEmbeddingRequest
2119
+ * @param {*} [options] Override http request option.
2120
+ * @throws {RequiredError}
2121
+ * @memberof OpenAIApi
2122
+ */
2123
+ public createEmbedding(engineId: string, createEmbeddingRequest: CreateEmbeddingRequest, options?: AxiosRequestConfig) {
2124
+ return OpenAIApiFp(this.configuration).createEmbedding(engineId, createEmbeddingRequest, options).then((request) => request(this.axios, this.basePath));
2125
+ }
2126
+
2127
+ /**
2128
+ *
2129
+ * @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.
2130
+ * @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).
2131
+ * @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.
2132
+ * @param {*} [options] Override http request option.
2133
+ * @throws {RequiredError}
2134
+ * @memberof OpenAIApi
2135
+ */
2136
+ public createFile(file: any, purpose: string, options?: AxiosRequestConfig) {
2137
+ return OpenAIApiFp(this.configuration).createFile(file, purpose, options).then((request) => request(this.axios, this.basePath));
2138
+ }
2139
+
2140
+ /**
2141
+ *
2142
+ * @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)
2143
+ * @param {CreateFineTuneRequest} createFineTuneRequest
2144
+ * @param {*} [options] Override http request option.
2145
+ * @throws {RequiredError}
2146
+ * @memberof OpenAIApi
2147
+ */
2148
+ public createFineTune(createFineTuneRequest: CreateFineTuneRequest, options?: AxiosRequestConfig) {
2149
+ return OpenAIApiFp(this.configuration).createFineTune(createFineTuneRequest, options).then((request) => request(this.axios, this.basePath));
2150
+ }
2151
+
2152
+ /**
2153
+ *
2154
+ * @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.
2155
+ * @param {string} engineId The ID of the engine to use for this request
2156
+ * @param {CreateSearchRequest} createSearchRequest
2157
+ * @param {*} [options] Override http request option.
2158
+ * @throws {RequiredError}
2159
+ * @memberof OpenAIApi
2160
+ */
2161
+ public createSearch(engineId: string, createSearchRequest: CreateSearchRequest, options?: AxiosRequestConfig) {
2162
+ return OpenAIApiFp(this.configuration).createSearch(engineId, createSearchRequest, options).then((request) => request(this.axios, this.basePath));
2163
+ }
2164
+
2165
+ /**
2166
+ *
2167
+ * @summary Delete a file.
2168
+ * @param {string} fileId The ID of the file to use for this request
2169
+ * @param {*} [options] Override http request option.
2170
+ * @throws {RequiredError}
2171
+ * @memberof OpenAIApi
2172
+ */
2173
+ public deleteFile(fileId: string, options?: AxiosRequestConfig) {
2174
+ return OpenAIApiFp(this.configuration).deleteFile(fileId, options).then((request) => request(this.axios, this.basePath));
2175
+ }
2176
+
2177
+ /**
2178
+ *
2179
+ * @summary Returns the contents of the specified file
2180
+ * @param {string} fileId The ID of the file to use for this request
2181
+ * @param {*} [options] Override http request option.
2182
+ * @throws {RequiredError}
2183
+ * @memberof OpenAIApi
2184
+ */
2185
+ public downloadFile(fileId: string, options?: AxiosRequestConfig) {
2186
+ return OpenAIApiFp(this.configuration).downloadFile(fileId, options).then((request) => request(this.axios, this.basePath));
2187
+ }
2188
+
2189
+ /**
2190
+ *
2191
+ * @summary Lists the currently available engines, and provides basic information about each one such as the owner and availability.
2192
+ * @param {*} [options] Override http request option.
2193
+ * @throws {RequiredError}
2194
+ * @memberof OpenAIApi
2195
+ */
2196
+ public listEngines(options?: AxiosRequestConfig) {
2197
+ return OpenAIApiFp(this.configuration).listEngines(options).then((request) => request(this.axios, this.basePath));
2198
+ }
2199
+
2200
+ /**
2201
+ *
2202
+ * @summary Returns a list of files that belong to the user\'s organization.
2203
+ * @param {*} [options] Override http request option.
2204
+ * @throws {RequiredError}
2205
+ * @memberof OpenAIApi
2206
+ */
2207
+ public listFiles(options?: AxiosRequestConfig) {
2208
+ return OpenAIApiFp(this.configuration).listFiles(options).then((request) => request(this.axios, this.basePath));
2209
+ }
2210
+
2211
+ /**
2212
+ *
2213
+ * @summary Get fine-grained status updates for a fine-tune job.
2214
+ * @param {string} fineTuneId The ID of the fine-tune job to get events for.
2215
+ * @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.
2216
+ * @param {*} [options] Override http request option.
2217
+ * @throws {RequiredError}
2218
+ * @memberof OpenAIApi
2219
+ */
2220
+ public listFineTuneEvents(fineTuneId: string, stream?: boolean, options?: AxiosRequestConfig) {
2221
+ return OpenAIApiFp(this.configuration).listFineTuneEvents(fineTuneId, stream, options).then((request) => request(this.axios, this.basePath));
2222
+ }
2223
+
2224
+ /**
2225
+ *
2226
+ * @summary List your organization\'s fine-tuning jobs
2227
+ * @param {*} [options] Override http request option.
2228
+ * @throws {RequiredError}
2229
+ * @memberof OpenAIApi
2230
+ */
2231
+ public listFineTunes(options?: AxiosRequestConfig) {
2232
+ return OpenAIApiFp(this.configuration).listFineTunes(options).then((request) => request(this.axios, this.basePath));
2233
+ }
2234
+
2235
+ /**
2236
+ *
2237
+ * @summary Retrieves an engine instance, providing basic information about the engine such as the owner and availability.
2238
+ * @param {string} engineId The ID of the engine to use for this request
2239
+ * @param {*} [options] Override http request option.
2240
+ * @throws {RequiredError}
2241
+ * @memberof OpenAIApi
2242
+ */
2243
+ public retrieveEngine(engineId: string, options?: AxiosRequestConfig) {
2244
+ return OpenAIApiFp(this.configuration).retrieveEngine(engineId, options).then((request) => request(this.axios, this.basePath));
2245
+ }
2246
+
2247
+ /**
2248
+ *
2249
+ * @summary Returns information about a specific file.
2250
+ * @param {string} fileId The ID of the file to use for this request
2251
+ * @param {*} [options] Override http request option.
2252
+ * @throws {RequiredError}
2253
+ * @memberof OpenAIApi
2254
+ */
2255
+ public retrieveFile(fileId: string, options?: AxiosRequestConfig) {
2256
+ return OpenAIApiFp(this.configuration).retrieveFile(fileId, options).then((request) => request(this.axios, this.basePath));
2257
+ }
2258
+
2259
+ /**
2260
+ *
2261
+ * @summary Gets info about the fine-tune job. [Learn more about Fine-tuning](/docs/guides/fine-tuning)
2262
+ * @param {string} fineTuneId The ID of the fine-tune job
2263
+ * @param {*} [options] Override http request option.
2264
+ * @throws {RequiredError}
2265
+ * @memberof OpenAIApi
2266
+ */
2267
+ public retrieveFineTune(fineTuneId: string, options?: AxiosRequestConfig) {
2268
+ return OpenAIApiFp(this.configuration).retrieveFineTune(fineTuneId, options).then((request) => request(this.axios, this.basePath));
2269
+ }
2270
+ }
2271
+
2272
+