Skip to content

Commit d7408c3

Browse files
fix(api): internal openapi updates
1 parent 33a7df8 commit d7408c3

File tree

19 files changed

+111
-150
lines changed

19 files changed

+111
-150
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 134
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f59befea071ed7729cbb7bce219e7f837eccfdb57e01698514e6a0bd6052ff60.yml
3-
openapi_spec_hash: 49da48619d37932b2e257c532078b2bb
4-
config_hash: 1af83449a09a3b4f276444dbcdd3eb67
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-b062c33330de7e3bbf992fd4f0799afd868c30a66c39418dd2c62f4add3b45b6.yml
3+
openapi_spec_hash: fe067f5b1c0e93799b5ea7fde3c4b1b3
4+
config_hash: 4b6f471b24d659514b86b736c90a0c0a

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,16 @@ private constructor(
3838
private val _json: JsonValue? = null,
3939
) {
4040

41-
/** Unconstrained free-form text. */
4241
fun text(): Optional<JsonValue> = Optional.ofNullable(text)
4342

44-
/** A grammar defined by the user. */
4543
fun grammar(): Optional<Grammar> = Optional.ofNullable(grammar)
4644

4745
fun isText(): Boolean = text != null
4846

4947
fun isGrammar(): Boolean = grammar != null
5048

51-
/** Unconstrained free-form text. */
5249
fun asText(): JsonValue = text.getOrThrow("text")
5350

54-
/** A grammar defined by the user. */
5551
fun asGrammar(): Grammar = grammar.getOrThrow("grammar")
5652

5753
fun _json(): Optional<JsonValue> = Optional.ofNullable(_json)
@@ -134,11 +130,9 @@ private constructor(
134130

135131
companion object {
136132

137-
/** Unconstrained free-form text. */
138133
@JvmStatic
139134
fun ofText() = CustomToolInputFormat(text = JsonValue.from(mapOf("type" to "text")))
140135

141-
/** A grammar defined by the user. */
142136
@JvmStatic fun ofGrammar(grammar: Grammar) = CustomToolInputFormat(grammar = grammar)
143137
}
144138

@@ -148,10 +142,8 @@ private constructor(
148142
*/
149143
interface Visitor<out T> {
150144

151-
/** Unconstrained free-form text. */
152145
fun visitText(text: JsonValue): T
153146

154-
/** A grammar defined by the user. */
155147
fun visitGrammar(grammar: Grammar): T
156148

157149
/**
@@ -210,7 +202,6 @@ private constructor(
210202
}
211203
}
212204

213-
/** A grammar defined by the user. */
214205
class Grammar
215206
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
216207
private constructor(

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

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ private constructor(
8080
fun background(): Optional<Background> = body.background()
8181

8282
/**
83-
* Control how much effort the model will exert to match the style and features, especially
84-
* facial features, of input images. This parameter is only supported for `gpt-image-1`.
85-
* Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
83+
* Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
8684
*
8785
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
8886
* server responded with an unexpected value).
@@ -431,9 +429,7 @@ private constructor(
431429
}
432430

433431
/**
434-
* Control how much effort the model will exert to match the style and features, especially
435-
* facial features, of input images. This parameter is only supported for `gpt-image-1`.
436-
* Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
432+
* Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
437433
*/
438434
fun inputFidelity(inputFidelity: InputFidelity?) = apply {
439435
body.inputFidelity(inputFidelity)
@@ -907,9 +903,7 @@ private constructor(
907903
fun background(): Optional<Background> = background.value.getOptional("background")
908904

909905
/**
910-
* Control how much effort the model will exert to match the style and features, especially
911-
* facial features, of input images. This parameter is only supported for `gpt-image-1`.
912-
* Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
906+
* Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
913907
*
914908
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
915909
* server responded with an unexpected value).
@@ -1303,10 +1297,7 @@ private constructor(
13031297
}
13041298

13051299
/**
1306-
* Control how much effort the model will exert to match the style and features,
1307-
* especially facial features, of input images. This parameter is only supported for
1308-
* `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`.
1309-
* Defaults to `low`.
1300+
* Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
13101301
*/
13111302
fun inputFidelity(inputFidelity: InputFidelity?) =
13121303
inputFidelity(MultipartField.of(inputFidelity))
@@ -1990,9 +1981,7 @@ private constructor(
19901981
}
19911982

19921983
/**
1993-
* Control how much effort the model will exert to match the style and features, especially
1994-
* facial features, of input images. This parameter is only supported for `gpt-image-1`.
1995-
* Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
1984+
* Control how much effort the model will exert to match the style and features, especially facial features, of input images. This parameter is only supported for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and `low`. Defaults to `low`.
19961985
*/
19971986
class InputFidelity @JsonCreator private constructor(private val value: JsonField<String>) :
19981987
Enum {

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ import java.util.Objects
1818
import java.util.Optional
1919
import kotlin.jvm.optionals.getOrNull
2020

21-
/**
22-
* A custom tool that processes input using a specified format. Learn more about
23-
* [custom tools](https://platform.openai.com/docs/guides/function-calling#custom-tools).
24-
*/
2521
class CustomTool
2622
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2723
private constructor(

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ private constructor(
612612
fun logs(): String = logs.getRequired("logs")
613613

614614
/**
615-
* The type of the output. Always 'logs'.
615+
* The type of the output. Always `logs`.
616616
*
617617
* Expected to always return the following:
618618
* ```java
@@ -804,7 +804,7 @@ private constructor(
804804
) : this(type, url, mutableMapOf())
805805

806806
/**
807-
* The type of the output. Always 'image'.
807+
* The type of the output. Always `image`.
808808
*
809809
* Expected to always return the following:
810810
* ```java

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

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ private constructor(
870870
fun button(): Button = button.getRequired("button")
871871

872872
/**
873-
* Specifies the event type. For a click action, this property is always set to `click`.
873+
* Specifies the event type. For a click action, this property is always `click`.
874874
*
875875
* Expected to always return the following:
876876
* ```java
@@ -1744,7 +1744,7 @@ private constructor(
17441744
(path.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
17451745
type.let { if (it == JsonValue.from("drag")) 1 else 0 }
17461746

1747-
/** A series of x/y coordinate pairs in the drag path. */
1747+
/** An x/y coordinate pair, e.g. `{ x: 100, y: 200 }`. */
17481748
class Path
17491749
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
17501750
private constructor(
@@ -2991,18 +2991,18 @@ private constructor(
29912991
/**
29922992
* The type of the pending safety check.
29932993
*
2994-
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
2995-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
2994+
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
2995+
* server responded with an unexpected value).
29962996
*/
2997-
fun code(): String = code.getRequired("code")
2997+
fun code(): Optional<String> = code.getOptional("code")
29982998

29992999
/**
30003000
* Details about the pending safety check.
30013001
*
3002-
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
3003-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
3002+
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
3003+
* server responded with an unexpected value).
30043004
*/
3005-
fun message(): String = message.getRequired("message")
3005+
fun message(): Optional<String> = message.getOptional("message")
30063006

30073007
/**
30083008
* Returns the raw JSON value of [id].
@@ -3045,8 +3045,6 @@ private constructor(
30453045
* The following fields are required:
30463046
* ```java
30473047
* .id()
3048-
* .code()
3049-
* .message()
30503048
* ```
30513049
*/
30523050
@JvmStatic fun builder() = Builder()
@@ -3056,8 +3054,8 @@ private constructor(
30563054
class Builder internal constructor() {
30573055

30583056
private var id: JsonField<String>? = null
3059-
private var code: JsonField<String>? = null
3060-
private var message: JsonField<String>? = null
3057+
private var code: JsonField<String> = JsonMissing.of()
3058+
private var message: JsonField<String> = JsonMissing.of()
30613059
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
30623060

30633061
@JvmSynthetic
@@ -3081,7 +3079,10 @@ private constructor(
30813079
fun id(id: JsonField<String>) = apply { this.id = id }
30823080

30833081
/** The type of the pending safety check. */
3084-
fun code(code: String) = code(JsonField.of(code))
3082+
fun code(code: String?) = code(JsonField.ofNullable(code))
3083+
3084+
/** Alias for calling [Builder.code] with `code.orElse(null)`. */
3085+
fun code(code: Optional<String>) = code(code.getOrNull())
30853086

30863087
/**
30873088
* Sets [Builder.code] to an arbitrary JSON value.
@@ -3093,7 +3094,10 @@ private constructor(
30933094
fun code(code: JsonField<String>) = apply { this.code = code }
30943095

30953096
/** Details about the pending safety check. */
3096-
fun message(message: String) = message(JsonField.of(message))
3097+
fun message(message: String?) = message(JsonField.ofNullable(message))
3098+
3099+
/** Alias for calling [Builder.message] with `message.orElse(null)`. */
3100+
fun message(message: Optional<String>) = message(message.getOrNull())
30973101

30983102
/**
30993103
* Sets [Builder.message] to an arbitrary JSON value.
@@ -3131,17 +3135,15 @@ private constructor(
31313135
* The following fields are required:
31323136
* ```java
31333137
* .id()
3134-
* .code()
3135-
* .message()
31363138
* ```
31373139
*
31383140
* @throws IllegalStateException if any required field is unset.
31393141
*/
31403142
fun build(): PendingSafetyCheck =
31413143
PendingSafetyCheck(
31423144
checkRequired("id", id),
3143-
checkRequired("code", code),
3144-
checkRequired("message", message),
3145+
code,
3146+
message,
31453147
additionalProperties.toMutableMap(),
31463148
)
31473149
}

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

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -406,18 +406,18 @@ private constructor(
406406
/**
407407
* The type of the pending safety check.
408408
*
409-
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
410-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
409+
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
410+
* server responded with an unexpected value).
411411
*/
412-
fun code(): String = code.getRequired("code")
412+
fun code(): Optional<String> = code.getOptional("code")
413413

414414
/**
415415
* Details about the pending safety check.
416416
*
417-
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
418-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
417+
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
418+
* server responded with an unexpected value).
419419
*/
420-
fun message(): String = message.getRequired("message")
420+
fun message(): Optional<String> = message.getOptional("message")
421421

422422
/**
423423
* Returns the raw JSON value of [id].
@@ -460,8 +460,6 @@ private constructor(
460460
* The following fields are required:
461461
* ```java
462462
* .id()
463-
* .code()
464-
* .message()
465463
* ```
466464
*/
467465
@JvmStatic fun builder() = Builder()
@@ -471,8 +469,8 @@ private constructor(
471469
class Builder internal constructor() {
472470

473471
private var id: JsonField<String>? = null
474-
private var code: JsonField<String>? = null
475-
private var message: JsonField<String>? = null
472+
private var code: JsonField<String> = JsonMissing.of()
473+
private var message: JsonField<String> = JsonMissing.of()
476474
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
477475

478476
@JvmSynthetic
@@ -496,7 +494,10 @@ private constructor(
496494
fun id(id: JsonField<String>) = apply { this.id = id }
497495

498496
/** The type of the pending safety check. */
499-
fun code(code: String) = code(JsonField.of(code))
497+
fun code(code: String?) = code(JsonField.ofNullable(code))
498+
499+
/** Alias for calling [Builder.code] with `code.orElse(null)`. */
500+
fun code(code: Optional<String>) = code(code.getOrNull())
500501

501502
/**
502503
* Sets [Builder.code] to an arbitrary JSON value.
@@ -508,7 +509,10 @@ private constructor(
508509
fun code(code: JsonField<String>) = apply { this.code = code }
509510

510511
/** Details about the pending safety check. */
511-
fun message(message: String) = message(JsonField.of(message))
512+
fun message(message: String?) = message(JsonField.ofNullable(message))
513+
514+
/** Alias for calling [Builder.message] with `message.orElse(null)`. */
515+
fun message(message: Optional<String>) = message(message.getOrNull())
512516

513517
/**
514518
* Sets [Builder.message] to an arbitrary JSON value.
@@ -546,17 +550,15 @@ private constructor(
546550
* The following fields are required:
547551
* ```java
548552
* .id()
549-
* .code()
550-
* .message()
551553
* ```
552554
*
553555
* @throws IllegalStateException if any required field is unset.
554556
*/
555557
fun build(): AcknowledgedSafetyCheck =
556558
AcknowledgedSafetyCheck(
557559
checkRequired("id", id),
558-
checkRequired("code", code),
559-
checkRequired("message", message),
560+
code,
561+
message,
560562
additionalProperties.toMutableMap(),
561563
)
562564
}

0 commit comments

Comments
 (0)