Class AssistantMessage
java.lang.Object
nl.dannyj.mistral.models.completion.message.ChatMessage
nl.dannyj.mistral.models.completion.message.AssistantMessage
Represents a message with the 'assistant' role in a chat conversation.
Assistant messages contain the model's responses, which might include text content and/or tool calls.
-
Field Summary
Fields inherited from class nl.dannyj.mistral.models.completion.message.ChatMessage
content
-
Constructor Summary
ConstructorsConstructorDescriptionAssistantMessage
(@NonNull @NotEmpty List<ToolCall> toolCalls) Constructs an AssistantMessage with tool calls.AssistantMessage
(@NonNull String textContent) Constructs an AssistantMessage with text content.AssistantMessage
(List<ContentChunk> content, List<ToolCall> toolCalls) Constructs an AssistantMessage with both text content and tool calls. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
getRole()
Gets the role of this message.A list of tool calls requested by the model.int
hashCode()
boolean
isPrefix()
Indicates if this assistant message acts as a prefix to guide the model's subsequent response.void
setPrefix
(boolean prefix) Indicates if this assistant message acts as a prefix to guide the model's subsequent response.void
setToolCalls
(List<ToolCall> toolCalls) A list of tool calls requested by the model.Methods inherited from class nl.dannyj.mistral.models.completion.message.ChatMessage
getContent, getTextContent
-
Constructor Details
-
AssistantMessage
Constructs an AssistantMessage with text content.- Parameters:
textContent
- The text content.
-
AssistantMessage
Constructs an AssistantMessage with tool calls.- Parameters:
toolCalls
- The list of tool calls. Cannot be null or empty.
-
AssistantMessage
Constructs an AssistantMessage with both text content and tool calls. Use setters if only one is needed or to set the prefix flag.- Parameters:
content
- The list of content chunks. Can be null.toolCalls
- The list of tool calls. Can be null.
-
AssistantMessage
public AssistantMessage()
-
-
Method Details
-
getRole
Gets the role of this message.- Specified by:
getRole
in classChatMessage
- Returns:
- Always returns
MessageRole.ASSISTANT
.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getToolCalls
A list of tool calls requested by the model. Can be null if the message only contains text content.- Returns:
- The list of tool calls, or null.
-
setToolCalls
A list of tool calls requested by the model. Can be null if the message only contains text content.- Parameters:
toolCalls
- The list of tool calls, or null.
-
isPrefix
public boolean isPrefix()Indicates if this assistant message acts as a prefix to guide the model's subsequent response. Defaults to false.- Returns:
- The prefix flag state.
-
setPrefix
public void setPrefix(boolean prefix) Indicates if this assistant message acts as a prefix to guide the model's subsequent response. Defaults to false.- Parameters:
prefix
- True if this is a prefix message, false otherwise.
-