Package com.tnsai.context.assembler
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 LLMtotalTokens- estimated total token countbudgetTokens- the token budget that was enforcedsystemTokens- tokens used by system prompt + supplementary sectionshistoryTokens- tokens used by conversation historyincludedSections- 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thebudgetTokensrecord component.doubleReturns the percentage of the budget used.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of thehistoryTokensrecord component.Returns the value of theincludedSectionsrecord component.booleanReturns true if the context fits within the budget.messages()Returns the value of themessagesrecord component.intReturns the remaining tokens in the budget.intReturns the value of thesystemTokensrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thetotalTokensrecord component.
-
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 aAssembledContextrecord class.- Parameters:
messages- the value for themessagesrecord componenttotalTokens- the value for thetotalTokensrecord componentbudgetTokens- the value for thebudgetTokensrecord componentsystemTokens- the value for thesystemTokensrecord componenthistoryTokens- the value for thehistoryTokensrecord componentincludedSections- the value for theincludedSectionsrecord 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
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
messages
Returns the value of themessagesrecord component.- Returns:
- the value of the
messagesrecord component
-
totalTokens
public int totalTokens()Returns the value of thetotalTokensrecord component.- Returns:
- the value of the
totalTokensrecord component
-
budgetTokens
public int budgetTokens()Returns the value of thebudgetTokensrecord component.- Returns:
- the value of the
budgetTokensrecord component
-
systemTokens
public int systemTokens()Returns the value of thesystemTokensrecord component.- Returns:
- the value of the
systemTokensrecord component
-
historyTokens
public int historyTokens()Returns the value of thehistoryTokensrecord component.- Returns:
- the value of the
historyTokensrecord component
-
includedSections
Returns the value of theincludedSectionsrecord component.- Returns:
- the value of the
includedSectionsrecord component
-