Class AssistantMessage

java.lang.Object
com.sap.ai.sdk.orchestration.AssistantMessage
All Implemented Interfaces:
Message

public final class AssistantMessage extends Object implements Message
Represents a chat message as 'assistant' to the orchestration service.
  • Constructor Details

    • AssistantMessage

      public AssistantMessage(@Nonnull String singleMessage)
      Creates a new assistant message with the given single message.
      Parameters:
      singleMessage - the single message.
    • AssistantMessage

      @Deprecated public AssistantMessage(@Nonnull List<MessageToolCall> toolCalls)
      Deprecated.
      Please use withToolCalls(List) instead.
      Creates a new assistant message with the given tool calls.
      Parameters:
      toolCalls - list of tool call objects
  • Method Details

    • withToolCalls

      @Nonnull public AssistantMessage withToolCalls(@Nonnull List<MessageToolCall> toolCalls)
      Returns a new AssistantMessage instance with the provided tool calls added to the existing ones.
      Parameters:
      toolCalls - the list of tool calls to add.
      Returns:
      a new AssistantMessage instance with the combined tool calls.
    • createChatMessage

      @Nonnull public ChatMessage createChatMessage()
      Description copied from interface: Message
      Converts the message to a serializable ChatMessage object.
      Specified by:
      createChatMessage in interface Message
      Returns:
      the corresponding ChatMessage object.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • role

      @Nonnull public String role()
      The role of the assistant.
      Specified by:
      role in interface Message
      Returns:
      the role.
    • toolCalls

      @Nullable public List<MessageToolCall> toolCalls()
      Tool call if there is any.
    • content

      @Nonnull public MessageContent content()
      The content of the message.
      Specified by:
      content in interface Message
      Returns:
      the content.