Package com.tnsai.memory.strategy
Record Class TieredContextLoader.LoadedContext
java.lang.Object
java.lang.Record
com.tnsai.memory.strategy.TieredContextLoader.LoadedContext
- Record Components:
recentMessages- messages from Tier 1 (verbatim recent turns)summary- summary of older messages from Tier 2, null if no older messagesrelevantMessages- messages from Tier 3 (semantic search results)estimatedTokens- estimated total tokens across all tiers
- Enclosing class:
TieredContextLoader
public static record TieredContextLoader.LoadedContext(List<Map<String,Object>> recentMessages, String summary, List<Map<String,Object>> relevantMessages, int estimatedTokens)
extends Record
Result of tiered context loading.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.intReturns the value of theestimatedTokensrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of therecentMessagesrecord component.Returns the value of therelevantMessagesrecord component.summary()Returns the value of thesummaryrecord component.Combines all tiers into a single ordered message list.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
LoadedContext
public LoadedContext(List<Map<String, Object>> recentMessages, String summary, List<Map<String, Object>> relevantMessages, int estimatedTokens) Creates an instance of aLoadedContextrecord class.- Parameters:
recentMessages- the value for therecentMessagesrecord componentsummary- the value for thesummaryrecord componentrelevantMessages- the value for therelevantMessagesrecord componentestimatedTokens- the value for theestimatedTokensrecord component
-
-
Method Details
-
toMessageList
Combines all tiers into a single ordered message list.Order: [summary system message] + [relevant search results] + [recent messages]
This ordering ensures:
- Summary provides high-level context at the start
- Relevant past messages add specific detail
- Recent messages are closest to the end (most visible to LLM)
- Returns:
- combined message list ready for LLM context
-
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 '=='. -
recentMessages
Returns the value of therecentMessagesrecord component.- Returns:
- the value of the
recentMessagesrecord component
-
summary
Returns the value of thesummaryrecord component.- Returns:
- the value of the
summaryrecord component
-
relevantMessages
Returns the value of therelevantMessagesrecord component.- Returns:
- the value of the
relevantMessagesrecord component
-
estimatedTokens
public int estimatedTokens()Returns the value of theestimatedTokensrecord component.- Returns:
- the value of the
estimatedTokensrecord component
-