Class ChatCompletionMessagePart.ChatCompletionMessagePartListDeSerializer

    • Constructor Detail

      • ChatCompletionMessagePartListDeSerializer

        public ChatCompletionMessagePartListDeSerializer()
    • 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 interface com.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 interface com.google.gson.JsonSerializer<List<ChatCompletionMessagePart>>