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().-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCreates aToolExecutionResultMessagefrom a builder.ToolExecutionResultMessage(String id, String toolName, String text) Creates aToolExecutionResultMessage. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a builder forToolExecutionResultMessage.booleanstatic 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.isError()Returns whether the tool execution resulted in an error.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 aToolExecutionResultMessagefrom a builder. -
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.
-
isError
Returns whether the tool execution resulted in an error.- Returns:
- true if the tool execution resulted in an error, false if it did not, null if unknown.
-
type
Description copied from interface:ChatMessageThe type of the message.- Specified by:
typein interfaceChatMessage- Returns:
- the type of the message
-
equals
-
hashCode
-
toString
-
builder
Creates a builder forToolExecutionResultMessage.- Returns:
- the builder.
-
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.
-