Skip to content

Commit 6cdb671

Browse files
refactor(client)!: change precision of some numeric types
1 parent f623bca commit 6cdb671

13 files changed

+172
-170
lines changed

openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionSegment.kt

+48-48
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import kotlin.jvm.optionals.getOrNull
2121
class TranscriptionSegment
2222
private constructor(
2323
private val id: JsonField<Long>,
24-
private val avgLogprob: JsonField<Double>,
25-
private val compressionRatio: JsonField<Double>,
26-
private val end: JsonField<Double>,
27-
private val noSpeechProb: JsonField<Double>,
24+
private val avgLogprob: JsonField<Float>,
25+
private val compressionRatio: JsonField<Float>,
26+
private val end: JsonField<Float>,
27+
private val noSpeechProb: JsonField<Float>,
2828
private val seek: JsonField<Long>,
29-
private val start: JsonField<Double>,
30-
private val temperature: JsonField<Double>,
29+
private val start: JsonField<Float>,
30+
private val temperature: JsonField<Float>,
3131
private val text: JsonField<String>,
3232
private val tokens: JsonField<List<Long>>,
3333
private val additionalProperties: MutableMap<String, JsonValue>,
@@ -38,19 +38,19 @@ private constructor(
3838
@JsonProperty("id") @ExcludeMissing id: JsonField<Long> = JsonMissing.of(),
3939
@JsonProperty("avg_logprob")
4040
@ExcludeMissing
41-
avgLogprob: JsonField<Double> = JsonMissing.of(),
41+
avgLogprob: JsonField<Float> = JsonMissing.of(),
4242
@JsonProperty("compression_ratio")
4343
@ExcludeMissing
44-
compressionRatio: JsonField<Double> = JsonMissing.of(),
45-
@JsonProperty("end") @ExcludeMissing end: JsonField<Double> = JsonMissing.of(),
44+
compressionRatio: JsonField<Float> = JsonMissing.of(),
45+
@JsonProperty("end") @ExcludeMissing end: JsonField<Float> = JsonMissing.of(),
4646
@JsonProperty("no_speech_prob")
4747
@ExcludeMissing
48-
noSpeechProb: JsonField<Double> = JsonMissing.of(),
48+
noSpeechProb: JsonField<Float> = JsonMissing.of(),
4949
@JsonProperty("seek") @ExcludeMissing seek: JsonField<Long> = JsonMissing.of(),
50-
@JsonProperty("start") @ExcludeMissing start: JsonField<Double> = JsonMissing.of(),
50+
@JsonProperty("start") @ExcludeMissing start: JsonField<Float> = JsonMissing.of(),
5151
@JsonProperty("temperature")
5252
@ExcludeMissing
53-
temperature: JsonField<Double> = JsonMissing.of(),
53+
temperature: JsonField<Float> = JsonMissing.of(),
5454
@JsonProperty("text") @ExcludeMissing text: JsonField<String> = JsonMissing.of(),
5555
@JsonProperty("tokens") @ExcludeMissing tokens: JsonField<List<Long>> = JsonMissing.of(),
5656
) : this(
@@ -81,7 +81,7 @@ private constructor(
8181
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
8282
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
8383
*/
84-
fun avgLogprob(): Double = avgLogprob.getRequired("avg_logprob")
84+
fun avgLogprob(): Float = avgLogprob.getRequired("avg_logprob")
8585

8686
/**
8787
* Compression ratio of the segment. If the value is greater than 2.4, consider the compression
@@ -90,15 +90,15 @@ private constructor(
9090
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
9191
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
9292
*/
93-
fun compressionRatio(): Double = compressionRatio.getRequired("compression_ratio")
93+
fun compressionRatio(): Float = compressionRatio.getRequired("compression_ratio")
9494

9595
/**
9696
* End time of the segment in seconds.
9797
*
9898
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
9999
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
100100
*/
101-
fun end(): Double = end.getRequired("end")
101+
fun end(): Float = end.getRequired("end")
102102

103103
/**
104104
* Probability of no speech in the segment. If the value is higher than 1.0 and the
@@ -107,7 +107,7 @@ private constructor(
107107
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
108108
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
109109
*/
110-
fun noSpeechProb(): Double = noSpeechProb.getRequired("no_speech_prob")
110+
fun noSpeechProb(): Float = noSpeechProb.getRequired("no_speech_prob")
111111

112112
/**
113113
* Seek offset of the segment.
@@ -123,15 +123,15 @@ private constructor(
123123
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
124124
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
125125
*/
126-
fun start(): Double = start.getRequired("start")
126+
fun start(): Float = start.getRequired("start")
127127

128128
/**
129129
* Temperature parameter used for generating the segment.
130130
*
131131
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
132132
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
133133
*/
134-
fun temperature(): Double = temperature.getRequired("temperature")
134+
fun temperature(): Float = temperature.getRequired("temperature")
135135

136136
/**
137137
* Text content of the segment.
@@ -161,7 +161,7 @@ private constructor(
161161
*
162162
* Unlike [avgLogprob], this method doesn't throw if the JSON field has an unexpected type.
163163
*/
164-
@JsonProperty("avg_logprob") @ExcludeMissing fun _avgLogprob(): JsonField<Double> = avgLogprob
164+
@JsonProperty("avg_logprob") @ExcludeMissing fun _avgLogprob(): JsonField<Float> = avgLogprob
165165

166166
/**
167167
* Returns the raw JSON value of [compressionRatio].
@@ -171,14 +171,14 @@ private constructor(
171171
*/
172172
@JsonProperty("compression_ratio")
173173
@ExcludeMissing
174-
fun _compressionRatio(): JsonField<Double> = compressionRatio
174+
fun _compressionRatio(): JsonField<Float> = compressionRatio
175175

176176
/**
177177
* Returns the raw JSON value of [end].
178178
*
179179
* Unlike [end], this method doesn't throw if the JSON field has an unexpected type.
180180
*/
181-
@JsonProperty("end") @ExcludeMissing fun _end(): JsonField<Double> = end
181+
@JsonProperty("end") @ExcludeMissing fun _end(): JsonField<Float> = end
182182

183183
/**
184184
* Returns the raw JSON value of [noSpeechProb].
@@ -187,7 +187,7 @@ private constructor(
187187
*/
188188
@JsonProperty("no_speech_prob")
189189
@ExcludeMissing
190-
fun _noSpeechProb(): JsonField<Double> = noSpeechProb
190+
fun _noSpeechProb(): JsonField<Float> = noSpeechProb
191191

192192
/**
193193
* Returns the raw JSON value of [seek].
@@ -201,14 +201,14 @@ private constructor(
201201
*
202202
* Unlike [start], this method doesn't throw if the JSON field has an unexpected type.
203203
*/
204-
@JsonProperty("start") @ExcludeMissing fun _start(): JsonField<Double> = start
204+
@JsonProperty("start") @ExcludeMissing fun _start(): JsonField<Float> = start
205205

206206
/**
207207
* Returns the raw JSON value of [temperature].
208208
*
209209
* Unlike [temperature], this method doesn't throw if the JSON field has an unexpected type.
210210
*/
211-
@JsonProperty("temperature") @ExcludeMissing fun _temperature(): JsonField<Double> = temperature
211+
@JsonProperty("temperature") @ExcludeMissing fun _temperature(): JsonField<Float> = temperature
212212

213213
/**
214214
* Returns the raw JSON value of [text].
@@ -262,13 +262,13 @@ private constructor(
262262
class Builder internal constructor() {
263263

264264
private var id: JsonField<Long>? = null
265-
private var avgLogprob: JsonField<Double>? = null
266-
private var compressionRatio: JsonField<Double>? = null
267-
private var end: JsonField<Double>? = null
268-
private var noSpeechProb: JsonField<Double>? = null
265+
private var avgLogprob: JsonField<Float>? = null
266+
private var compressionRatio: JsonField<Float>? = null
267+
private var end: JsonField<Float>? = null
268+
private var noSpeechProb: JsonField<Float>? = null
269269
private var seek: JsonField<Long>? = null
270-
private var start: JsonField<Double>? = null
271-
private var temperature: JsonField<Double>? = null
270+
private var start: JsonField<Float>? = null
271+
private var temperature: JsonField<Float>? = null
272272
private var text: JsonField<String>? = null
273273
private var tokens: JsonField<MutableList<Long>>? = null
274274
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -303,60 +303,60 @@ private constructor(
303303
* Average logprob of the segment. If the value is lower than -1, consider the logprobs
304304
* failed.
305305
*/
306-
fun avgLogprob(avgLogprob: Double) = avgLogprob(JsonField.of(avgLogprob))
306+
fun avgLogprob(avgLogprob: Float) = avgLogprob(JsonField.of(avgLogprob))
307307

308308
/**
309309
* Sets [Builder.avgLogprob] to an arbitrary JSON value.
310310
*
311-
* You should usually call [Builder.avgLogprob] with a well-typed [Double] value instead.
311+
* You should usually call [Builder.avgLogprob] with a well-typed [Float] value instead.
312312
* This method is primarily for setting the field to an undocumented or not yet supported
313313
* value.
314314
*/
315-
fun avgLogprob(avgLogprob: JsonField<Double>) = apply { this.avgLogprob = avgLogprob }
315+
fun avgLogprob(avgLogprob: JsonField<Float>) = apply { this.avgLogprob = avgLogprob }
316316

317317
/**
318318
* Compression ratio of the segment. If the value is greater than 2.4, consider the
319319
* compression failed.
320320
*/
321-
fun compressionRatio(compressionRatio: Double) =
321+
fun compressionRatio(compressionRatio: Float) =
322322
compressionRatio(JsonField.of(compressionRatio))
323323

324324
/**
325325
* Sets [Builder.compressionRatio] to an arbitrary JSON value.
326326
*
327-
* You should usually call [Builder.compressionRatio] with a well-typed [Double] value
327+
* You should usually call [Builder.compressionRatio] with a well-typed [Float] value
328328
* instead. This method is primarily for setting the field to an undocumented or not yet
329329
* supported value.
330330
*/
331-
fun compressionRatio(compressionRatio: JsonField<Double>) = apply {
331+
fun compressionRatio(compressionRatio: JsonField<Float>) = apply {
332332
this.compressionRatio = compressionRatio
333333
}
334334

335335
/** End time of the segment in seconds. */
336-
fun end(end: Double) = end(JsonField.of(end))
336+
fun end(end: Float) = end(JsonField.of(end))
337337

338338
/**
339339
* Sets [Builder.end] to an arbitrary JSON value.
340340
*
341-
* You should usually call [Builder.end] with a well-typed [Double] value instead. This
341+
* You should usually call [Builder.end] with a well-typed [Float] value instead. This
342342
* method is primarily for setting the field to an undocumented or not yet supported value.
343343
*/
344-
fun end(end: JsonField<Double>) = apply { this.end = end }
344+
fun end(end: JsonField<Float>) = apply { this.end = end }
345345

346346
/**
347347
* Probability of no speech in the segment. If the value is higher than 1.0 and the
348348
* `avg_logprob` is below -1, consider this segment silent.
349349
*/
350-
fun noSpeechProb(noSpeechProb: Double) = noSpeechProb(JsonField.of(noSpeechProb))
350+
fun noSpeechProb(noSpeechProb: Float) = noSpeechProb(JsonField.of(noSpeechProb))
351351

352352
/**
353353
* Sets [Builder.noSpeechProb] to an arbitrary JSON value.
354354
*
355-
* You should usually call [Builder.noSpeechProb] with a well-typed [Double] value instead.
355+
* You should usually call [Builder.noSpeechProb] with a well-typed [Float] value instead.
356356
* This method is primarily for setting the field to an undocumented or not yet supported
357357
* value.
358358
*/
359-
fun noSpeechProb(noSpeechProb: JsonField<Double>) = apply {
359+
fun noSpeechProb(noSpeechProb: JsonField<Float>) = apply {
360360
this.noSpeechProb = noSpeechProb
361361
}
362362

@@ -372,27 +372,27 @@ private constructor(
372372
fun seek(seek: JsonField<Long>) = apply { this.seek = seek }
373373

374374
/** Start time of the segment in seconds. */
375-
fun start(start: Double) = start(JsonField.of(start))
375+
fun start(start: Float) = start(JsonField.of(start))
376376

377377
/**
378378
* Sets [Builder.start] to an arbitrary JSON value.
379379
*
380-
* You should usually call [Builder.start] with a well-typed [Double] value instead. This
380+
* You should usually call [Builder.start] with a well-typed [Float] value instead. This
381381
* method is primarily for setting the field to an undocumented or not yet supported value.
382382
*/
383-
fun start(start: JsonField<Double>) = apply { this.start = start }
383+
fun start(start: JsonField<Float>) = apply { this.start = start }
384384

385385
/** Temperature parameter used for generating the segment. */
386-
fun temperature(temperature: Double) = temperature(JsonField.of(temperature))
386+
fun temperature(temperature: Float) = temperature(JsonField.of(temperature))
387387

388388
/**
389389
* Sets [Builder.temperature] to an arbitrary JSON value.
390390
*
391-
* You should usually call [Builder.temperature] with a well-typed [Double] value instead.
391+
* You should usually call [Builder.temperature] with a well-typed [Float] value instead.
392392
* This method is primarily for setting the field to an undocumented or not yet supported
393393
* value.
394394
*/
395-
fun temperature(temperature: JsonField<Double>) = apply { this.temperature = temperature }
395+
fun temperature(temperature: JsonField<Float>) = apply { this.temperature = temperature }
396396

397397
/** Text content of the segment. */
398398
fun text(text: String) = text(JsonField.of(text))

openai-java-core/src/main/kotlin/com/openai/models/audio/transcriptions/TranscriptionWord.kt

+16-16
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ import java.util.Objects
1717

1818
class TranscriptionWord
1919
private constructor(
20-
private val end: JsonField<Double>,
21-
private val start: JsonField<Double>,
20+
private val end: JsonField<Float>,
21+
private val start: JsonField<Float>,
2222
private val word: JsonField<String>,
2323
private val additionalProperties: MutableMap<String, JsonValue>,
2424
) {
2525

2626
@JsonCreator
2727
private constructor(
28-
@JsonProperty("end") @ExcludeMissing end: JsonField<Double> = JsonMissing.of(),
29-
@JsonProperty("start") @ExcludeMissing start: JsonField<Double> = JsonMissing.of(),
28+
@JsonProperty("end") @ExcludeMissing end: JsonField<Float> = JsonMissing.of(),
29+
@JsonProperty("start") @ExcludeMissing start: JsonField<Float> = JsonMissing.of(),
3030
@JsonProperty("word") @ExcludeMissing word: JsonField<String> = JsonMissing.of(),
3131
) : this(end, start, word, mutableMapOf())
3232

@@ -36,15 +36,15 @@ private constructor(
3636
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
3737
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
3838
*/
39-
fun end(): Double = end.getRequired("end")
39+
fun end(): Float = end.getRequired("end")
4040

4141
/**
4242
* Start time of the word in seconds.
4343
*
4444
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
4545
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
4646
*/
47-
fun start(): Double = start.getRequired("start")
47+
fun start(): Float = start.getRequired("start")
4848

4949
/**
5050
* The text content of the word.
@@ -59,14 +59,14 @@ private constructor(
5959
*
6060
* Unlike [end], this method doesn't throw if the JSON field has an unexpected type.
6161
*/
62-
@JsonProperty("end") @ExcludeMissing fun _end(): JsonField<Double> = end
62+
@JsonProperty("end") @ExcludeMissing fun _end(): JsonField<Float> = end
6363

6464
/**
6565
* Returns the raw JSON value of [start].
6666
*
6767
* Unlike [start], this method doesn't throw if the JSON field has an unexpected type.
6868
*/
69-
@JsonProperty("start") @ExcludeMissing fun _start(): JsonField<Double> = start
69+
@JsonProperty("start") @ExcludeMissing fun _start(): JsonField<Float> = start
7070

7171
/**
7272
* Returns the raw JSON value of [word].
@@ -105,8 +105,8 @@ private constructor(
105105
/** A builder for [TranscriptionWord]. */
106106
class Builder internal constructor() {
107107

108-
private var end: JsonField<Double>? = null
109-
private var start: JsonField<Double>? = null
108+
private var end: JsonField<Float>? = null
109+
private var start: JsonField<Float>? = null
110110
private var word: JsonField<String>? = null
111111
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
112112

@@ -119,26 +119,26 @@ private constructor(
119119
}
120120

121121
/** End time of the word in seconds. */
122-
fun end(end: Double) = end(JsonField.of(end))
122+
fun end(end: Float) = end(JsonField.of(end))
123123

124124
/**
125125
* Sets [Builder.end] to an arbitrary JSON value.
126126
*
127-
* You should usually call [Builder.end] with a well-typed [Double] value instead. This
127+
* You should usually call [Builder.end] with a well-typed [Float] value instead. This
128128
* method is primarily for setting the field to an undocumented or not yet supported value.
129129
*/
130-
fun end(end: JsonField<Double>) = apply { this.end = end }
130+
fun end(end: JsonField<Float>) = apply { this.end = end }
131131

132132
/** Start time of the word in seconds. */
133-
fun start(start: Double) = start(JsonField.of(start))
133+
fun start(start: Float) = start(JsonField.of(start))
134134

135135
/**
136136
* Sets [Builder.start] to an arbitrary JSON value.
137137
*
138-
* You should usually call [Builder.start] with a well-typed [Double] value instead. This
138+
* You should usually call [Builder.start] with a well-typed [Float] value instead. This
139139
* method is primarily for setting the field to an undocumented or not yet supported value.
140140
*/
141-
fun start(start: JsonField<Double>) = apply { this.start = start }
141+
fun start(start: JsonField<Float>) = apply { this.start = start }
142142

143143
/** The text content of the word. */
144144
fun word(word: String) = word(JsonField.of(word))

0 commit comments

Comments
 (0)