Package dev.langchain4j.data.message
Class ChatMessageSerializer
-
- All Implemented Interfaces:
public class ChatMessageSerializer
-
-
Constructor Summary
Constructors Constructor Description ChatMessageSerializer()
-
Method Summary
Modifier and Type Method Description static String
messageToJson(ChatMessage message)
Serializes a chat message into a JSON string. static String
messagesToJson(List<ChatMessage> messages)
Serializes a list of chat messages into a JSON string. -
-
Method Detail
-
messageToJson
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.
-
messagesToJson
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.
-
-
-
-