Package de.espirit.firstspirit.ai.dto
Interface Message.Builder
- Enclosing interface:
- Message
public static interface Message.Builder
Builder for a message object.
- Since:
- 5.2.240708
-
Method Summary
Modifier and TypeMethodDescription@NotNull Message.Builder
addContent
(@NotNull MessagePart part) Adds a new message content part to this message.default @NotNull Message.Builder
addImageUrl
(@NotNull String url) Adds an image URL to this message.default @NotNull Message.Builder
Adds textual content to this message.@NotNull Message.Builder
addToolCall
(@NotNull ToolCall toolCall) Adds a request for a specific tool invocation to this message, usually part of the AI response.@NotNull Message
create()
Creates a new message object.@NotNull Message.Builder
Specifies index of this message in the context of a response stream.@NotNull Message.Builder
Configures the role of the message author,Message.USER
by default.@NotNull Message.Builder
toolCallId
(@Nullable String toolCallId) Specifies the ID of the initialToolCall
this message contains a result for.
-
Method Details
-
addContent
@Contract("_ -> this") @NotNull @NotNull Message.Builder addContent(@NotNull @NotNull MessagePart part) Adds a new message content part to this message.- Parameters:
part
- The message content part to be added.- Returns:
- This builder instance.
- Since:
- 5.2.240708
-
addText
@Contract("_ -> this") @NotNull default @NotNull Message.Builder addText(@NotNull @NotNull String text) Adds textual content to this message.- Parameters:
text
- The text to be added.- Returns:
- This builder instance.
- Since:
- 5.2.240708
-
addImageUrl
@Contract("_ -> this") @NotNull default @NotNull Message.Builder addImageUrl(@NotNull @NotNull String url) Adds an image URL to this message.- Parameters:
url
- The image URL to be added.- Returns:
- This builder instance.
- Since:
- 5.2.240708
-
role
Configures the role of the message author,Message.USER
by default.- Parameters:
role
- The message author role.- Returns:
- This builder instance.
- Since:
- 5.2.240708
-
addToolCall
@Contract("_ -> this") @NotNull @NotNull Message.Builder addToolCall(@NotNull @NotNull ToolCall toolCall) Adds a request for a specific tool invocation to this message, usually part of the AI response.- Parameters:
toolCall
- The tool to be called.- Returns:
- This builder instance.
- Since:
- 5.2.250908
- See Also:
-
toolCallId
@Contract("_ -> this") @NotNull @NotNull Message.Builder toolCallId(@Nullable @Nullable String toolCallId) Specifies the ID of the initialToolCall
this message contains a result for.- Parameters:
toolCallId
- The associated tool call ID.- Returns:
- This builder instance.
- Since:
- 5.2.250908
-
index
Specifies index of this message in the context of a response stream.- Parameters:
index
- The index of this message in the response stream.- Returns:
- This builder instance.
- Since:
- 5.2.250908
-
create
Creates a new message object.- Returns:
- The new message instance.
- Since:
- 5.2.240708
-