Class ConversationItemTruncateEvent
-
- All Implemented Interfaces:
public final class ConversationItemTruncateEvent
Send this event to truncate a previous assistant message’s audio. The server will produce audio faster than realtime, so this event is useful when the user interrupts to truncate audio that has already been sent to the client but not yet played. This will synchronize the server's understanding of the audio with the client's playback.
Truncating audio will delete the server-side text transcript to ensure there is not text in the context that hasn't been heard by the user.
If successful, the server will respond with a
conversation.item.truncated
event.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
ConversationItemTruncateEvent.Builder
A builder for ConversationItemTruncateEvent.
-
Method Summary
Modifier and Type Method Description final Long
audioEndMs()
Inclusive duration up to which audio is truncated, in milliseconds. final Long
contentIndex()
The index of the content part to truncate. final String
itemId()
The ID of the assistant message item to truncate. final JsonValue
_type()
The event type, must be conversation.item.truncate
.final Optional<String>
eventId()
Optional client-generated ID used to identify this event. final JsonField<Long>
_audioEndMs()
Returns the raw JSON value of audioEndMs. final JsonField<Long>
_contentIndex()
Returns the raw JSON value of contentIndex. final JsonField<String>
_itemId()
Returns the raw JSON value of itemId. final JsonField<String>
_eventId()
Returns the raw JSON value of eventId. final Map<String, JsonValue>
_additionalProperties()
final ConversationItemTruncateEvent.Builder
toBuilder()
final ConversationItemTruncateEvent
validate()
final Boolean
isValid()
Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final static ConversationItemTruncateEvent.Builder
builder()
Returns a mutable builder for constructing an instance of ConversationItemTruncateEvent. -
-
Method Detail
-
audioEndMs
final Long audioEndMs()
Inclusive duration up to which audio is truncated, in milliseconds. If the audio_end_ms is greater than the actual audio duration, the server will respond with an error.
-
contentIndex
final Long contentIndex()
The index of the content part to truncate. Set this to 0.
-
itemId
final String itemId()
The ID of the assistant message item to truncate. Only assistant message items can be truncated.
-
_type
final JsonValue _type()
The event type, must be
conversation.item.truncate
.Expected to always return the following:
JsonValue.from("conversation.item.truncate")
However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).
-
_audioEndMs
final JsonField<Long> _audioEndMs()
Returns the raw JSON value of audioEndMs.
Unlike audioEndMs, this method doesn't throw if the JSON field has an unexpected type.
-
_contentIndex
final JsonField<Long> _contentIndex()
Returns the raw JSON value of contentIndex.
Unlike contentIndex, this method doesn't throw if the JSON field has an unexpected type.
-
_itemId
final JsonField<String> _itemId()
Returns the raw JSON value of itemId.
Unlike itemId, this method doesn't throw if the JSON field has an unexpected type.
-
_eventId
final JsonField<String> _eventId()
Returns the raw JSON value of eventId.
Unlike eventId, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final ConversationItemTruncateEvent.Builder toBuilder()
-
validate
final ConversationItemTruncateEvent validate()
-
builder
final static ConversationItemTruncateEvent.Builder builder()
Returns a mutable builder for constructing an instance of ConversationItemTruncateEvent.
The following fields are required:
.audioEndMs() .contentIndex() .itemId()
-
-
-
-