Class ToolMessage
java.lang.Object
nl.dannyj.mistral.models.completion.message.ChatMessage
nl.dannyj.mistral.models.completion.message.ToolMessage
Represents a message with the 'tool' role in a chat conversation.
Tool messages are used to provide the results of a tool call back to the model.
-
Field Summary
Fields inherited from class nl.dannyj.mistral.models.completion.message.ChatMessage
content
-
Constructor Summary
ConstructorsConstructorDescriptionToolMessage
(@NonNull @NotEmpty List<ContentChunk> contentChunks, String toolCallId) Constructs a ToolMessage with potentially complex content and the corresponding tool call ID.ToolMessage
(@NonNull String textContent, String toolCallId) Constructs a ToolMessage with simple text content and the corresponding tool call ID. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
boolean
getName()
The name associated with the tool call.getRole()
Gets the role of this message.The ID of the tool call that this message is a response to.int
hashCode()
void
The name associated with the tool call.void
setToolCallId
(String toolCallId) The ID of the tool call that this message is a response to.Methods inherited from class nl.dannyj.mistral.models.completion.message.ChatMessage
getContent, getTextContent
-
Constructor Details
-
ToolMessage
Constructs a ToolMessage with simple text content and the corresponding tool call ID.- Parameters:
textContent
- The text content (result) of the tool call. Cannot be null.toolCallId
- The ID of the tool call this message responds to. Can be null.
-
ToolMessage
public ToolMessage(@NonNull @NotEmpty @NonNull @NotEmpty List<ContentChunk> contentChunks, @Nullable String toolCallId) Constructs a ToolMessage with potentially complex content and the corresponding tool call ID.- Parameters:
contentChunks
- The list of content chunks representing the tool result. Cannot be null or empty.toolCallId
- The ID of the tool call this message responds to. Can be null.
-
ToolMessage
public ToolMessage()
-
-
Method Details
-
getRole
Gets the role of this message.- Specified by:
getRole
in classChatMessage
- Returns:
- Always returns
MessageRole.TOOL
.
-
equals
-
canEqual
-
hashCode
public int hashCode() -
getToolCallId
The ID of the tool call that this message is a response to. Can be null.- Returns:
- The tool call ID.
-
setToolCallId
The ID of the tool call that this message is a response to. Can be null.- Parameters:
toolCallId
- The tool call ID.
-
getName
The name associated with the tool call. Can be null.- Returns:
- The name.
-
setName
The name associated with the tool call. Can be null.- Parameters:
name
- The name.
-