Class SemanticChatMessage
java.lang.Object
com.redis.vl.extensions.messagehistory.SemanticChatMessage
A chat message with vector embedding for semantic search.
Extends the ChatMessage model with a vector field for storing embeddings. Matches the Python ChatMessage model from redisvl.extensions.message_history.schema when used with SemanticMessageHistory.
This class is final to prevent finalizer attacks (SEI CERT OBJ11-J).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SemanticChatMessageCreates a SemanticChatMessage from a Map (typically from Redis).toDict()Converts the SemanticChatMessage to a Map using default float32 dtype.Converts the SemanticChatMessage to a Map suitable for storing in Redis.
-
Constructor Details
-
SemanticChatMessage
public SemanticChatMessage()
-
-
Method Details
-
toDict
Converts the SemanticChatMessage to a Map suitable for storing in Redis.- Parameters:
dtype- The data type for the vector field (e.g., "float32")- Returns:
- Map representation of the message
-
toDict
Converts the SemanticChatMessage to a Map using default float32 dtype.- Returns:
- Map representation of the message
-
fromDict
Creates a SemanticChatMessage from a Map (typically from Redis).- Parameters:
data- Map containing message fields- Returns:
- SemanticChatMessage instance
-