Skip to content

Commit a4a7d53

Browse files
feat(api): add image sizes, reasoning encryption
1 parent eef415d commit a4a7d53

28 files changed

+852
-266
lines changed

.stats.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 95
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8b68ae6b807dca92e914da1dd9e835a20f69b075e79102a264367fd7fddddb33.yml
3-
openapi_spec_hash: b6ade5b1a6327339e6669e1134de2d03
4-
config_hash: b597cd9a31e9e5ec709e2eefb4c54122
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-0ee6b36cf3cc278cef4199a6aec5f7d530a6c1f17a74830037e96d50ca1edc50.yml
3+
openapi_spec_hash: e8ec5f46bc0655b34f292422d58a60f6
4+
config_hash: d9b6b6e6bc85744663e300eebc482067

openai-java-core/src/main/kotlin/com/openai/models/audio/speech/SpeechCreateParams.kt

+4-3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ private constructor(
7676

7777
/**
7878
* The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default.
79+
* Does not work with `gpt-4o-mini-tts`.
7980
*
8081
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
8182
* server responded with an unexpected value).
@@ -271,7 +272,7 @@ private constructor(
271272

272273
/**
273274
* The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the
274-
* default.
275+
* default. Does not work with `gpt-4o-mini-tts`.
275276
*/
276277
fun speed(speed: Double) = apply { body.speed(speed) }
277278

@@ -502,7 +503,7 @@ private constructor(
502503

503504
/**
504505
* The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the
505-
* default.
506+
* default. Does not work with `gpt-4o-mini-tts`.
506507
*
507508
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
508509
* server responded with an unexpected value).
@@ -705,7 +706,7 @@ private constructor(
705706

706707
/**
707708
* The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the
708-
* default.
709+
* default. Does not work with `gpt-4o-mini-tts`.
709710
*/
710711
fun speed(speed: Double) = speed(JsonField.of(speed))
711712

openai-java-core/src/main/kotlin/com/openai/models/images/ImageEditParams.kt

+318-30
Large diffs are not rendered by default.

openai-java-core/src/main/kotlin/com/openai/models/responses/ComputerTool.kt

+27-23
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import kotlin.jvm.optionals.getOrNull
2323
*/
2424
class ComputerTool
2525
private constructor(
26-
private val displayHeight: JsonField<Double>,
27-
private val displayWidth: JsonField<Double>,
26+
private val displayHeight: JsonField<Long>,
27+
private val displayWidth: JsonField<Long>,
2828
private val environment: JsonField<Environment>,
2929
private val type: JsonValue,
3030
private val additionalProperties: MutableMap<String, JsonValue>,
@@ -34,10 +34,10 @@ private constructor(
3434
private constructor(
3535
@JsonProperty("display_height")
3636
@ExcludeMissing
37-
displayHeight: JsonField<Double> = JsonMissing.of(),
37+
displayHeight: JsonField<Long> = JsonMissing.of(),
3838
@JsonProperty("display_width")
3939
@ExcludeMissing
40-
displayWidth: JsonField<Double> = JsonMissing.of(),
40+
displayWidth: JsonField<Long> = JsonMissing.of(),
4141
@JsonProperty("environment")
4242
@ExcludeMissing
4343
environment: JsonField<Environment> = JsonMissing.of(),
@@ -50,15 +50,15 @@ private constructor(
5050
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
5151
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
5252
*/
53-
fun displayHeight(): Double = displayHeight.getRequired("display_height")
53+
fun displayHeight(): Long = displayHeight.getRequired("display_height")
5454

5555
/**
5656
* The width of the computer display.
5757
*
5858
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
5959
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
6060
*/
61-
fun displayWidth(): Double = displayWidth.getRequired("display_width")
61+
fun displayWidth(): Long = displayWidth.getRequired("display_width")
6262

6363
/**
6464
* The type of computer environment to control.
@@ -88,7 +88,7 @@ private constructor(
8888
*/
8989
@JsonProperty("display_height")
9090
@ExcludeMissing
91-
fun _displayHeight(): JsonField<Double> = displayHeight
91+
fun _displayHeight(): JsonField<Long> = displayHeight
9292

9393
/**
9494
* Returns the raw JSON value of [displayWidth].
@@ -97,7 +97,7 @@ private constructor(
9797
*/
9898
@JsonProperty("display_width")
9999
@ExcludeMissing
100-
fun _displayWidth(): JsonField<Double> = displayWidth
100+
fun _displayWidth(): JsonField<Long> = displayWidth
101101

102102
/**
103103
* Returns the raw JSON value of [environment].
@@ -138,8 +138,8 @@ private constructor(
138138
/** A builder for [ComputerTool]. */
139139
class Builder internal constructor() {
140140

141-
private var displayHeight: JsonField<Double>? = null
142-
private var displayWidth: JsonField<Double>? = null
141+
private var displayHeight: JsonField<Long>? = null
142+
private var displayWidth: JsonField<Long>? = null
143143
private var environment: JsonField<Environment>? = null
144144
private var type: JsonValue = JsonValue.from("computer_use_preview")
145145
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -154,32 +154,30 @@ private constructor(
154154
}
155155

156156
/** The height of the computer display. */
157-
fun displayHeight(displayHeight: Double) = displayHeight(JsonField.of(displayHeight))
157+
fun displayHeight(displayHeight: Long) = displayHeight(JsonField.of(displayHeight))
158158

159159
/**
160160
* Sets [Builder.displayHeight] to an arbitrary JSON value.
161161
*
162-
* You should usually call [Builder.displayHeight] with a well-typed [Double] value instead.
162+
* You should usually call [Builder.displayHeight] with a well-typed [Long] value instead.
163163
* This method is primarily for setting the field to an undocumented or not yet supported
164164
* value.
165165
*/
166-
fun displayHeight(displayHeight: JsonField<Double>) = apply {
166+
fun displayHeight(displayHeight: JsonField<Long>) = apply {
167167
this.displayHeight = displayHeight
168168
}
169169

170170
/** The width of the computer display. */
171-
fun displayWidth(displayWidth: Double) = displayWidth(JsonField.of(displayWidth))
171+
fun displayWidth(displayWidth: Long) = displayWidth(JsonField.of(displayWidth))
172172

173173
/**
174174
* Sets [Builder.displayWidth] to an arbitrary JSON value.
175175
*
176-
* You should usually call [Builder.displayWidth] with a well-typed [Double] value instead.
176+
* You should usually call [Builder.displayWidth] with a well-typed [Long] value instead.
177177
* This method is primarily for setting the field to an undocumented or not yet supported
178178
* value.
179179
*/
180-
fun displayWidth(displayWidth: JsonField<Double>) = apply {
181-
this.displayWidth = displayWidth
182-
}
180+
fun displayWidth(displayWidth: JsonField<Long>) = apply { this.displayWidth = displayWidth }
183181

184182
/** The type of computer environment to control. */
185183
fun environment(environment: Environment) = environment(JsonField.of(environment))
@@ -306,9 +304,11 @@ private constructor(
306304

307305
companion object {
308306

307+
@JvmField val WINDOWS = of("windows")
308+
309309
@JvmField val MAC = of("mac")
310310

311-
@JvmField val WINDOWS = of("windows")
311+
@JvmField val LINUX = of("linux")
312312

313313
@JvmField val UBUNTU = of("ubuntu")
314314

@@ -319,8 +319,9 @@ private constructor(
319319

320320
/** An enum containing [Environment]'s known values. */
321321
enum class Known {
322-
MAC,
323322
WINDOWS,
323+
MAC,
324+
LINUX,
324325
UBUNTU,
325326
BROWSER,
326327
}
@@ -335,8 +336,9 @@ private constructor(
335336
* - It was constructed with an arbitrary value using the [of] method.
336337
*/
337338
enum class Value {
338-
MAC,
339339
WINDOWS,
340+
MAC,
341+
LINUX,
340342
UBUNTU,
341343
BROWSER,
342344
/**
@@ -354,8 +356,9 @@ private constructor(
354356
*/
355357
fun value(): Value =
356358
when (this) {
357-
MAC -> Value.MAC
358359
WINDOWS -> Value.WINDOWS
360+
MAC -> Value.MAC
361+
LINUX -> Value.LINUX
359362
UBUNTU -> Value.UBUNTU
360363
BROWSER -> Value.BROWSER
361364
else -> Value._UNKNOWN
@@ -372,8 +375,9 @@ private constructor(
372375
*/
373376
fun known(): Known =
374377
when (this) {
375-
MAC -> Known.MAC
376378
WINDOWS -> Known.WINDOWS
379+
MAC -> Known.MAC
380+
LINUX -> Known.LINUX
377381
UBUNTU -> Known.UBUNTU
378382
BROWSER -> Known.BROWSER
379383
else -> throw OpenAIInvalidDataException("Unknown Environment: $value")

openai-java-core/src/main/kotlin/com/openai/models/responses/FileSearchTool.kt

+7-4
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private constructor(
8484
fun vectorStoreIds(): List<String> = vectorStoreIds.getRequired("vector_store_ids")
8585

8686
/**
87-
* A filter to apply based on file attributes.
87+
* A filter to apply.
8888
*
8989
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
9090
* server responded with an unexpected value).
@@ -227,8 +227,11 @@ private constructor(
227227
}
228228
}
229229

230-
/** A filter to apply based on file attributes. */
231-
fun filters(filters: Filters) = filters(JsonField.of(filters))
230+
/** A filter to apply. */
231+
fun filters(filters: Filters?) = filters(JsonField.ofNullable(filters))
232+
233+
/** Alias for calling [Builder.filters] with `filters.orElse(null)`. */
234+
fun filters(filters: Optional<Filters>) = filters(filters.getOrNull())
232235

233236
/**
234237
* Sets [Builder.filters] to an arbitrary JSON value.
@@ -360,7 +363,7 @@ private constructor(
360363
(if (maxNumResults.asKnown().isPresent) 1 else 0) +
361364
(rankingOptions.asKnown().getOrNull()?.validity() ?: 0)
362365

363-
/** A filter to apply based on file attributes. */
366+
/** A filter to apply. */
364367
@JsonDeserialize(using = Filters.Deserializer::class)
365368
@JsonSerialize(using = Filters.Serializer::class)
366369
class Filters

openai-java-core/src/main/kotlin/com/openai/models/responses/FunctionTool.kt

+22-9
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@ private constructor(
5656
/**
5757
* A JSON schema object describing the parameters of the function.
5858
*
59-
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
60-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
59+
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
60+
* server responded with an unexpected value).
6161
*/
62-
fun parameters(): Parameters = parameters.getRequired("parameters")
62+
fun parameters(): Optional<Parameters> = parameters.getOptional("parameters")
6363

6464
/**
6565
* Whether to enforce strict parameter validation. Default `true`.
6666
*
67-
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
68-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
67+
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
68+
* server responded with an unexpected value).
6969
*/
70-
fun strict(): Boolean = strict.getRequired("strict")
70+
fun strict(): Optional<Boolean> = strict.getOptional("strict")
7171

7272
/**
7373
* The type of the function tool. Always `function`.
@@ -180,7 +180,10 @@ private constructor(
180180
fun name(name: JsonField<String>) = apply { this.name = name }
181181

182182
/** A JSON schema object describing the parameters of the function. */
183-
fun parameters(parameters: Parameters) = parameters(JsonField.of(parameters))
183+
fun parameters(parameters: Parameters?) = parameters(JsonField.ofNullable(parameters))
184+
185+
/** Alias for calling [Builder.parameters] with `parameters.orElse(null)`. */
186+
fun parameters(parameters: Optional<Parameters>) = parameters(parameters.getOrNull())
184187

185188
/**
186189
* Sets [Builder.parameters] to an arbitrary JSON value.
@@ -192,7 +195,17 @@ private constructor(
192195
fun parameters(parameters: JsonField<Parameters>) = apply { this.parameters = parameters }
193196

194197
/** Whether to enforce strict parameter validation. Default `true`. */
195-
fun strict(strict: Boolean) = strict(JsonField.of(strict))
198+
fun strict(strict: Boolean?) = strict(JsonField.ofNullable(strict))
199+
200+
/**
201+
* Alias for [Builder.strict].
202+
*
203+
* This unboxed primitive overload exists for backwards compatibility.
204+
*/
205+
fun strict(strict: Boolean) = strict(strict as Boolean?)
206+
207+
/** Alias for calling [Builder.strict] with `strict.orElse(null)`. */
208+
fun strict(strict: Optional<Boolean>) = strict(strict.getOrNull())
196209

197210
/**
198211
* Sets [Builder.strict] to an arbitrary JSON value.
@@ -286,7 +299,7 @@ private constructor(
286299
}
287300

288301
name()
289-
parameters().validate()
302+
parameters().ifPresent { it.validate() }
290303
strict()
291304
_type().let {
292305
if (it != JsonValue.from("function")) {

openai-java-core/src/main/kotlin/com/openai/models/responses/Response.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -985,13 +985,13 @@ private constructor(
985985
/** Alias for calling [addTool] with `Tool.ofFunction(function)`. */
986986
fun addTool(function: FunctionTool) = addTool(Tool.ofFunction(function))
987987

988+
/** Alias for calling [addTool] with `Tool.ofWebSearch(webSearch)`. */
989+
fun addTool(webSearch: WebSearchTool) = addTool(Tool.ofWebSearch(webSearch))
990+
988991
/** Alias for calling [addTool] with `Tool.ofComputerUsePreview(computerUsePreview)`. */
989992
fun addTool(computerUsePreview: ComputerTool) =
990993
addTool(Tool.ofComputerUsePreview(computerUsePreview))
991994

992-
/** Alias for calling [addTool] with `Tool.ofWebSearch(webSearch)`. */
993-
fun addTool(webSearch: WebSearchTool) = addTool(Tool.ofWebSearch(webSearch))
994-
995995
/**
996996
* An alternative to sampling with temperature, called nucleus sampling, where the model
997997
* considers the results of the tokens with top_p probability mass. So 0.1 means only the

0 commit comments

Comments
 (0)