Package dev.langchain4j.data.message
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
.
ToolExecutionRequest
s come from a previous AiMessage.toolExecutionRequests()
.-
Constructor Summary
ConstructorDescriptionToolExecutionResultMessage
(String id, String toolName, String text) Creates aToolExecutionResultMessage
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
static ToolExecutionResultMessage
from
(ToolExecutionRequest request, String toolExecutionResult) Creates aToolExecutionResultMessage
from aToolExecutionRequest
and the result of the tool execution.static ToolExecutionResultMessage
Creates aToolExecutionResultMessage
from aToolExecutionRequest
and the result of the tool execution.int
hashCode()
id()
Returns the id of the tool.text()
Returns the result of the tool execution.static ToolExecutionResultMessage
toolExecutionResultMessage
(ToolExecutionRequest request, String toolExecutionResult) Creates aToolExecutionResultMessage
from aToolExecutionRequest
and the result of the tool execution.static ToolExecutionResultMessage
toolExecutionResultMessage
(String id, String toolName, String toolExecutionResult) Creates aToolExecutionResultMessage
from aToolExecutionRequest
and 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
Returns the id of the tool.- Returns:
- the id of the tool.
-
toolName
Returns the name of the tool.- Returns:
- the name of the tool.
-
text
Returns the result of the tool execution.- Specified by:
text
in interfaceChatMessage
- Returns:
- the result of the tool execution.
-
type
Description copied from interface:ChatMessage
The type of the message.- Specified by:
type
in interfaceChatMessage
- Returns:
- the type of the message
-
equals
-
hashCode
public int hashCode() -
toString
-
from
public static ToolExecutionResultMessage from(ToolExecutionRequest request, String toolExecutionResult) Creates aToolExecutionResultMessage
from aToolExecutionRequest
and 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 aToolExecutionResultMessage
from aToolExecutionRequest
and 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 aToolExecutionResultMessage
from aToolExecutionRequest
and 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 aToolExecutionResultMessage
from aToolExecutionRequest
and 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
.
-