Class AbstractMessage
java.lang.Object
org.springframework.ai.chat.messages.AbstractMessage
- Direct Known Subclasses:
AssistantMessage, SystemMessage, ToolResponseMessage, UserMessage
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe key for the message type in the metadata.protected final MessageTypeThe message type of the message.Additional options for the message to influence the response, not a generative map.protected final StringThe content of the message. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMessage(MessageType messageType, String textContent, Map<String, Object> metadata) Create a new AbstractMessage with the given message type, text content, and metadata.protectedAbstractMessage(MessageType messageType, org.springframework.core.io.Resource resource, Map<String, Object> metadata) Create a new AbstractMessage with the given message type, resource, and metadata. -
Method Summary
-
Field Details
-
MESSAGE_TYPE
-
messageType
The message type of the message. -
textContent
The content of the message. -
metadata
-
-
Constructor Details
-
AbstractMessage
protected AbstractMessage(MessageType messageType, @Nullable String textContent, Map<String, Object> metadata) Create a new AbstractMessage with the given message type, text content, and metadata.- Parameters:
messageType- the message typetextContent- the text contentmetadata- the metadata
-
AbstractMessage
protected AbstractMessage(MessageType messageType, org.springframework.core.io.Resource resource, Map<String, Object> metadata) Create a new AbstractMessage with the given message type, resource, and metadata.- Parameters:
messageType- the message typeresource- the resourcemetadata- the metadata
-
-
Method Details
-
getText
-
getMetadata
Get the metadata of the message.- Specified by:
getMetadatain interfaceContent- Returns:
- the metadata of the message
-
getMessageType
Get the message type of the message.- Specified by:
getMessageTypein interfaceMessage- Returns:
- the message type of the message
-
equals
-
hashCode
-