Class ConversationItemCreateEvent
-
- All Implemented Interfaces:
public final class ConversationItemCreateEvent
Add a new Item to the Conversation's context, including messages, function calls, and function call responses. This event can be used both to populate a "history" of the conversation and to add new items mid-stream, but has the current limitation that it cannot populate assistant audio messages.
If successful, the server will respond with a
conversation.item.created
event, otherwise anerror
event will be sent.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
ConversationItemCreateEvent.Builder
A builder for ConversationItemCreateEvent.
-
Method Summary
Modifier and Type Method Description final ConversationItem
item()
The item to add to the conversation. final JsonValue
_type()
The event type, must be conversation.item.create
.final Optional<String>
eventId()
Optional client-generated ID used to identify this event. final Optional<String>
previousItemId()
The ID of the preceding item after which the new item will be inserted. final JsonField<ConversationItem>
_item()
Returns the raw JSON value of item. final JsonField<String>
_eventId()
Returns the raw JSON value of eventId. final JsonField<String>
_previousItemId()
Returns the raw JSON value of previousItemId. final Map<String, JsonValue>
_additionalProperties()
final ConversationItemCreateEvent.Builder
toBuilder()
final ConversationItemCreateEvent
validate()
final Boolean
isValid()
Boolean
equals(Object other)
Integer
hashCode()
String
toString()
final static ConversationItemCreateEvent.Builder
builder()
Returns a mutable builder for constructing an instance of ConversationItemCreateEvent. -
-
Method Detail
-
item
final ConversationItem item()
The item to add to the conversation.
-
_type
final JsonValue _type()
The event type, must be
conversation.item.create
.Expected to always return the following:
JsonValue.from("conversation.item.create")
However, this method can be useful for debugging and logging (e.g. if the server responded with an unexpected value).
-
previousItemId
final Optional<String> previousItemId()
The ID of the preceding item after which the new item will be inserted. If not set, the new item will be appended to the end of the conversation. If set to
root
, the new item will be added to the beginning of the conversation. If set to an existing ID, it allows an item to be inserted mid-conversation. If the ID cannot be found, an error will be returned and the item will not be added.
-
_item
final JsonField<ConversationItem> _item()
Returns the raw JSON value of item.
Unlike item, 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.
-
_previousItemId
final JsonField<String> _previousItemId()
Returns the raw JSON value of previousItemId.
Unlike previousItemId, this method doesn't throw if the JSON field has an unexpected type.
-
_additionalProperties
final Map<String, JsonValue> _additionalProperties()
-
toBuilder
final ConversationItemCreateEvent.Builder toBuilder()
-
validate
final ConversationItemCreateEvent validate()
-
builder
final static ConversationItemCreateEvent.Builder builder()
Returns a mutable builder for constructing an instance of ConversationItemCreateEvent.
The following fields are required:
.item()
-
-
-
-