Class ToolResponseAttachment

java.lang.Object
uno.anahata.asi.agi.tool.ToolResponseAttachment
All Implemented Interfaces:
Displayable

public final class ToolResponseAttachment extends Object implements Displayable
Represents a binary attachment associated with a tool's response. This is used to capture non-textual output from tool execution, such as images, PDFs, or other data blobs.
Author:
anahata
  • Field Details

    • data

      private final byte[] data
      The raw binary data of the attachment.
    • mimeType

      private final String mimeType
      The MIME type of the data (e.g., "image/png").
    • sourcePath

      private final Path sourcePath
      The source file path if this attachment was created from a local file. Can be null.
  • Constructor Details

    • ToolResponseAttachment

      public ToolResponseAttachment(byte[] data, String mimeType)
      Constructs a ToolResponseAttachment from raw byte data and MIME type.
      Parameters:
      data - The raw binary data of the attachment.
      mimeType - The MIME type of the data.
    • ToolResponseAttachment

      public ToolResponseAttachment(byte[] data, String mimeType, Path sourcePath)
      Constructs a ToolResponseAttachment with source file path traceability.
      Parameters:
      data - The raw binary data of the attachment.
      mimeType - The MIME type of the data.
      sourcePath - The original source path on disk, or null.
  • Method Details

    • toString

      public String toString()

      Returns a human-readable representation of this attachment, formatting the byte size via FileUtils.byteCountToDisplaySize(long) and including the MIME type and source path if present.

      Overrides:
      toString in class Object
    • getDisplayValue

      public String getDisplayValue()
      Returns the human-readable display value representing this entity in UI views.

      Returns a concise human-readable display string representing this attachment, showing the file name (if available), formatted byte size, and MIME type.

      Specified by:
      getDisplayValue in interface Displayable
      Returns:
      The display string.