Class ModelTextPart
java.lang.Object
uno.anahata.asi.agi.event.BasicPropertyChangeSource
uno.anahata.asi.agi.message.AbstractPart
uno.anahata.asi.agi.message.TextPart
uno.anahata.asi.agi.message.ModelTextPart
- All Implemented Interfaces:
PropertyChangeSource, ThoughtSignature, Rebindable
- Direct Known Subclasses:
HostedCodeExecutionCallPart, HostedCodeExecutionResultPart, WebSearchCallPart
A specialized
TextPart for content generated by an AI model.
Beyond standard text, this implementation is capable of encapsulating the model's internal 'Thinking Process'. It manages the visibility of these thoughts in the UI layer and maintains its own max-depth policy to optimize context window usage.
- Author:
- anahata
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanIndicates if this part represents internal model reasoning (thoughts).private byte[]The signature byte array of the thought process, used for verification.Fields inherited from class BasicPropertyChangeSource
propertyChangeSupport -
Constructor Summary
ConstructorsConstructorDescriptionModelTextPart(AbstractModelMessage message, String text, byte[] thoughtSignature, boolean thought) Constructs a new ModelTextPart. -
Method Summary
Modifier and TypeMethodDescriptionprotected intTemplate method hook for subclasses to provide their specific default max depth policy.booleanIndicates if this text part represents a model thought process.Methods inherited from class TextPart
appendMetadata, appendText, asText, calculateTokenCount, resetTokenCount, setTextMethods inherited from class AbstractPart
createMetadataHeader, getAgi, getAgiConfig, getEffectiveMaxDepth, getEffectiveTokenCount, getIdentityLabel, getMetadataTokenCount, getPrunedHint, getRemainingDepth, getTokenCount, isAuto, isEffectivelyPruned, isPinned, isPruned, remove, setExpanded, setPruningState, setPruningState, setTokenCountMethods 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
getPropertyChangeSupportMethods inherited from interface ThoughtSignature
getThoughtSignature, setThoughtSignature
-
Field Details
-
thoughtSignature
private byte[] thoughtSignatureThe signature byte array of the thought process, used for verification. -
thought
private boolean thoughtIndicates if this part represents internal model reasoning (thoughts).
-
-
Constructor Details
-
ModelTextPart
public ModelTextPart(AbstractModelMessage message, String text, byte[] thoughtSignature, boolean thought) Constructs a new ModelTextPart.- Parameters:
message- The model message this part belongs to. Must be aAbstractModelMessage.text- The text content.thoughtSignature- The signature of the thought process as a byte array.thought- Whether this part represents a thought process.
-
-
Method Details
-
isThought
public boolean isThought()Indicates if this text part represents a model thought process. For a generic TextPart, this is always false.Indicates whether this part contains internal model reasoning (thoughts) rather than direct conversational output.
-
getDefaultMaxDepth
protected int getDefaultMaxDepth()Template method hook for subclasses to provide their specific default max depth policy. This is the fallback value used when no explicitmaxDepthis set on the instance. Returns the default maximum depth to keep a text part in context, as defined in the agi configuration. Returns the default maximum depth for thoughts if this is a thought part, otherwise falls back to the standard text part depth.- Overrides:
getDefaultMaxDepthin classTextPart- Returns:
- The default maximum depth for this part type.
-

