Record Class UnifiedContextAssembler.AssembledContext

java.lang.Object
java.lang.Record
com.tnsai.context.assembler.UnifiedContextAssembler.AssembledContext
Record Components:
messages - ordered list of messages ready for LLM
totalTokens - estimated total token count
budgetTokens - the token budget that was enforced
systemTokens - tokens used by system prompt + supplementary sections
historyTokens - tokens used by conversation history
includedSections - names of supplementary sections that were included
Enclosing class:
UnifiedContextAssembler

public static record UnifiedContextAssembler.AssembledContext(List<Map<String,Object>> messages, int totalTokens, int budgetTokens, int systemTokens, int historyTokens, List<String> includedSections) extends Record
Result of context assembly.
  • Constructor Details

    • AssembledContext

      public AssembledContext(List<Map<String,Object>> messages, int totalTokens, int budgetTokens, int systemTokens, int historyTokens, List<String> includedSections)
      Creates an instance of a AssembledContext record class.
      Parameters:
      messages - the value for the messages record component
      totalTokens - the value for the totalTokens record component
      budgetTokens - the value for the budgetTokens record component
      systemTokens - the value for the systemTokens record component
      historyTokens - the value for the historyTokens record component
      includedSections - the value for the includedSections record component
  • Method Details

    • budgetUtilization

      public double budgetUtilization()
      Returns the percentage of the budget used.
    • remainingTokens

      public int remainingTokens()
      Returns the remaining tokens in the budget.
    • isWithinBudget

      public boolean isWithinBudget()
      Returns true if the context fits within the budget.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • messages

      public List<Map<String,Object>> messages()
      Returns the value of the messages record component.
      Returns:
      the value of the messages record component
    • totalTokens

      public int totalTokens()
      Returns the value of the totalTokens record component.
      Returns:
      the value of the totalTokens record component
    • budgetTokens

      public int budgetTokens()
      Returns the value of the budgetTokens record component.
      Returns:
      the value of the budgetTokens record component
    • systemTokens

      public int systemTokens()
      Returns the value of the systemTokens record component.
      Returns:
      the value of the systemTokens record component
    • historyTokens

      public int historyTokens()
      Returns the value of the historyTokens record component.
      Returns:
      the value of the historyTokens record component
    • includedSections

      public List<String> includedSections()
      Returns the value of the includedSections record component.
      Returns:
      the value of the includedSections record component