Package de.espirit.firstspirit.ai.dto
Interface Message
@Experimental
public interface Message
A specific message in the context of a generative AI request.
- Since:
- 5.2.240708
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilder for a message object.
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionstatic @NotNull Message.Builderbuilder()Creates a new builder for creating message object.static @NotNull MessageCreates a new text message.@NotNull List<MessagePart>Returns the message content parts.default <T extends MessagePart>
 @NotNull Stream<T>getContent(@NotNull Class<T> type) Returns the message content object.getIndex()Returns the index of a choice in the context of a response stream.@NotNull StringgetRole()Returns the configured role of the message author.getText()Returns textual content of this message, if available.Reference to a specific previously requestedToolCallthis message contains a response for.Returns a list of tools as part of an AI response, which are expected to be evaluated by the requester.
- 
Field Details- 
USERTypical role for a user prompt.- Since:
- 5.2.240708
- See Also:
 
- 
SYSTEMTypical role for a system prompt.- Since:
- 5.2.240708
- See Also:
 
- 
ASSISTANTTypical role for a prompt/response from the generative AI.- Since:
- 5.2.240708
- See Also:
 
- 
TOOLTypical role for a tool invocation.- Since:
- 5.2.250908
- See Also:
 
 
- 
- 
Method Details- 
builderCreates a new builder for creating message object.- Returns:
- The new builder instance.
- Since:
- 5.2.240708
 
- 
create@NotNull static @NotNull Message create(@NotNull @NotNull String role, @NotNull @NotNull String text) Creates a new text message.- Parameters:
- role- The role of the author (e.g. "user").
- text- The message text.
- Returns:
- The new message object.
- Since:
- 5.2.240708
 
- 
getRoleReturns the configured role of the message author. Any implementation of aGenerativeAIConnectorPluginis encouraged to support common roles like "user", "system" and "assistant", if possible. This allows users of theGenerativeAIAgentdo be as generic as possible.- Returns:
- The message role.
- Since:
- 5.2.240708
 
- 
getContentReturns the message content parts.- Returns:
- The message content.
- Since:
- 5.2.240708
 
- 
getContent@NotNull default <T extends MessagePart> @NotNull Stream<T> getContent(@NotNull @NotNull Class<T> type) Returns the message content object.- Returns:
- The message content.
- Since:
- 5.2.240708
 
- 
getTextReturns textual content of this message, if available.- Returns:
- The message content as text, or empty.
- Since:
- 5.2.240708
 
- 
getToolCallsReturns a list of tools as part of an AI response, which are expected to be evaluated by the requester.- Returns:
- The requested tool calls.
- Since:
- 5.2.250908
 
- 
getToolCallIdReference to a specific previously requestedToolCallthis message contains a response for.- Returns:
- The associated ToolCallidentifier, if available.
- Since:
- 5.2.250908
 
- 
getIndexReturns the index of a choice in the context of a response stream.- Returns:
- The index of the choice this message is associated with, if specified.
- Since:
- 5.2.250908
 
 
-