Class DeltaMessage

java.lang.Object
nl.dannyj.mistral.models.completion.message.DeltaMessage

public class DeltaMessage extends Object
Represents the delta content within a streamed chat completion choice. Contains partial updates for role, content, or tool calls.
  • Constructor Details

    • DeltaMessage

      public DeltaMessage(@Nullable MessageRole role, @Nullable List<ContentChunk> content, @Nullable List<ToolCall> toolCalls)
      Creates a new DeltaMessage instance.
      Parameters:
      role - The message role, or null if not present in this delta.
      content - The partial content list or string, or null.
      toolCalls - The partial list of tool calls, or null.
    • DeltaMessage

      public DeltaMessage()
  • Method Details

    • getTextContent

      @Nullable public String getTextContent()
      Gets the text content of the delta message. This is a convenience method that extracts the text from all TextChunks, ignoring other types of content.
      Returns:
      The concatenated text content of the message, or null if no text content is present.
    • getRole

      @Nullable public MessageRole getRole()
      The role of the message sender (e.g., assistant). Only sent if it changes or at the start.
      Returns:
      The message role, or null.
    • getContent

      @Nullable public List<ContentChunk> getContent()
      A part of the message content. Can be null if this delta updates role or tool calls. Can be a string or a list of ContentChunks.
      Returns:
      The partial content list or string, or null.
    • getToolCalls

      @Nullable public List<ToolCall> getToolCalls()
      A partial list of tool calls requested by the model. Can be null.
      Returns:
      The partial list of tool calls, or null.
    • toString

      public String toString()
      Overrides:
      toString in class Object