-
public class AIMessagePart.Companion
-
-
Field Summary
Fields Modifier and Type Field Description private final StringTYPE_PREFIXprivate final IntegerSUPPORTED_VERSIONpublic final static AIMessagePart.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final List<AIMessagePart>parts(List<Pair<String, Map<String, Object>>> attachments)Decodes the AI steps among a message's attachments, in order. 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. final AIMessagePartfrom(String type, Map<String, Object> payload, Integer position)Decodes one attachment, or returns nullwhen it is not an AI step.final AIMessagePartfromJson(String type, String json, Integer position)Decodes one attachment from its payload as JSON text, or returns nullwhen it is not an AI step.final StringgetTYPE_PREFIX()The attachment type prefix every AI step uses. final IntegergetSUPPORTED_VERSION()The newest format version of the built-in kinds this SDK understands. -
-
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
nullwhen 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
nullwhen 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.
-
getTYPE_PREFIX
final String getTYPE_PREFIX()
The attachment type prefix every AI step uses.
-
getSUPPORTED_VERSION
final Integer getSUPPORTED_VERSION()
The newest format version of the built-in kinds this SDK understands.
-
-
-
-