Class RagMessage
java.lang.Object
uno.anahata.asi.agi.event.BasicPropertyChangeSource
uno.anahata.asi.agi.message.AbstractMessage
uno.anahata.asi.agi.message.UserMessage
uno.anahata.asi.agi.message.RagMessage
- All Implemented Interfaces:
PropertyChangeSource, Rebindable
A specialized UserMessage that represents just-in-time, ephemeral context
provided by the environment (Retrieval-Augmented Generation).
This message and its parts are not part of the persistent conversation history and are exempt from all pruning logic.
- Author:
- Anahata
-
Field Summary
Fields inherited from class BasicPropertyChangeSource
propertyChangeSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFrom()Gets the identity of the sender of this message.getParts(boolean includePruned) Overrides the default part filtering logic.booleanOverrides the default pruning logic to declare that this message is ephemeral and should never be pruned.booleanHook for subclasses to declare if they should generate in-band metadata headers.Methods inherited from class UserMessage
addBlobPart, addBlobPart, addTextPart, getDevice, getRoleMethods inherited from class AbstractMessage
addPart, appendMetadata, asText, createMetadataHeader, getDepth, getEffectiveTokenCount, getIdentityLabel, getParts, getRemainingDepth, getTokenCount, isAllPinned, isAllPruned, isAnyPinned, isEmpty, isGarbageCollectable, isPrunnableOrRemovable, pinAllParts, pruneAllParts, remove, removePart, resetTokenCounts, setAutoAllPartsMethods inherited from class BasicPropertyChangeSource
addPropertyChangeListener, addPropertyChangeListener, rebind, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PropertyChangeSource
getPropertyChangeSupport
-
Constructor Details
-
RagMessage
-
-
Method Details
-
isEffectivelyPruned
public boolean isEffectivelyPruned()Overrides the default pruning logic to declare that this message is ephemeral and should never be pruned. This is the key to preventing the pruning system from trying to access the (null) Agi context of this non-history message.- Overrides:
isEffectivelyPrunedin classAbstractMessage- Returns:
- Always
false.
-
getParts
Overrides the default part filtering logic. Since a RagMessage is always ephemeral and relevant for the current turn, it always returns all of its parts, regardless of the pruning flag.- Overrides:
getPartsin classAbstractMessage- Parameters:
includePruned- This parameter is ignored.- Returns:
- A new list containing all parts of this message.
-
getFrom
Gets the identity of the sender of this message. For user messages, this is typically the user's name. For model messages, it's the model ID. For tool messages, it's the identity of the execution context.Returns the user's identity formatted as 'username@device'.
- Overrides:
getFromin classUserMessage- Returns:
- The sender's identity.
-
shouldCreateMetadata
public boolean shouldCreateMetadata()Hook for subclasses to declare if they should generate in-band metadata headers.- Overrides:
shouldCreateMetadatain classAbstractMessage- Returns:
trueif metadata headers should be generated.
-

