Package dev.langchain4j.data.message
Class ChatMessageSerializer
java.lang.Object
dev.langchain4j.data.message.ChatMessageSerializer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
messagesToJson
(List<ChatMessage> messages) Serializes a list of chat messages into a JSON string.static String
messageToJson
(ChatMessage message) Serializes a chat message into a JSON string.
-
Constructor Details
-
ChatMessageSerializer
public ChatMessageSerializer()
-
-
Method Details
-
messageToJson
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
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:
-