Class UserBlobPart
java.lang.Object
uno.anahata.asi.agi.event.BasicPropertyChangeSource
uno.anahata.asi.agi.message.AbstractPart
uno.anahata.asi.agi.message.BlobPart
uno.anahata.asi.agi.message.UserBlobPart
- All Implemented Interfaces:
PropertyChangeSource, Rebindable
-
Field Summary
Fields inherited from class BasicPropertyChangeSource
propertyChangeSupportModifier and TypeFieldDescriptionprotected PropertyChangeSupportSupport for firing property change events. -
Constructor Summary
ConstructorsConstructorDescriptionUserBlobPart(@NonNull AbstractMessage message, @NonNull String mimeType, @NonNull byte[] data) Constructs a new UserBlobPart and adds it to the parent message.UserBlobPart(@NonNull AbstractMessage message, @NonNull String mimeType, @NonNull byte[] data, @NonNull Path sourcePath) -
Method Summary
Modifier and TypeMethodDescriptionstatic UserBlobPartfrom(@NonNull AbstractMessage message, @NonNull File file) A convenience factory method to create a UserBlobPart from a legacyFileobject.static UserBlobPartfrom(@NonNull AbstractMessage message, @NonNull Path path) A convenience factory method to create a UserBlobPart from a local file path.Methods inherited from class BlobPart
appendMetadata, asText, calculateTokenCount, getDefaultMaxDepth, getPrunedHintModifier and TypeMethodDescriptionprotected voidHook for subclasses to inject specialized metadata into the part header.asText()Returns the content of the part as a simple string.protected voidPerforms the lazy, model-specific token calculation for this part.protected intTemplate method hook for subclasses to provide their specific default max depth policy.Returns a summarized string representation of the part's content to be used as a "Hint" when the part is effectively pruned.Methods inherited from class AbstractPart
createMetadataHeader, getAgi, getAgiConfig, getEffectiveMaxDepth, getEffectiveTokenCount, getIdentityLabel, getMetadataTokenCount, getRemainingDepth, getTokenCount, isAuto, isEffectivelyPruned, isPinned, isPruned, remove, resetTokenCount, setExpanded, setPruningState, setPruningState, setTokenCountModifier and TypeMethodDescriptionCreates a standardized text header containing metadata for this part.getAgi()Gets the parent agi session.Gets the agi configuration.final intThe definitive method for resolving the max depth policy for this part.intCalculates the total "effective" tokens contributed by this part.protected StringReturns the identity label for the metadata header (e.g., "Part ID: 45").intCalculates the token count of the metadata header for this part.intCalculates the remaining depth before this part is auto-pruned.intRetrieves the cached token count for this part.booleanisAuto()Checks if this part is managed automatically.booleanCalculates the EFFECTIVE pruned state of this part.booleanisPinned()Checks if this part is explicitly pinned.booleanisPruned()Checks if this part is explicitly pruned.voidremove()Removes this part from its parent message and severs the bidirectional link.voidResets the cached token count, forcing a lazy, background recalculation on the next call to getTokenCount().voidsetExpanded(boolean expanded) Sets the expanded state and fires a property change event.voidsetPruningState(PruningState pruningState) Sets the pruning state of this part and fires a property change event.voidsetPruningState(PruningState pruningState, String reason) Sets the pruning state of this part with an optional reason.voidsetTokenCount(int tokenCount) Sets the token count and fires a property change event.Methods inherited from class BasicPropertyChangeSource
addPropertyChangeListener, addPropertyChangeListener, rebind, removePropertyChangeListener, removePropertyChangeListenerModifier and TypeMethodDescriptionvoidAdds a property change listener.voidaddPropertyChangeListener(String propertyName, PropertyChangeListener listener) Adds a property change listener for a specific property.voidrebind()Re-initializes the transientPropertyChangeSupportafter deserialization.voidRemoves a property change listener.voidremovePropertyChangeListener(String propertyName, PropertyChangeListener listener) Removes a property change listener for a specific property.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PropertyChangeSource
getPropertyChangeSupportModifier and TypeMethodDescriptionGets the PropertyChangeSupport instance for this object.
-
Constructor Details
-
UserBlobPart
UserBlobPart(@NonNull @NonNull AbstractMessage message, @NonNull @NonNull String mimeType, @NonNull @NonNull byte[] data) Constructs a new UserBlobPart and adds it to the parent message.- Parameters:
message- The parent message.mimeType- The MIME type.data- The binary data.
-
UserBlobPart
UserBlobPart(@NonNull @NonNull AbstractMessage message, @NonNull @NonNull String mimeType, @NonNull @NonNull byte[] data, @NonNull @NonNull Path sourcePath)
-
-
Method Details
-
from
public static UserBlobPart from(@NonNull @NonNull AbstractMessage message, @NonNull @NonNull Path path) throws Exception A convenience factory method to create a UserBlobPart from a local file path.- Parameters:
message- The message this part belongs to.path- The path to the file.- Returns:
- A new UserBlobPart instance.
- Throws:
IOException- if there's an error reading the file.Exception- if there's an error detecting the MIME type.
-
from
public static UserBlobPart from(@NonNull @NonNull AbstractMessage message, @NonNull @NonNull File file) throws Exception A convenience factory method to create a UserBlobPart from a legacyFileobject.- Parameters:
message- The message this part belongs to.file- The file to read.- Returns:
- A new UserBlobPart instance.
- Throws:
Exception- if there's an error reading the file or detecting the MIME type.
-

