Class ChatMessage

java.lang.Object
com.redis.vl.extensions.messagehistory.ChatMessage

public class ChatMessage extends Object
A single chat message exchanged between a user and an LLM.

Matches the Python ChatMessage model from redisvl.extensions.message_history.schema

  • Constructor Details

    • ChatMessage

      public ChatMessage()
  • Method Details

    • toDict

      public Map<String,Object> toDict()
      Converts the ChatMessage to a Map suitable for storing in Redis.
      Returns:
      Map representation of the message
    • fromDict

      public static ChatMessage fromDict(Map<String,Object> data)
      Creates a ChatMessage from a Map (typically from Redis).
      Parameters:
      data - Map containing message fields
      Returns:
      ChatMessage instance