Record Class UIMessage

java.lang.Object
java.lang.Record
com.axelor.ai.chat.UIMessage
Record Components:
id - unique message ID
role - who sent the message
parts - the content parts that make up this message
metadata - optional provider-specific metadata

public record UIMessage(String id, UIMessage.Role role, List<UIPart> parts, Object metadata) extends Record
A message in the conversation history.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The sender of a message.
  • Constructor Summary

    Constructors
    Constructor
    Description
    UIMessage(String id, UIMessage.Role role, List<UIPart> parts, Object metadata)
    Creates an instance of a UIMessage record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    True when this message answers a tool approval: a part carrying an allow/deny decision.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    id()
    Returns the value of the id record component.
    boolean
    True for a USER row that is only a typed event marker (invite/remove — data parts, no conversation).
    Returns the value of the metadata record component.
    Returns the value of the parts record component.
    Returns the value of the role record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • UIMessage

      public UIMessage(String id, UIMessage.Role role, List<UIPart> parts, Object metadata)
      Creates an instance of a UIMessage record class.
      Parameters:
      id - the value for the id record component
      role - the value for the role record component
      parts - the value for the parts record component
      metadata - the value for the metadata record component
  • Method Details

    • isEventOnly

      public boolean isEventOnly()
      True for a USER row that is only a typed event marker (invite/remove — data parts, no conversation). Event rows are audit/UI records: the provider skips them in replay, and the discussion-mode fold consumes them as delimited, non-instructional context.
    • answersApproval

      public boolean answersApproval()
      True when this message answers a tool approval: a part carrying an allow/deny decision.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • role

      public UIMessage.Role role()
      Returns the value of the role record component.
      Returns:
      the value of the role record component
    • parts

      public List<UIPart> parts()
      Returns the value of the parts record component.
      Returns:
      the value of the parts record component
    • metadata

      public Object metadata()
      Returns the value of the metadata record component.
      Returns:
      the value of the metadata record component