This class specifies the message content and optional attachments to send to
the assistant. All setter methods return this for method chaining.
Example Usage
var options = new MessageOptions().setPrompt("Explain this code")
.setAttachments(List.of(new Attachment("file", "/path/to/file.java", null)));
session.send(options).get();
Blob Attachment Example
var options = new MessageOptions().setPrompt("Describe this image").setAttachments(List.of(new BlobAttachment()
.setData("iVBORw0KGgoAAAANSUhEUg...").setMimeType("image/png").setDisplayName("screenshot.png")));
session.send(options).get();
- Since:
- 1.0.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates a shallow clone of thisMessageOptionsinstance.Gets the per-message agent UI mode.Gets the attachments.Gets the display prompt shown in the timeline instead of the prompt.getMode()Gets the delivery mode.Gets the message prompt.Gets the custom per-turn HTTP headers for outbound model requests.setAgentMode(AgentMode agentMode) Sets the per-message agent UI mode.setAttachments(List<? extends MessageAttachment> attachments) Sets attachments to include with the message.setDisplayPrompt(String displayPrompt) Sets the display prompt shown in the timeline instead of the prompt.Sets the message delivery mode.Sets the message prompt to send to the assistant.setRequestHeaders(Map<String, String> requestHeaders) Sets custom per-turn HTTP headers for outbound model requests.
-
Constructor Details
-
MessageOptions
public MessageOptions()
-
-
Method Details
-
getPrompt
Gets the message prompt.- Returns:
- the prompt text
-
setPrompt
Sets the message prompt to send to the assistant.- Parameters:
prompt- the message text- Returns:
- this options instance for method chaining
-
getAttachments
Gets the attachments.- Returns:
- the list of attachments
-
setAttachments
Sets attachments to include with the message.Attachments provide additional context to the assistant. Supported types:
Attachment— file, directory, code selection, or GitHub referenceBlobAttachment— inline base64-encoded binary data (e.g. images)
- Parameters:
attachments- the list of attachments- Returns:
- this options instance for method chaining
- See Also:
-
setMode
Sets the message delivery mode.Valid modes:
- "enqueue" - Queue the message for processing (default)
- "immediate" - Process the message immediately
- Parameters:
mode- the delivery mode- Returns:
- this options instance for method chaining
-
getMode
Gets the delivery mode.- Returns:
- the delivery mode
-
setAgentMode
Sets the per-message agent UI mode.Defaults to the session's current mode when unset.
- Parameters:
agentMode- the agent mode (for exampleAgentMode.PLANorAgentMode.AUTOPILOT)- Returns:
- this options instance for method chaining
-
getAgentMode
Gets the per-message agent UI mode.- Returns:
- the agent mode, or
nullif not set
-
getRequestHeaders
Gets the custom per-turn HTTP headers for outbound model requests.- Returns:
- the headers map, or
nullif not set
-
setRequestHeaders
Sets custom per-turn HTTP headers for outbound model requests.These headers are included in the model API request for this specific message turn. Use this to pass per-request authentication, tracing, or custom metadata.
- Parameters:
requestHeaders- the headers map- Returns:
- this options instance for method chaining
-
getDisplayPrompt
Gets the display prompt shown in the timeline instead of the prompt.- Returns:
- the display prompt, or
nullif not set
-
setDisplayPrompt
Sets the display prompt shown in the timeline instead of the prompt.If provided, this text is displayed in the conversation timeline UI instead of the actual prompt text.
- Parameters:
displayPrompt- the display prompt text- Returns:
- this options instance for method chaining
-
clone
Creates a shallow clone of thisMessageOptionsinstance.Mutable collection properties are copied into new collection instances so that modifications to those collections on the clone do not affect the original. Other reference-type properties (like attachment items) are not deep-cloned; the original and the clone will share those objects.
- Returns:
- a clone of this options instance
-