2
2
3
3
package com.openai.models.audio.translations
4
4
5
+ import com.fasterxml.jackson.annotation.JsonAnyGetter
6
+ import com.fasterxml.jackson.annotation.JsonAnySetter
5
7
import com.fasterxml.jackson.annotation.JsonCreator
6
8
import com.fasterxml.jackson.annotation.JsonProperty
7
9
import com.openai.core.Enum
8
10
import com.openai.core.ExcludeMissing
9
11
import com.openai.core.JsonField
12
+ import com.openai.core.JsonValue
10
13
import com.openai.core.MultipartField
11
14
import com.openai.core.Params
12
15
import com.openai.core.checkRequired
@@ -17,6 +20,7 @@ import com.openai.errors.OpenAIInvalidDataException
17
20
import com.openai.models.audio.AudioModel
18
21
import java.io.InputStream
19
22
import java.nio.file.Path
23
+ import java.util.Collections
20
24
import java.util.Objects
21
25
import java.util.Optional
22
26
import kotlin.io.path.inputStream
@@ -115,6 +119,8 @@ private constructor(
115
119
*/
116
120
fun _temperature (): MultipartField <Double > = body._temperature ()
117
121
122
+ fun _additionalBodyProperties (): Map <String , JsonValue > = body._additionalProperties ()
123
+
118
124
fun _additionalHeaders (): Headers = additionalHeaders
119
125
120
126
fun _additionalQueryParams (): QueryParams = additionalQueryParams
@@ -267,6 +273,25 @@ private constructor(
267
273
body.temperature(temperature)
268
274
}
269
275
276
+ fun additionalBodyProperties (additionalBodyProperties : Map <String , JsonValue >) = apply {
277
+ body.additionalProperties(additionalBodyProperties)
278
+ }
279
+
280
+ fun putAdditionalBodyProperty (key : String , value : JsonValue ) = apply {
281
+ body.putAdditionalProperty(key, value)
282
+ }
283
+
284
+ fun putAllAdditionalBodyProperties (additionalBodyProperties : Map <String , JsonValue >) =
285
+ apply {
286
+ body.putAllAdditionalProperties(additionalBodyProperties)
287
+ }
288
+
289
+ fun removeAdditionalBodyProperty (key : String ) = apply { body.removeAdditionalProperty(key) }
290
+
291
+ fun removeAllAdditionalBodyProperties (keys : Set <String >) = apply {
292
+ body.removeAllAdditionalProperties(keys)
293
+ }
294
+
270
295
fun additionalHeaders (additionalHeaders : Headers ) = apply {
271
296
this .additionalHeaders.clear()
272
297
putAllAdditionalHeaders(additionalHeaders)
@@ -387,13 +412,13 @@ private constructor(
387
412
}
388
413
389
414
fun _body (): Map <String , MultipartField <* >> =
390
- mapOf (
415
+ ( mapOf (
391
416
" file" to _file (),
392
417
" model" to _model (),
393
418
" prompt" to _prompt (),
394
419
" response_format" to _responseFormat (),
395
420
" temperature" to _temperature (),
396
- )
421
+ ) + _additionalBodyProperties ().mapValues { MultipartField .of(it) })
397
422
.toImmutable()
398
423
399
424
override fun _headers (): Headers = additionalHeaders
@@ -407,6 +432,7 @@ private constructor(
407
432
private val prompt: MultipartField <String >,
408
433
private val responseFormat: MultipartField <ResponseFormat >,
409
434
private val temperature: MultipartField <Double >,
435
+ private val additionalProperties: MutableMap <String , JsonValue >,
410
436
) {
411
437
412
438
/* *
@@ -500,6 +526,16 @@ private constructor(
500
526
@ExcludeMissing
501
527
fun _temperature (): MultipartField <Double > = temperature
502
528
529
+ @JsonAnySetter
530
+ private fun putAdditionalProperty (key : String , value : JsonValue ) {
531
+ additionalProperties.put(key, value)
532
+ }
533
+
534
+ @JsonAnyGetter
535
+ @ExcludeMissing
536
+ fun _additionalProperties (): Map <String , JsonValue > =
537
+ Collections .unmodifiableMap(additionalProperties)
538
+
503
539
fun toBuilder () = Builder ().from(this )
504
540
505
541
companion object {
@@ -524,6 +560,7 @@ private constructor(
524
560
private var prompt: MultipartField <String > = MultipartField .of(null )
525
561
private var responseFormat: MultipartField <ResponseFormat > = MultipartField .of(null )
526
562
private var temperature: MultipartField <Double > = MultipartField .of(null )
563
+ private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
527
564
528
565
@JvmSynthetic
529
566
internal fun from (body : Body ) = apply {
@@ -532,6 +569,7 @@ private constructor(
532
569
prompt = body.prompt
533
570
responseFormat = body.responseFormat
534
571
temperature = body.temperature
572
+ additionalProperties = body.additionalProperties.toMutableMap()
535
573
}
536
574
537
575
/* *
@@ -645,6 +683,25 @@ private constructor(
645
683
this .temperature = temperature
646
684
}
647
685
686
+ fun additionalProperties (additionalProperties : Map <String , JsonValue >) = apply {
687
+ this .additionalProperties.clear()
688
+ putAllAdditionalProperties(additionalProperties)
689
+ }
690
+
691
+ fun putAdditionalProperty (key : String , value : JsonValue ) = apply {
692
+ additionalProperties.put(key, value)
693
+ }
694
+
695
+ fun putAllAdditionalProperties (additionalProperties : Map <String , JsonValue >) = apply {
696
+ this .additionalProperties.putAll(additionalProperties)
697
+ }
698
+
699
+ fun removeAdditionalProperty (key : String ) = apply { additionalProperties.remove(key) }
700
+
701
+ fun removeAllAdditionalProperties (keys : Set <String >) = apply {
702
+ keys.forEach(::removeAdditionalProperty)
703
+ }
704
+
648
705
/* *
649
706
* Returns an immutable instance of [Body].
650
707
*
@@ -665,6 +722,7 @@ private constructor(
665
722
prompt,
666
723
responseFormat,
667
724
temperature,
725
+ additionalProperties.toMutableMap(),
668
726
)
669
727
}
670
728
@@ -696,17 +754,17 @@ private constructor(
696
754
return true
697
755
}
698
756
699
- return /* spotless:off */ other is Body && file == other.file && model == other.model && prompt == other.prompt && responseFormat == other.responseFormat && temperature == other.temperature /* spotless:on */
757
+ return /* spotless:off */ other is Body && file == other.file && model == other.model && prompt == other.prompt && responseFormat == other.responseFormat && temperature == other.temperature && additionalProperties == other.additionalProperties /* spotless:on */
700
758
}
701
759
702
760
/* spotless:off */
703
- private val hashCode: Int by lazy { Objects .hash(file, model, prompt, responseFormat, temperature) }
761
+ private val hashCode: Int by lazy { Objects .hash(file, model, prompt, responseFormat, temperature, additionalProperties ) }
704
762
/* spotless:on */
705
763
706
764
override fun hashCode (): Int = hashCode
707
765
708
766
override fun toString () =
709
- " Body{file=$file , model=$model , prompt=$prompt , responseFormat=$responseFormat , temperature=$temperature }"
767
+ " Body{file=$file , model=$model , prompt=$prompt , responseFormat=$responseFormat , temperature=$temperature , additionalProperties= $additionalProperties }"
710
768
}
711
769
712
770
/* *
0 commit comments