Class AssistantMessage

java.lang.Object
nl.dannyj.mistral.models.completion.message.ChatMessage
nl.dannyj.mistral.models.completion.message.AssistantMessage

public class AssistantMessage extends ChatMessage
Represents a message with the 'assistant' role in a chat conversation. Assistant messages contain the model's responses, which might include text content and/or tool calls.
  • Constructor Details

    • AssistantMessage

      public AssistantMessage(@NonNull @NonNull String textContent)
      Constructs an AssistantMessage with text content.
      Parameters:
      textContent - The text content.
    • AssistantMessage

      public AssistantMessage(@NonNull @NotEmpty @NonNull @NotEmpty List<ToolCall> toolCalls)
      Constructs an AssistantMessage with tool calls.
      Parameters:
      toolCalls - The list of tool calls. Cannot be null or empty.
    • AssistantMessage

      public AssistantMessage(@Nullable List<ContentChunk> content, @Nullable List<ToolCall> toolCalls)
      Constructs an AssistantMessage with both text content and tool calls. Use setters if only one is needed or to set the prefix flag.
      Parameters:
      content - The list of content chunks. Can be null.
      toolCalls - The list of tool calls. Can be null.
    • AssistantMessage

      public AssistantMessage()
  • Method Details

    • getRole

      public MessageRole getRole()
      Gets the role of this message.
      Specified by:
      getRole in class ChatMessage
      Returns:
      Always returns MessageRole.ASSISTANT.
    • equals

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

      protected boolean canEqual(Object other)
    • hashCode

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

      @Nullable public List<ToolCall> getToolCalls()
      A list of tool calls requested by the model. Can be null if the message only contains text content.
      Returns:
      The list of tool calls, or null.
    • setToolCalls

      public void setToolCalls(@Nullable List<ToolCall> toolCalls)
      A list of tool calls requested by the model. Can be null if the message only contains text content.
      Parameters:
      toolCalls - The list of tool calls, or null.
    • isPrefix

      public boolean isPrefix()
      Indicates if this assistant message acts as a prefix to guide the model's subsequent response. Defaults to false.
      Returns:
      The prefix flag state.
    • setPrefix

      public void setPrefix(boolean prefix)
      Indicates if this assistant message acts as a prefix to guide the model's subsequent response. Defaults to false.
      Parameters:
      prefix - True if this is a prefix message, false otherwise.