Class Message.Builder
-
- All Implemented Interfaces:
public final class Message.Builder
A builder for Message.
-
-
Method Summary
Modifier and Type Method Description final Message.Builder
id(String id)
The identifier, which can be referenced in API endpoints. final Message.Builder
id(JsonField<String> id)
Sets Builder.id to an arbitrary JSON value. final Message.Builder
assistantId(String assistantId)
If applicable, the ID of the assistant that authored this message. final Message.Builder
assistantId(Optional<String> assistantId)
Alias for calling Builder.assistantId with assistantId.orElse(null)
.final Message.Builder
assistantId(JsonField<String> assistantId)
Sets Builder.assistantId to an arbitrary JSON value. final Message.Builder
attachments(List<Message.Attachment> attachments)
A list of files attached to the message, and the tools they were added to. final Message.Builder
attachments(Optional<List<Message.Attachment>> attachments)
Alias for calling Builder.attachments with attachments.orElse(null)
.final Message.Builder
attachments(JsonField<List<Message.Attachment>> attachments)
Sets Builder.attachments to an arbitrary JSON value. final Message.Builder
addAttachment(Message.Attachment attachment)
Adds a single Attachment to attachments. final Message.Builder
completedAt(Long completedAt)
The Unix timestamp (in seconds) for when the message was completed. final Message.Builder
completedAt(Long completedAt)
Alias for Builder.completedAt. final Message.Builder
completedAt(Optional<Long> completedAt)
Alias for calling Builder.completedAt with completedAt.orElse(null)
.final Message.Builder
completedAt(JsonField<Long> completedAt)
Sets Builder.completedAt to an arbitrary JSON value. final Message.Builder
content(List<MessageContent> content)
The content of the message in array of text and/or images. final Message.Builder
content(JsonField<List<MessageContent>> content)
Sets Builder.content to an arbitrary JSON value. final Message.Builder
addContent(MessageContent content)
Adds a single MessageContent to Builder.content. final Message.Builder
addContent(ImageFileContentBlock imageFile)
Alias for calling addContent with MessageContent.ofImageFile(imageFile)
.final Message.Builder
addContent(ImageUrlContentBlock imageUrl)
Alias for calling addContent with MessageContent.ofImageUrl(imageUrl)
.final Message.Builder
addContent(TextContentBlock text)
Alias for calling addContent with MessageContent.ofText(text)
.final Message.Builder
addContent(RefusalContentBlock refusal)
Alias for calling addContent with MessageContent.ofRefusal(refusal)
.final Message.Builder
addImageFileContent(ImageFile imageFile)
Alias for calling addContent with the following: ImageFileContentBlock.builder() .imageFile(imageFile) .build()
final Message.Builder
addImageUrlContent(ImageUrl imageUrl)
Alias for calling addContent with the following: ImageUrlContentBlock.builder() .imageUrl(imageUrl) .build()
final Message.Builder
addTextContent(Text text)
Alias for calling addContent with the following: TextContentBlock.builder() .text(text) .build()
final Message.Builder
addRefusalContent(String refusal)
Alias for calling addContent with the following: RefusalContentBlock.builder() .refusal(refusal) .build()
final Message.Builder
createdAt(Long createdAt)
The Unix timestamp (in seconds) for when the message was created. final Message.Builder
createdAt(JsonField<Long> createdAt)
Sets Builder.createdAt to an arbitrary JSON value. final Message.Builder
incompleteAt(Long incompleteAt)
The Unix timestamp (in seconds) for when the message was marked as incomplete. final Message.Builder
incompleteAt(Long incompleteAt)
Alias for Builder.incompleteAt. final Message.Builder
incompleteAt(Optional<Long> incompleteAt)
Alias for calling Builder.incompleteAt with incompleteAt.orElse(null)
.final Message.Builder
incompleteAt(JsonField<Long> incompleteAt)
Sets Builder.incompleteAt to an arbitrary JSON value. final Message.Builder
incompleteDetails(Message.IncompleteDetails incompleteDetails)
On an incomplete message, details about why the message is incomplete. final Message.Builder
incompleteDetails(Optional<Message.IncompleteDetails> incompleteDetails)
Alias for calling Builder.incompleteDetails with incompleteDetails.orElse(null)
.final Message.Builder
incompleteDetails(JsonField<Message.IncompleteDetails> incompleteDetails)
Sets Builder.incompleteDetails to an arbitrary JSON value. final Message.Builder
metadata(Message.Metadata metadata)
Set of 16 key-value pairs that can be attached to an object. final Message.Builder
metadata(Optional<Message.Metadata> metadata)
Alias for calling Builder.metadata with metadata.orElse(null)
.final Message.Builder
metadata(JsonField<Message.Metadata> metadata)
Sets Builder.metadata to an arbitrary JSON value. final Message.Builder
object_(JsonValue object_)
Sets the field to an arbitrary JSON value. final Message.Builder
role(Message.Role role)
The entity that produced the message. final Message.Builder
role(JsonField<Message.Role> role)
Sets Builder.role to an arbitrary JSON value. final Message.Builder
runId(String runId)
The ID of the run associated with the creation of this message. final Message.Builder
runId(Optional<String> runId)
Alias for calling Builder.runId with runId.orElse(null)
.final Message.Builder
runId(JsonField<String> runId)
Sets Builder.runId to an arbitrary JSON value. final Message.Builder
status(Message.Status status)
The status of the message, which can be either in_progress
,incomplete
, orcompleted
.final Message.Builder
status(JsonField<Message.Status> status)
Sets Builder.status to an arbitrary JSON value. final Message.Builder
threadId(String threadId)
The thread ID that this message belongs to. final Message.Builder
threadId(JsonField<String> threadId)
Sets Builder.threadId to an arbitrary JSON value. final Message.Builder
additionalProperties(Map<String, JsonValue> additionalProperties)
final Message.Builder
putAdditionalProperty(String key, JsonValue value)
final Message.Builder
putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
final Message.Builder
removeAdditionalProperty(String key)
final Message.Builder
removeAllAdditionalProperties(Set<String> keys)
final Message
build()
Returns an immutable instance of Message. -
-
Method Detail
-
id
final Message.Builder id(String id)
The identifier, which can be referenced in API endpoints.
-
id
final Message.Builder id(JsonField<String> id)
Sets Builder.id to an arbitrary JSON value.
You should usually call Builder.id with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
assistantId
final Message.Builder assistantId(String assistantId)
If applicable, the ID of the assistant that authored this message.
-
assistantId
final Message.Builder assistantId(Optional<String> assistantId)
Alias for calling Builder.assistantId with
assistantId.orElse(null)
.
-
assistantId
final Message.Builder assistantId(JsonField<String> assistantId)
Sets Builder.assistantId to an arbitrary JSON value.
You should usually call Builder.assistantId with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
attachments
final Message.Builder attachments(List<Message.Attachment> attachments)
A list of files attached to the message, and the tools they were added to.
-
attachments
final Message.Builder attachments(Optional<List<Message.Attachment>> attachments)
Alias for calling Builder.attachments with
attachments.orElse(null)
.
-
attachments
final Message.Builder attachments(JsonField<List<Message.Attachment>> attachments)
Sets Builder.attachments to an arbitrary JSON value.
You should usually call Builder.attachments with a well-typed
List<Attachment>
value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addAttachment
final Message.Builder addAttachment(Message.Attachment attachment)
Adds a single Attachment to attachments.
-
completedAt
final Message.Builder completedAt(Long completedAt)
The Unix timestamp (in seconds) for when the message was completed.
-
completedAt
final Message.Builder completedAt(Long completedAt)
Alias for Builder.completedAt.
This unboxed primitive overload exists for backwards compatibility.
-
completedAt
final Message.Builder completedAt(Optional<Long> completedAt)
Alias for calling Builder.completedAt with
completedAt.orElse(null)
.
-
completedAt
final Message.Builder completedAt(JsonField<Long> completedAt)
Sets Builder.completedAt to an arbitrary JSON value.
You should usually call Builder.completedAt with a well-typed Long value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
content
final Message.Builder content(List<MessageContent> content)
The content of the message in array of text and/or images.
-
content
final Message.Builder content(JsonField<List<MessageContent>> content)
Sets Builder.content to an arbitrary JSON value.
You should usually call Builder.content with a well-typed
List<MessageContent>
value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
addContent
final Message.Builder addContent(MessageContent content)
Adds a single MessageContent to Builder.content.
-
addContent
final Message.Builder addContent(ImageFileContentBlock imageFile)
Alias for calling addContent with
MessageContent.ofImageFile(imageFile)
.
-
addContent
final Message.Builder addContent(ImageUrlContentBlock imageUrl)
Alias for calling addContent with
MessageContent.ofImageUrl(imageUrl)
.
-
addContent
final Message.Builder addContent(TextContentBlock text)
Alias for calling addContent with
MessageContent.ofText(text)
.
-
addContent
final Message.Builder addContent(RefusalContentBlock refusal)
Alias for calling addContent with
MessageContent.ofRefusal(refusal)
.
-
addImageFileContent
final Message.Builder addImageFileContent(ImageFile imageFile)
Alias for calling addContent with the following:
ImageFileContentBlock.builder() .imageFile(imageFile) .build()
-
addImageUrlContent
final Message.Builder addImageUrlContent(ImageUrl imageUrl)
Alias for calling addContent with the following:
ImageUrlContentBlock.builder() .imageUrl(imageUrl) .build()
-
addTextContent
final Message.Builder addTextContent(Text text)
Alias for calling addContent with the following:
TextContentBlock.builder() .text(text) .build()
-
addRefusalContent
final Message.Builder addRefusalContent(String refusal)
Alias for calling addContent with the following:
RefusalContentBlock.builder() .refusal(refusal) .build()
-
createdAt
final Message.Builder createdAt(Long createdAt)
The Unix timestamp (in seconds) for when the message was created.
-
createdAt
final Message.Builder createdAt(JsonField<Long> createdAt)
Sets Builder.createdAt to an arbitrary JSON value.
You should usually call Builder.createdAt with a well-typed Long value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
incompleteAt
final Message.Builder incompleteAt(Long incompleteAt)
The Unix timestamp (in seconds) for when the message was marked as incomplete.
-
incompleteAt
final Message.Builder incompleteAt(Long incompleteAt)
Alias for Builder.incompleteAt.
This unboxed primitive overload exists for backwards compatibility.
-
incompleteAt
final Message.Builder incompleteAt(Optional<Long> incompleteAt)
Alias for calling Builder.incompleteAt with
incompleteAt.orElse(null)
.
-
incompleteAt
final Message.Builder incompleteAt(JsonField<Long> incompleteAt)
Sets Builder.incompleteAt to an arbitrary JSON value.
You should usually call Builder.incompleteAt with a well-typed Long value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
incompleteDetails
final Message.Builder incompleteDetails(Message.IncompleteDetails incompleteDetails)
On an incomplete message, details about why the message is incomplete.
-
incompleteDetails
final Message.Builder incompleteDetails(Optional<Message.IncompleteDetails> incompleteDetails)
Alias for calling Builder.incompleteDetails with
incompleteDetails.orElse(null)
.
-
incompleteDetails
final Message.Builder incompleteDetails(JsonField<Message.IncompleteDetails> incompleteDetails)
Sets Builder.incompleteDetails to an arbitrary JSON value.
You should usually call Builder.incompleteDetails with a well-typed IncompleteDetails value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
metadata
final Message.Builder metadata(Message.Metadata metadata)
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.
Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.
-
metadata
final Message.Builder metadata(Optional<Message.Metadata> metadata)
Alias for calling Builder.metadata with
metadata.orElse(null)
.
-
metadata
final Message.Builder metadata(JsonField<Message.Metadata> metadata)
Sets Builder.metadata to an arbitrary JSON value.
You should usually call Builder.metadata with a well-typed Metadata value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
object_
final Message.Builder object_(JsonValue object_)
Sets the field to an arbitrary JSON value.
It is usually unnecessary to call this method because the field defaults to the following:
JsonValue.from("thread.message")
This method is primarily for setting the field to an undocumented or not yet supported value.
-
role
final Message.Builder role(Message.Role role)
The entity that produced the message. One of
user
orassistant
.
-
role
final Message.Builder role(JsonField<Message.Role> role)
Sets Builder.role to an arbitrary JSON value.
You should usually call Builder.role with a well-typed Role value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
runId
final Message.Builder runId(String runId)
The ID of the run associated with the creation of this message. Value is
null
when messages are created manually using the create message or create thread endpoints.
-
runId
final Message.Builder runId(Optional<String> runId)
Alias for calling Builder.runId with
runId.orElse(null)
.
-
runId
final Message.Builder runId(JsonField<String> runId)
Sets Builder.runId to an arbitrary JSON value.
You should usually call Builder.runId with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
status
final Message.Builder status(Message.Status status)
The status of the message, which can be either
in_progress
,incomplete
, orcompleted
.
-
status
final Message.Builder status(JsonField<Message.Status> status)
Sets Builder.status to an arbitrary JSON value.
You should usually call Builder.status with a well-typed Status value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
threadId
final Message.Builder threadId(String threadId)
The thread ID that this message belongs to.
-
threadId
final Message.Builder threadId(JsonField<String> threadId)
Sets Builder.threadId to an arbitrary JSON value.
You should usually call Builder.threadId with a well-typed String value instead. This method is primarily for setting the field to an undocumented or not yet supported value.
-
additionalProperties
final Message.Builder additionalProperties(Map<String, JsonValue> additionalProperties)
-
putAdditionalProperty
final Message.Builder putAdditionalProperty(String key, JsonValue value)
-
putAllAdditionalProperties
final Message.Builder putAllAdditionalProperties(Map<String, JsonValue> additionalProperties)
-
removeAdditionalProperty
final Message.Builder removeAdditionalProperty(String key)
-
removeAllAdditionalProperties
final Message.Builder removeAllAdditionalProperties(Set<String> keys)
-
build
final Message build()
Returns an immutable instance of Message.
Further updates to this Builder will not mutate the returned instance.
The following fields are required:
.id() .assistantId() .attachments() .completedAt() .content() .createdAt() .incompleteAt() .incompleteDetails() .metadata() .role() .runId() .status() .threadId()
-
-
-
-