Package 

Object AIMessagePart.Companion

    • Method Detail

      • parts

         final List<AIMessagePart> parts(List<Pair<String, Map<String, Object>>> attachments)

        Decodes the AI steps among a message's attachments, in order. Attachments that are not AI steps (images, files and so on) are skipped.

        Parameters:
        attachments - Each attachment's type and payload, in the message's order.
      • partsFromJson

         final List<AIMessagePart> partsFromJson(List<Pair<String, String>> attachments)

        Decodes the AI steps among a message's attachments, with each payload as JSON text, in order. Attachments that are not AI steps are skipped, and a payload that is not a JSON object reads as empty.

        Parameters:
        attachments - Each attachment's type and payload as JSON text, in the message's order.
      • from

         final AIMessagePart from(String type, Map<String, Object> payload, Integer position)

        Decodes one attachment, or returns null when it is not an AI step.

        Parameters:
        type - The attachment type.
        payload - The attachment payload.
        position - The attachment's index, used as the identity of a step that carries no ID of its own.
      • fromJson

         final AIMessagePart fromJson(String type, String json, Integer position)

        Decodes one attachment from its payload as JSON text, or returns null when it is not an AI step. A payload that is not a JSON object reads as empty.

        Parameters:
        type - The attachment type.
        json - The attachment payload as JSON text.
        position - The attachment's index, used as the identity of a step that carries no ID of its own.