Class Jackson3ChatMessageJsonCodec
java.lang.Object
dev.langchain4j.jackson3.Jackson3ChatMessageJsonCodec
- All Implemented Interfaces:
ChatMessageJsonCodec
Jackson 3 twin of
JacksonChatMessageJsonCodec.
Every annotation here except @JsonDeserialize comes from the shared
jackson-annotations artifact and is identical to the Jackson 2 version.
Only @JsonDeserialize lives in the databind package and therefore had to move.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic tools.jackson.databind.json.JsonMapper.BuildermessageFromJson(String json) Deserializes a JSON string to aChatMessageobject.messagesFromJson(String json) Deserializes a JSON string to a list ofChatMessageobjects.messagesToJson(List<ChatMessage> messages) Serializes a list ofChatMessageobjects to a JSON string.messageToJson(ChatMessage message) Serializes aChatMessageobject to a JSON string.
-
Constructor Details
-
Jackson3ChatMessageJsonCodec
public Jackson3ChatMessageJsonCodec()
-
-
Method Details
-
chatMessageJsonMapperBuilder
public static tools.jackson.databind.json.JsonMapper.Builder chatMessageJsonMapperBuilder() -
messageFromJson
Description copied from interface:ChatMessageJsonCodecDeserializes a JSON string to aChatMessageobject.- Specified by:
messageFromJsonin interfaceChatMessageJsonCodec- Parameters:
json- the JSON string.- Returns:
- the deserialized
ChatMessageobject.
-
messagesFromJson
Description copied from interface:ChatMessageJsonCodecDeserializes a JSON string to a list ofChatMessageobjects.- Specified by:
messagesFromJsonin interfaceChatMessageJsonCodec- Parameters:
json- the JSON string.- Returns:
- the deserialized list of
ChatMessageobjects.
-
messageToJson
Description copied from interface:ChatMessageJsonCodecSerializes aChatMessageobject to a JSON string.- Specified by:
messageToJsonin interfaceChatMessageJsonCodec- Parameters:
message- theChatMessageobject.- Returns:
- the serialized JSON string.
-
messagesToJson
Description copied from interface:ChatMessageJsonCodecSerializes a list ofChatMessageobjects to a JSON string.- Specified by:
messagesToJsonin interfaceChatMessageJsonCodec- Parameters:
messages- the list ofChatMessageobjects.- Returns:
- the serialized JSON string.
-