/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. *--------------------------------------------------------------------------------------------*/ package com.github.copilot.sdk.json; import java.util.ArrayList; import java.util.Collections; import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; /** * Options for sending a message to a Copilot session. *
* This class specifies the message content and optional attachments to send to * the assistant. All setter methods return {@code this} for method chaining. * *
{@code
* var options = new MessageOptions().setPrompt("Explain this code")
* .setAttachments(List.of(new Attachment("file", "/path/to/file.java", null)));
*
* session.send(options).get();
* }
*
* {@code
* 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();
* }
*
* @see com.github.copilot.sdk.CopilotSession#send(MessageOptions)
* @since 1.0.0
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class MessageOptions {
private String prompt;
private List* Attachments provide additional context to the assistant. Supported types: *
* Valid modes: *
* 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. * * @return a clone of this options instance */ @Override public MessageOptions clone() { MessageOptions copy = new MessageOptions(); copy.prompt = this.prompt; copy.attachments = this.attachments != null ? new ArrayList<>(this.attachments) : null; copy.mode = this.mode; return copy; } }