Skip to content

Commit 4d3fc52

Browse files
chore(api): update realtime specs, build config
1 parent 1cb16d4 commit 4d3fc52

18 files changed

+3663
-225
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: 88
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-de3e91790d0b9f3ce26d679ac07079880ccc695bd8c878f961c4d577a5025a2e.yml
3-
openapi_spec_hash: 4b44e3f287583d01fbe7b10cd943254a
4-
config_hash: cc92d0be2a0f3c77bfc988082dd0573e
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-82fd6fcb3eea81cbbe09a6f831c82219f1251e1b76474b4c41f424bf277e6a71.yml
3+
openapi_spec_hash: c8d54bd1ae3d704f6b6f72ffd2f876d8
4+
config_hash: 3315d58b60faf63b1bee251b81837cda

openai-java-core/src/main/kotlin/com/openai/models/beta/realtime/ConversationItem.kt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,9 @@ private constructor(
135135
fun role(): Optional<Role> = role.getOptional("role")
136136

137137
/**
138-
* The status of the item (`completed`, `incomplete`). These have no effect on the conversation,
139-
* but are accepted for consistency with the `conversation.item.created` event.
138+
* The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect on
139+
* the conversation, but are accepted for consistency with the `conversation.item.created`
140+
* event.
140141
*
141142
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
142143
* server responded with an unexpected value).
@@ -391,9 +392,9 @@ private constructor(
391392
fun role(role: JsonField<Role>) = apply { this.role = role }
392393

393394
/**
394-
* The status of the item (`completed`, `incomplete`). These have no effect on the
395-
* conversation, but are accepted for consistency with the `conversation.item.created`
396-
* event.
395+
* The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect
396+
* on the conversation, but are accepted for consistency with the
397+
* `conversation.item.created` event.
397398
*/
398399
fun status(status: Status) = status(JsonField.of(status))
399400

@@ -758,8 +759,9 @@ private constructor(
758759
}
759760

760761
/**
761-
* The status of the item (`completed`, `incomplete`). These have no effect on the conversation,
762-
* but are accepted for consistency with the `conversation.item.created` event.
762+
* The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect on
763+
* the conversation, but are accepted for consistency with the `conversation.item.created`
764+
* event.
763765
*/
764766
class Status @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
765767

@@ -779,13 +781,16 @@ private constructor(
779781

780782
@JvmField val INCOMPLETE = of("incomplete")
781783

784+
@JvmField val IN_PROGRESS = of("in_progress")
785+
782786
@JvmStatic fun of(value: String) = Status(JsonField.of(value))
783787
}
784788

785789
/** An enum containing [Status]'s known values. */
786790
enum class Known {
787791
COMPLETED,
788792
INCOMPLETE,
793+
IN_PROGRESS,
789794
}
790795

791796
/**
@@ -800,6 +805,7 @@ private constructor(
800805
enum class Value {
801806
COMPLETED,
802807
INCOMPLETE,
808+
IN_PROGRESS,
803809
/** An enum member indicating that [Status] was instantiated with an unknown value. */
804810
_UNKNOWN,
805811
}
@@ -815,6 +821,7 @@ private constructor(
815821
when (this) {
816822
COMPLETED -> Value.COMPLETED
817823
INCOMPLETE -> Value.INCOMPLETE
824+
IN_PROGRESS -> Value.IN_PROGRESS
818825
else -> Value._UNKNOWN
819826
}
820827

@@ -831,6 +838,7 @@ private constructor(
831838
when (this) {
832839
COMPLETED -> Known.COMPLETED
833840
INCOMPLETE -> Known.INCOMPLETE
841+
IN_PROGRESS -> Known.IN_PROGRESS
834842
else -> throw OpenAIInvalidDataException("Unknown Status: $value")
835843
}
836844

openai-java-core/src/main/kotlin/com/openai/models/beta/realtime/ConversationItemCreatedEvent.kt

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import com.openai.core.checkRequired
1414
import com.openai.errors.OpenAIInvalidDataException
1515
import java.util.Collections
1616
import java.util.Objects
17+
import java.util.Optional
1718
import kotlin.jvm.optionals.getOrNull
1819

1920
/**
@@ -30,20 +31,20 @@ class ConversationItemCreatedEvent
3031
private constructor(
3132
private val eventId: JsonField<String>,
3233
private val item: JsonField<ConversationItem>,
33-
private val previousItemId: JsonField<String>,
3434
private val type: JsonValue,
35+
private val previousItemId: JsonField<String>,
3536
private val additionalProperties: MutableMap<String, JsonValue>,
3637
) {
3738

3839
@JsonCreator
3940
private constructor(
4041
@JsonProperty("event_id") @ExcludeMissing eventId: JsonField<String> = JsonMissing.of(),
4142
@JsonProperty("item") @ExcludeMissing item: JsonField<ConversationItem> = JsonMissing.of(),
43+
@JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
4244
@JsonProperty("previous_item_id")
4345
@ExcludeMissing
4446
previousItemId: JsonField<String> = JsonMissing.of(),
45-
@JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(),
46-
) : this(eventId, item, previousItemId, type, mutableMapOf())
47+
) : this(eventId, item, type, previousItemId, mutableMapOf())
4748

4849
/**
4950
* The unique ID of the server event.
@@ -61,15 +62,6 @@ private constructor(
6162
*/
6263
fun item(): ConversationItem = item.getRequired("item")
6364

64-
/**
65-
* The ID of the preceding item in the Conversation context, allows the client to understand the
66-
* order of the conversation.
67-
*
68-
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is
69-
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
70-
*/
71-
fun previousItemId(): String = previousItemId.getRequired("previous_item_id")
72-
7365
/**
7466
* The event type, must be `conversation.item.created`.
7567
*
@@ -83,6 +75,15 @@ private constructor(
8375
*/
8476
@JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type
8577

78+
/**
79+
* The ID of the preceding item in the Conversation context, allows the client to understand the
80+
* order of the conversation. Can be `null` if the item has no predecessor.
81+
*
82+
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
83+
* server responded with an unexpected value).
84+
*/
85+
fun previousItemId(): Optional<String> = previousItemId.getOptional("previous_item_id")
86+
8687
/**
8788
* Returns the raw JSON value of [eventId].
8889
*
@@ -127,7 +128,6 @@ private constructor(
127128
* ```java
128129
* .eventId()
129130
* .item()
130-
* .previousItemId()
131131
* ```
132132
*/
133133
@JvmStatic fun builder() = Builder()
@@ -138,16 +138,16 @@ private constructor(
138138

139139
private var eventId: JsonField<String>? = null
140140
private var item: JsonField<ConversationItem>? = null
141-
private var previousItemId: JsonField<String>? = null
142141
private var type: JsonValue = JsonValue.from("conversation.item.created")
142+
private var previousItemId: JsonField<String> = JsonMissing.of()
143143
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
144144

145145
@JvmSynthetic
146146
internal fun from(conversationItemCreatedEvent: ConversationItemCreatedEvent) = apply {
147147
eventId = conversationItemCreatedEvent.eventId
148148
item = conversationItemCreatedEvent.item
149-
previousItemId = conversationItemCreatedEvent.previousItemId
150149
type = conversationItemCreatedEvent.type
150+
previousItemId = conversationItemCreatedEvent.previousItemId
151151
additionalProperties = conversationItemCreatedEvent.additionalProperties.toMutableMap()
152152
}
153153

@@ -174,11 +174,30 @@ private constructor(
174174
*/
175175
fun item(item: JsonField<ConversationItem>) = apply { this.item = item }
176176

177+
/**
178+
* Sets the field to an arbitrary JSON value.
179+
*
180+
* It is usually unnecessary to call this method because the field defaults to the
181+
* following:
182+
* ```java
183+
* JsonValue.from("conversation.item.created")
184+
* ```
185+
*
186+
* This method is primarily for setting the field to an undocumented or not yet supported
187+
* value.
188+
*/
189+
fun type(type: JsonValue) = apply { this.type = type }
190+
177191
/**
178192
* The ID of the preceding item in the Conversation context, allows the client to understand
179-
* the order of the conversation.
193+
* the order of the conversation. Can be `null` if the item has no predecessor.
180194
*/
181-
fun previousItemId(previousItemId: String) = previousItemId(JsonField.of(previousItemId))
195+
fun previousItemId(previousItemId: String?) =
196+
previousItemId(JsonField.ofNullable(previousItemId))
197+
198+
/** Alias for calling [Builder.previousItemId] with `previousItemId.orElse(null)`. */
199+
fun previousItemId(previousItemId: Optional<String>) =
200+
previousItemId(previousItemId.getOrNull())
182201

183202
/**
184203
* Sets [Builder.previousItemId] to an arbitrary JSON value.
@@ -191,20 +210,6 @@ private constructor(
191210
this.previousItemId = previousItemId
192211
}
193212

194-
/**
195-
* Sets the field to an arbitrary JSON value.
196-
*
197-
* It is usually unnecessary to call this method because the field defaults to the
198-
* following:
199-
* ```java
200-
* JsonValue.from("conversation.item.created")
201-
* ```
202-
*
203-
* This method is primarily for setting the field to an undocumented or not yet supported
204-
* value.
205-
*/
206-
fun type(type: JsonValue) = apply { this.type = type }
207-
208213
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
209214
this.additionalProperties.clear()
210215
putAllAdditionalProperties(additionalProperties)
@@ -233,7 +238,6 @@ private constructor(
233238
* ```java
234239
* .eventId()
235240
* .item()
236-
* .previousItemId()
237241
* ```
238242
*
239243
* @throws IllegalStateException if any required field is unset.
@@ -242,8 +246,8 @@ private constructor(
242246
ConversationItemCreatedEvent(
243247
checkRequired("eventId", eventId),
244248
checkRequired("item", item),
245-
checkRequired("previousItemId", previousItemId),
246249
type,
250+
previousItemId,
247251
additionalProperties.toMutableMap(),
248252
)
249253
}
@@ -257,12 +261,12 @@ private constructor(
257261

258262
eventId()
259263
item().validate()
260-
previousItemId()
261264
_type().let {
262265
if (it != JsonValue.from("conversation.item.created")) {
263266
throw OpenAIInvalidDataException("'type' is invalid, received $it")
264267
}
265268
}
269+
previousItemId()
266270
validated = true
267271
}
268272

@@ -283,23 +287,23 @@ private constructor(
283287
internal fun validity(): Int =
284288
(if (eventId.asKnown().isPresent) 1 else 0) +
285289
(item.asKnown().getOrNull()?.validity() ?: 0) +
286-
(if (previousItemId.asKnown().isPresent) 1 else 0) +
287-
type.let { if (it == JsonValue.from("conversation.item.created")) 1 else 0 }
290+
type.let { if (it == JsonValue.from("conversation.item.created")) 1 else 0 } +
291+
(if (previousItemId.asKnown().isPresent) 1 else 0)
288292

289293
override fun equals(other: Any?): Boolean {
290294
if (this === other) {
291295
return true
292296
}
293297

294-
return /* spotless:off */ other is ConversationItemCreatedEvent && eventId == other.eventId && item == other.item && previousItemId == other.previousItemId && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */
298+
return /* spotless:off */ other is ConversationItemCreatedEvent && eventId == other.eventId && item == other.item && type == other.type && previousItemId == other.previousItemId && additionalProperties == other.additionalProperties /* spotless:on */
295299
}
296300

297301
/* spotless:off */
298-
private val hashCode: Int by lazy { Objects.hash(eventId, item, previousItemId, type, additionalProperties) }
302+
private val hashCode: Int by lazy { Objects.hash(eventId, item, type, previousItemId, additionalProperties) }
299303
/* spotless:on */
300304

301305
override fun hashCode(): Int = hashCode
302306

303307
override fun toString() =
304-
"ConversationItemCreatedEvent{eventId=$eventId, item=$item, previousItemId=$previousItemId, type=$type, additionalProperties=$additionalProperties}"
308+
"ConversationItemCreatedEvent{eventId=$eventId, item=$item, type=$type, previousItemId=$previousItemId, additionalProperties=$additionalProperties}"
305309
}

openai-java-core/src/main/kotlin/com/openai/models/beta/realtime/ConversationItemWithReference.kt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ private constructor(
139139
fun role(): Optional<Role> = role.getOptional("role")
140140

141141
/**
142-
* The status of the item (`completed`, `incomplete`). These have no effect on the conversation,
143-
* but are accepted for consistency with the `conversation.item.created` event.
142+
* The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect on
143+
* the conversation, but are accepted for consistency with the `conversation.item.created`
144+
* event.
144145
*
145146
* @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the
146147
* server responded with an unexpected value).
@@ -402,9 +403,9 @@ private constructor(
402403
fun role(role: JsonField<Role>) = apply { this.role = role }
403404

404405
/**
405-
* The status of the item (`completed`, `incomplete`). These have no effect on the
406-
* conversation, but are accepted for consistency with the `conversation.item.created`
407-
* event.
406+
* The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect
407+
* on the conversation, but are accepted for consistency with the
408+
* `conversation.item.created` event.
408409
*/
409410
fun status(status: Status) = status(JsonField.of(status))
410411

@@ -772,8 +773,9 @@ private constructor(
772773
}
773774

774775
/**
775-
* The status of the item (`completed`, `incomplete`). These have no effect on the conversation,
776-
* but are accepted for consistency with the `conversation.item.created` event.
776+
* The status of the item (`completed`, `incomplete`, `in_progress`). These have no effect on
777+
* the conversation, but are accepted for consistency with the `conversation.item.created`
778+
* event.
777779
*/
778780
class Status @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
779781

@@ -793,13 +795,16 @@ private constructor(
793795

794796
@JvmField val INCOMPLETE = of("incomplete")
795797

798+
@JvmField val IN_PROGRESS = of("in_progress")
799+
796800
@JvmStatic fun of(value: String) = Status(JsonField.of(value))
797801
}
798802

799803
/** An enum containing [Status]'s known values. */
800804
enum class Known {
801805
COMPLETED,
802806
INCOMPLETE,
807+
IN_PROGRESS,
803808
}
804809

805810
/**
@@ -814,6 +819,7 @@ private constructor(
814819
enum class Value {
815820
COMPLETED,
816821
INCOMPLETE,
822+
IN_PROGRESS,
817823
/** An enum member indicating that [Status] was instantiated with an unknown value. */
818824
_UNKNOWN,
819825
}
@@ -829,6 +835,7 @@ private constructor(
829835
when (this) {
830836
COMPLETED -> Value.COMPLETED
831837
INCOMPLETE -> Value.INCOMPLETE
838+
IN_PROGRESS -> Value.IN_PROGRESS
832839
else -> Value._UNKNOWN
833840
}
834841

@@ -845,6 +852,7 @@ private constructor(
845852
when (this) {
846853
COMPLETED -> Known.COMPLETED
847854
INCOMPLETE -> Known.INCOMPLETE
855+
IN_PROGRESS -> Known.IN_PROGRESS
848856
else -> throw OpenAIInvalidDataException("Unknown Status: $value")
849857
}
850858

0 commit comments

Comments
 (0)