Class ChatCompletionMessagePart.ChatCompletionMessagePartListDeSerializer
- java.lang.Object
-
- com.composum.ai.backend.base.service.chat.impl.chatmodel.ChatCompletionMessagePart.ChatCompletionMessagePartListDeSerializer
-
- All Implemented Interfaces:
com.google.gson.JsonDeserializer<List<ChatCompletionMessagePart>>
,com.google.gson.JsonSerializer<List<ChatCompletionMessagePart>>
- Enclosing class:
- ChatCompletionMessagePart
public static class ChatCompletionMessagePart.ChatCompletionMessagePartListDeSerializer extends Object implements com.google.gson.JsonDeserializer<List<ChatCompletionMessagePart>>, com.google.gson.JsonSerializer<List<ChatCompletionMessagePart>>
-
-
Constructor Summary
Constructors Constructor Description ChatCompletionMessagePartListDeSerializer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ChatCompletionMessagePart>
deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context)
com.google.gson.JsonElement
serialize(List<ChatCompletionMessagePart> src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
To save space: if there is only one element in src that also is a text message, we serialize it as a string, otherwise as object list.
-
-
-
Method Detail
-
deserialize
public List<ChatCompletionMessagePart> deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException
- Specified by:
deserialize
in interfacecom.google.gson.JsonDeserializer<List<ChatCompletionMessagePart>>
- Throws:
com.google.gson.JsonParseException
-
serialize
public com.google.gson.JsonElement serialize(List<ChatCompletionMessagePart> src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
To save space: if there is only one element in src that also is a text message, we serialize it as a string, otherwise as object list.- Specified by:
serialize
in interfacecom.google.gson.JsonSerializer<List<ChatCompletionMessagePart>>
-
-