@@ -6,43 +6,79 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter
6
6
import com.fasterxml.jackson.annotation.JsonAnySetter
7
7
import com.fasterxml.jackson.annotation.JsonCreator
8
8
import com.fasterxml.jackson.annotation.JsonProperty
9
- import com.fasterxml.jackson.databind.annotation.JsonDeserialize
10
9
import com.openai.core.Enum
11
10
import com.openai.core.ExcludeMissing
12
11
import com.openai.core.JsonField
13
12
import com.openai.core.JsonMissing
14
13
import com.openai.core.JsonValue
15
14
import com.openai.core.NoAutoDetect
15
+ import com.openai.core.immutableEmptyMap
16
16
import com.openai.core.toImmutable
17
17
import com.openai.errors.OpenAIInvalidDataException
18
18
import java.util.Objects
19
19
import java.util.Optional
20
20
21
- @JsonDeserialize(builder = Batch .Builder ::class )
22
21
@NoAutoDetect
23
22
class Batch
23
+ @JsonCreator
24
24
private constructor (
25
- private val id: JsonField <String >,
26
- private val object_: JsonField <Object >,
27
- private val endpoint: JsonField <String >,
28
- private val errors: JsonField <Errors >,
29
- private val inputFileId: JsonField <String >,
30
- private val completionWindow: JsonField <String >,
31
- private val status: JsonField <Status >,
32
- private val outputFileId: JsonField <String >,
33
- private val errorFileId: JsonField <String >,
34
- private val createdAt: JsonField <Long >,
35
- private val inProgressAt: JsonField <Long >,
36
- private val expiresAt: JsonField <Long >,
37
- private val finalizingAt: JsonField <Long >,
38
- private val completedAt: JsonField <Long >,
39
- private val failedAt: JsonField <Long >,
40
- private val expiredAt: JsonField <Long >,
41
- private val cancellingAt: JsonField <Long >,
42
- private val cancelledAt: JsonField <Long >,
43
- private val requestCounts: JsonField <BatchRequestCounts >,
44
- private val metadata: JsonValue ,
45
- private val additionalProperties: Map <String , JsonValue >,
25
+ @JsonProperty(" id" ) @ExcludeMissing private val id: JsonField <String > = JsonMissing .of(),
26
+ @JsonProperty(" object" )
27
+ @ExcludeMissing
28
+ private val object_: JsonField <Object > = JsonMissing .of(),
29
+ @JsonProperty(" endpoint" )
30
+ @ExcludeMissing
31
+ private val endpoint: JsonField <String > = JsonMissing .of(),
32
+ @JsonProperty(" errors" )
33
+ @ExcludeMissing
34
+ private val errors: JsonField <Errors > = JsonMissing .of(),
35
+ @JsonProperty(" input_file_id" )
36
+ @ExcludeMissing
37
+ private val inputFileId: JsonField <String > = JsonMissing .of(),
38
+ @JsonProperty(" completion_window" )
39
+ @ExcludeMissing
40
+ private val completionWindow: JsonField <String > = JsonMissing .of(),
41
+ @JsonProperty(" status" )
42
+ @ExcludeMissing
43
+ private val status: JsonField <Status > = JsonMissing .of(),
44
+ @JsonProperty(" output_file_id" )
45
+ @ExcludeMissing
46
+ private val outputFileId: JsonField <String > = JsonMissing .of(),
47
+ @JsonProperty(" error_file_id" )
48
+ @ExcludeMissing
49
+ private val errorFileId: JsonField <String > = JsonMissing .of(),
50
+ @JsonProperty(" created_at" )
51
+ @ExcludeMissing
52
+ private val createdAt: JsonField <Long > = JsonMissing .of(),
53
+ @JsonProperty(" in_progress_at" )
54
+ @ExcludeMissing
55
+ private val inProgressAt: JsonField <Long > = JsonMissing .of(),
56
+ @JsonProperty(" expires_at" )
57
+ @ExcludeMissing
58
+ private val expiresAt: JsonField <Long > = JsonMissing .of(),
59
+ @JsonProperty(" finalizing_at" )
60
+ @ExcludeMissing
61
+ private val finalizingAt: JsonField <Long > = JsonMissing .of(),
62
+ @JsonProperty(" completed_at" )
63
+ @ExcludeMissing
64
+ private val completedAt: JsonField <Long > = JsonMissing .of(),
65
+ @JsonProperty(" failed_at" )
66
+ @ExcludeMissing
67
+ private val failedAt: JsonField <Long > = JsonMissing .of(),
68
+ @JsonProperty(" expired_at" )
69
+ @ExcludeMissing
70
+ private val expiredAt: JsonField <Long > = JsonMissing .of(),
71
+ @JsonProperty(" cancelling_at" )
72
+ @ExcludeMissing
73
+ private val cancellingAt: JsonField <Long > = JsonMissing .of(),
74
+ @JsonProperty(" cancelled_at" )
75
+ @ExcludeMissing
76
+ private val cancelledAt: JsonField <Long > = JsonMissing .of(),
77
+ @JsonProperty(" request_counts" )
78
+ @ExcludeMissing
79
+ private val requestCounts: JsonField <BatchRequestCounts > = JsonMissing .of(),
80
+ @JsonProperty(" metadata" ) @ExcludeMissing private val metadata: JsonValue = JsonMissing .of(),
81
+ @JsonAnySetter private val additionalProperties: Map <String , JsonValue > = immutableEmptyMap(),
46
82
) {
47
83
48
84
fun id (): String = id.getRequired(" id" )
@@ -257,45 +293,35 @@ private constructor(
257
293
258
294
fun id (id : String ) = id(JsonField .of(id))
259
295
260
- @JsonProperty( " id " ) @ExcludeMissing fun id (id : JsonField <String >) = apply { this .id = id }
296
+ fun id (id : JsonField <String >) = apply { this .id = id }
261
297
262
298
/* * The object type, which is always `batch`. */
263
299
fun object_ (object_ : Object ) = object_(JsonField .of(object_))
264
300
265
301
/* * The object type, which is always `batch`. */
266
- @JsonProperty(" object" )
267
- @ExcludeMissing
268
302
fun object_ (object_ : JsonField <Object >) = apply { this .object_ = object_ }
269
303
270
304
/* * The OpenAI API endpoint used by the batch. */
271
305
fun endpoint (endpoint : String ) = endpoint(JsonField .of(endpoint))
272
306
273
307
/* * The OpenAI API endpoint used by the batch. */
274
- @JsonProperty(" endpoint" )
275
- @ExcludeMissing
276
308
fun endpoint (endpoint : JsonField <String >) = apply { this .endpoint = endpoint }
277
309
278
310
fun errors (errors : Errors ) = errors(JsonField .of(errors))
279
311
280
- @JsonProperty(" errors" )
281
- @ExcludeMissing
282
312
fun errors (errors : JsonField <Errors >) = apply { this .errors = errors }
283
313
284
314
/* * The ID of the input file for the batch. */
285
315
fun inputFileId (inputFileId : String ) = inputFileId(JsonField .of(inputFileId))
286
316
287
317
/* * The ID of the input file for the batch. */
288
- @JsonProperty(" input_file_id" )
289
- @ExcludeMissing
290
318
fun inputFileId (inputFileId : JsonField <String >) = apply { this .inputFileId = inputFileId }
291
319
292
320
/* * The time frame within which the batch should be processed. */
293
321
fun completionWindow (completionWindow : String ) =
294
322
completionWindow(JsonField .of(completionWindow))
295
323
296
324
/* * The time frame within which the batch should be processed. */
297
- @JsonProperty(" completion_window" )
298
- @ExcludeMissing
299
325
fun completionWindow (completionWindow : JsonField <String >) = apply {
300
326
this .completionWindow = completionWindow
301
327
}
@@ -304,16 +330,12 @@ private constructor(
304
330
fun status (status : Status ) = status(JsonField .of(status))
305
331
306
332
/* * The current status of the batch. */
307
- @JsonProperty(" status" )
308
- @ExcludeMissing
309
333
fun status (status : JsonField <Status >) = apply { this .status = status }
310
334
311
335
/* * The ID of the file containing the outputs of successfully executed requests. */
312
336
fun outputFileId (outputFileId : String ) = outputFileId(JsonField .of(outputFileId))
313
337
314
338
/* * The ID of the file containing the outputs of successfully executed requests. */
315
- @JsonProperty(" output_file_id" )
316
- @ExcludeMissing
317
339
fun outputFileId (outputFileId : JsonField <String >) = apply {
318
340
this .outputFileId = outputFileId
319
341
}
@@ -322,89 +344,67 @@ private constructor(
322
344
fun errorFileId (errorFileId : String ) = errorFileId(JsonField .of(errorFileId))
323
345
324
346
/* * The ID of the file containing the outputs of requests with errors. */
325
- @JsonProperty(" error_file_id" )
326
- @ExcludeMissing
327
347
fun errorFileId (errorFileId : JsonField <String >) = apply { this .errorFileId = errorFileId }
328
348
329
349
/* * The Unix timestamp (in seconds) for when the batch was created. */
330
350
fun createdAt (createdAt : Long ) = createdAt(JsonField .of(createdAt))
331
351
332
352
/* * The Unix timestamp (in seconds) for when the batch was created. */
333
- @JsonProperty(" created_at" )
334
- @ExcludeMissing
335
353
fun createdAt (createdAt : JsonField <Long >) = apply { this .createdAt = createdAt }
336
354
337
355
/* * The Unix timestamp (in seconds) for when the batch started processing. */
338
356
fun inProgressAt (inProgressAt : Long ) = inProgressAt(JsonField .of(inProgressAt))
339
357
340
358
/* * The Unix timestamp (in seconds) for when the batch started processing. */
341
- @JsonProperty(" in_progress_at" )
342
- @ExcludeMissing
343
359
fun inProgressAt (inProgressAt : JsonField <Long >) = apply { this .inProgressAt = inProgressAt }
344
360
345
361
/* * The Unix timestamp (in seconds) for when the batch will expire. */
346
362
fun expiresAt (expiresAt : Long ) = expiresAt(JsonField .of(expiresAt))
347
363
348
364
/* * The Unix timestamp (in seconds) for when the batch will expire. */
349
- @JsonProperty(" expires_at" )
350
- @ExcludeMissing
351
365
fun expiresAt (expiresAt : JsonField <Long >) = apply { this .expiresAt = expiresAt }
352
366
353
367
/* * The Unix timestamp (in seconds) for when the batch started finalizing. */
354
368
fun finalizingAt (finalizingAt : Long ) = finalizingAt(JsonField .of(finalizingAt))
355
369
356
370
/* * The Unix timestamp (in seconds) for when the batch started finalizing. */
357
- @JsonProperty(" finalizing_at" )
358
- @ExcludeMissing
359
371
fun finalizingAt (finalizingAt : JsonField <Long >) = apply { this .finalizingAt = finalizingAt }
360
372
361
373
/* * The Unix timestamp (in seconds) for when the batch was completed. */
362
374
fun completedAt (completedAt : Long ) = completedAt(JsonField .of(completedAt))
363
375
364
376
/* * The Unix timestamp (in seconds) for when the batch was completed. */
365
- @JsonProperty(" completed_at" )
366
- @ExcludeMissing
367
377
fun completedAt (completedAt : JsonField <Long >) = apply { this .completedAt = completedAt }
368
378
369
379
/* * The Unix timestamp (in seconds) for when the batch failed. */
370
380
fun failedAt (failedAt : Long ) = failedAt(JsonField .of(failedAt))
371
381
372
382
/* * The Unix timestamp (in seconds) for when the batch failed. */
373
- @JsonProperty(" failed_at" )
374
- @ExcludeMissing
375
383
fun failedAt (failedAt : JsonField <Long >) = apply { this .failedAt = failedAt }
376
384
377
385
/* * The Unix timestamp (in seconds) for when the batch expired. */
378
386
fun expiredAt (expiredAt : Long ) = expiredAt(JsonField .of(expiredAt))
379
387
380
388
/* * The Unix timestamp (in seconds) for when the batch expired. */
381
- @JsonProperty(" expired_at" )
382
- @ExcludeMissing
383
389
fun expiredAt (expiredAt : JsonField <Long >) = apply { this .expiredAt = expiredAt }
384
390
385
391
/* * The Unix timestamp (in seconds) for when the batch started cancelling. */
386
392
fun cancellingAt (cancellingAt : Long ) = cancellingAt(JsonField .of(cancellingAt))
387
393
388
394
/* * The Unix timestamp (in seconds) for when the batch started cancelling. */
389
- @JsonProperty(" cancelling_at" )
390
- @ExcludeMissing
391
395
fun cancellingAt (cancellingAt : JsonField <Long >) = apply { this .cancellingAt = cancellingAt }
392
396
393
397
/* * The Unix timestamp (in seconds) for when the batch was cancelled. */
394
398
fun cancelledAt (cancelledAt : Long ) = cancelledAt(JsonField .of(cancelledAt))
395
399
396
400
/* * The Unix timestamp (in seconds) for when the batch was cancelled. */
397
- @JsonProperty(" cancelled_at" )
398
- @ExcludeMissing
399
401
fun cancelledAt (cancelledAt : JsonField <Long >) = apply { this .cancelledAt = cancelledAt }
400
402
401
403
/* * The request counts for different statuses within the batch. */
402
404
fun requestCounts (requestCounts : BatchRequestCounts ) =
403
405
requestCounts(JsonField .of(requestCounts))
404
406
405
407
/* * The request counts for different statuses within the batch. */
406
- @JsonProperty(" request_counts" )
407
- @ExcludeMissing
408
408
fun requestCounts (requestCounts : JsonField <BatchRequestCounts >) = apply {
409
409
this .requestCounts = requestCounts
410
410
}
@@ -414,16 +414,13 @@ private constructor(
414
414
* storing additional information about the object in a structured format. Keys can be a
415
415
* maximum of 64 characters long and values can be a maximum of 512 characters long.
416
416
*/
417
- @JsonProperty(" metadata" )
418
- @ExcludeMissing
419
417
fun metadata (metadata : JsonValue ) = apply { this .metadata = metadata }
420
418
421
419
fun additionalProperties (additionalProperties : Map <String , JsonValue >) = apply {
422
420
this .additionalProperties.clear()
423
421
putAllAdditionalProperties(additionalProperties)
424
422
}
425
423
426
- @JsonAnySetter
427
424
fun putAdditionalProperty (key : String , value : JsonValue ) = apply {
428
425
additionalProperties.put(key, value)
429
426
}
@@ -608,13 +605,18 @@ private constructor(
608
605
override fun toString () = value.toString()
609
606
}
610
607
611
- @JsonDeserialize(builder = Errors .Builder ::class )
612
608
@NoAutoDetect
613
609
class Errors
610
+ @JsonCreator
614
611
private constructor (
615
- private val object_: JsonField <String >,
616
- private val data: JsonField <List <BatchError >>,
617
- private val additionalProperties: Map <String , JsonValue >,
612
+ @JsonProperty(" object" )
613
+ @ExcludeMissing
614
+ private val object_: JsonField <String > = JsonMissing .of(),
615
+ @JsonProperty(" data" )
616
+ @ExcludeMissing
617
+ private val data: JsonField <List <BatchError >> = JsonMissing .of(),
618
+ @JsonAnySetter
619
+ private val additionalProperties: Map <String , JsonValue > = immutableEmptyMap(),
618
620
) {
619
621
620
622
/* * The object type, which is always `list`. */
@@ -665,22 +667,17 @@ private constructor(
665
667
fun object_ (object_ : String ) = object_(JsonField .of(object_))
666
668
667
669
/* * The object type, which is always `list`. */
668
- @JsonProperty(" object" )
669
- @ExcludeMissing
670
670
fun object_ (object_ : JsonField <String >) = apply { this .object_ = object_ }
671
671
672
672
fun data (data : List <BatchError >) = data(JsonField .of(data))
673
673
674
- @JsonProperty(" data" )
675
- @ExcludeMissing
676
674
fun data (data : JsonField <List <BatchError >>) = apply { this .data = data }
677
675
678
676
fun additionalProperties (additionalProperties : Map <String , JsonValue >) = apply {
679
677
this .additionalProperties.clear()
680
678
putAllAdditionalProperties(additionalProperties)
681
679
}
682
680
683
- @JsonAnySetter
684
681
fun putAdditionalProperty (key : String , value : JsonValue ) = apply {
685
682
additionalProperties.put(key, value)
686
683
}
0 commit comments