Class ChatMessageSerializer

java.lang.Object
dev.langchain4j.data.message.ChatMessageSerializer

public class ChatMessageSerializer extends Object
  • Constructor Details

    • ChatMessageSerializer

      public ChatMessageSerializer()
  • Method Details

    • messageToJson

      public static String messageToJson(ChatMessage message)
      Serializes a chat message into a JSON string.
      Parameters:
      message - Chat message to be serialized.
      Returns:
      A JSON string with the contents of the message.
      See Also:
    • messagesToJson

      public static String messagesToJson(List<ChatMessage> messages)
      Serializes a list of chat messages into a JSON string.
      Parameters:
      messages - The list of chat messages to be serialized.
      Returns:
      A JSON string representing provided chat messages.
      See Also: