Class ToolExecutionResultMessage
java.lang.Object
dev.langchain4j.data.message.ToolExecutionResultMessage
- All Implemented Interfaces:
ChatMessage
Represents the result of a tool execution in response to a
ToolExecutionRequest.
ToolExecutionRequests come from a previous AiMessage.toolExecutionRequests().-
Constructor Summary
ConstructorsConstructorDescriptionToolExecutionResultMessage(String id, String toolName, String text) Creates aToolExecutionResultMessage. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic ToolExecutionResultMessagefrom(ToolExecutionRequest request, String toolExecutionResult) Creates aToolExecutionResultMessagefrom aToolExecutionRequestand the result of the tool execution.static ToolExecutionResultMessageCreates aToolExecutionResultMessagefrom aToolExecutionRequestand the result of the tool execution.inthashCode()id()Returns the id of the tool.text()Returns the result of the tool execution.static ToolExecutionResultMessagetoolExecutionResultMessage(ToolExecutionRequest request, String toolExecutionResult) Creates aToolExecutionResultMessagefrom aToolExecutionRequestand the result of the tool execution.static ToolExecutionResultMessagetoolExecutionResultMessage(String id, String toolName, String toolExecutionResult) Creates aToolExecutionResultMessagefrom aToolExecutionRequestand the result of the tool execution.toolName()Returns the name of the tool.toString()type()The type of the message.
-
Constructor Details
-
ToolExecutionResultMessage
Creates aToolExecutionResultMessage.- Parameters:
id- the id of the tool.toolName- the name of the tool.text- the result of the tool execution.
-
-
Method Details
-
id
-
toolName
-
text
Returns the result of the tool execution.- Returns:
- the result of the tool execution.
-
type
Description copied from interface:ChatMessageThe type of the message.- Specified by:
typein interfaceChatMessage- Returns:
- the type of the message
-
equals
-
hashCode
-
toString
-
from
public static ToolExecutionResultMessage from(ToolExecutionRequest request, String toolExecutionResult) Creates aToolExecutionResultMessagefrom aToolExecutionRequestand the result of the tool execution.- Parameters:
request- the request.toolExecutionResult- the result of the tool execution.- Returns:
- the
ToolExecutionResultMessage.
-
from
public static ToolExecutionResultMessage from(String id, String toolName, String toolExecutionResult) Creates aToolExecutionResultMessagefrom aToolExecutionRequestand the result of the tool execution.- Parameters:
id- the id of the tool.toolName- the name of the tool.toolExecutionResult- the result of the tool execution.- Returns:
- the
ToolExecutionResultMessage.
-
toolExecutionResultMessage
public static ToolExecutionResultMessage toolExecutionResultMessage(ToolExecutionRequest request, String toolExecutionResult) Creates aToolExecutionResultMessagefrom aToolExecutionRequestand the result of the tool execution.- Parameters:
request- the request.toolExecutionResult- the result of the tool execution.- Returns:
- the
ToolExecutionResultMessage.
-
toolExecutionResultMessage
public static ToolExecutionResultMessage toolExecutionResultMessage(String id, String toolName, String toolExecutionResult) Creates aToolExecutionResultMessagefrom aToolExecutionRequestand the result of the tool execution.- Parameters:
id- the id of the tool.toolName- the name of the tool.toolExecutionResult- the result of the tool execution.- Returns:
- the
ToolExecutionResultMessage.
-