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 Summary
Modifier and TypeInterfaceDescriptionstatic interface
Builder for a message object. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull Message.Builder
builder()
Creates a new builder for creating message object.static @NotNull Message
Creates 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.@NotNull String
getRole()
Returns the configured role of the message author.getText()
Returns textual content of this message, if available.
-
Field Details
-
USER
Typical role for a user prompt.- Since:
- 5.2.240708
- See Also:
-
SYSTEM
Typical role for a system prompt.- Since:
- 5.2.240708
- See Also:
-
ASSISTANT
Typical role for a prompt/response from the generative AI.- Since:
- 5.2.240708
- See Also:
-
-
Method Details
-
builder
Creates 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
-
getRole
Returns the configured role of the message author. Any implementation of aGenerativeAIConnectorPlugin
is encouraged to support common roles like "user", "system" and "assistant", if possible. This allows users of theGenerativeAIAgent
do be as generic as possible.- Returns:
- The message role.
- Since:
- 5.2.240708
-
getContent
Returns 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
-
getText
Returns textual content of this message, if available.- Returns:
- The message content as text, or empty.
- Since:
- 5.2.240708
-