Package com.sap.ai.sdk.orchestration

# Interface Message

All Known Implementing Classes:
  `AssistantMessage`, `SystemMessage`, `ToolMessage`, `UserMessage`

public sealed interface Message permits AssistantMessage, SystemMessage, ToolMessage, UserMessage
Interface representing convenience wrappers of chat message to the orchestration service.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static AssistantMessage`
  `assistant(String message)`
  A convenience method to create an assistant message.
  `MessageContent`
  `content()`
  Returns the content of the message.
  `ChatMessage`
  `createChatMessage()`
  Converts the message to a serializable ChatMessage object.
  `String`
  `role()`
  Returns the role of the assistant.
  `static SystemMessage`
  `system(String message)`
  A convenience method to create a system message from a string.
  `static UserMessage`
  `user(ImageItem imageItem)`
  A convenience method to create a user message containing only an image.
  `static UserMessage`
  `user(String message)`
  A convenience method to create a user message from a string.
  `static UserMessage`
  `user(Path filePath)`
  A convenience method to create a user message containing only a file loaded from disk.

- ## Method Details

  - ### user

    @Nonnull static UserMessage user(@Nonnull String message)
    A convenience method to create a user message from a string.
    Parameters:
      `message` - the message content.
    Returns:
      the user message.

  - ### user

    @Nonnull static UserMessage user(@Nonnull ImageItem imageItem)
    A convenience method to create a user message containing only an image.
    Parameters:
      `imageItem` - the message content.
    Returns:
      the user message.
    Since:
      1.3.0

  - ### user

    @Nonnull static UserMessage user(@Nonnull Path filePath)
    A convenience method to create a user message containing only a file loaded from disk.
    Parameters:
      `filePath` - the path to a local file.
    Returns:
      the user message.
    Since:
      1.18.0

  - ### assistant

    @Nonnull static AssistantMessage assistant(@Nonnull String message)
    A convenience method to create an assistant message.
    Parameters:
      `message` - the message content.
    Returns:
      the assistant message.

  - ### system

    @Nonnull static SystemMessage system(@Nonnull String message)
    A convenience method to create a system message from a string.
    Parameters:
      `message` - the message content.
    Returns:
      the system message.

  - ### createChatMessage

    @Nonnull ChatMessage createChatMessage()
    Converts the message to a serializable ChatMessage object.
    Returns:
      the corresponding `ChatMessage` object.

  - ### role

    @Nonnull String role()
    Returns the role of the assistant.
    Returns:
      the role.

  - ### content

    @Nonnull MessageContent content()
    Returns the content of the message.
    Returns:
      the content.