Record Class LLMSystemPrompt.Identity

java.lang.Object
java.lang.Record
me.neurodock.core.LLMSystemPrompt.Identity
Record Components:
name - the model's given name (e.g. "Alice"), or null/blank to omit
role - the model's role (e.g. "Personal assistant"), or null/blank to omit
purpose - the model's purpose/goal, or null/blank to omit
Enclosing class:
LLMSystemPrompt

public static record LLMSystemPrompt.Identity(String name, String role, String purpose) extends Record
The persona/role block of a system prompt — who the model is and what it's for.

At least one of name, role, or purpose must be non-blank; build() throws if all three are absent, since an empty identity block is almost certainly a mistake rather than an intentional choice.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Identity(String name, String role, String purpose)
    Creates an instance of a Identity record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Builds the identity sentence from whichever of name, role, and purpose are present, joining them with commas.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the name record component.
    Returns the value of the purpose record component.
    Returns the value of the role record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

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

    • Identity

      public Identity(String name, String role, String purpose)
      Creates an instance of a Identity record class.
      Parameters:
      name - the value for the name record component
      role - the value for the role record component
      purpose - the value for the purpose record component
  • Method Details

    • build

      public String build()
      Builds the identity sentence from whichever of name, role, and purpose are present, joining them with commas.
      Returns:
      the composed identity sentence, e.g. "You are Alice, Your role is Personal assistant"
      Throws:
      IllegalArgumentException - if name, role, and purpose are all null or blank
    • 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.
    • name

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

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

      public String purpose()
      Returns the value of the purpose record component.
      Returns:
      the value of the purpose record component