Package dev.langchain4j.data.message
Class ToolExecutionResultMessage
-
- All Implemented Interfaces:
-
dev.langchain4j.data.message.ChatMessage
public class ToolExecutionResultMessage implements ChatMessage
Represents the result of a tool execution in response to a ToolExecutionRequest. ToolExecutionRequests come from a previous toolExecutionRequests.
-
-
Constructor Summary
Constructors Constructor Description ToolExecutionResultMessage(String id, String toolName, String text)Creates a ToolExecutionResultMessage.
-
Method Summary
Modifier and Type Method Description Stringid()Returns the id of the tool. StringtoolName()Returns the name of the tool. Stringtext()Returns the result of the tool execution. ChatMessageTypetype()The type of the message. booleanequals(Object o)inthashCode()StringtoString()static ToolExecutionResultMessagefrom(ToolExecutionRequest request, String toolExecutionResult)Creates a ToolExecutionResultMessage from a ToolExecutionRequest and the result of the tool execution. static ToolExecutionResultMessagefrom(String id, String toolName, String toolExecutionResult)Creates a ToolExecutionResultMessage from a ToolExecutionRequest and the result of the tool execution. static ToolExecutionResultMessagetoolExecutionResultMessage(ToolExecutionRequest request, String toolExecutionResult)Creates a ToolExecutionResultMessage from a ToolExecutionRequest and the result of the tool execution. static ToolExecutionResultMessagetoolExecutionResultMessage(String id, String toolName, String toolExecutionResult)Creates a ToolExecutionResultMessage from a ToolExecutionRequest and the result of the tool execution. -
-
Constructor Detail
-
ToolExecutionResultMessage
ToolExecutionResultMessage(String id, String toolName, String text)
Creates a ToolExecutionResultMessage.- Parameters:
id- the id of the tool.toolName- the name of the tool.text- the result of the tool execution.
-
-
Method Detail
-
text
String text()
Returns the result of the tool execution.
- Returns:
the result of the tool execution.
-
type
ChatMessageType type()
The type of the message.
- Returns:
the type of the message
-
hashCode
int hashCode()
-
from
static ToolExecutionResultMessage from(ToolExecutionRequest request, String toolExecutionResult)
Creates a ToolExecutionResultMessage from a ToolExecutionRequest and the result of the tool execution.
- Parameters:
request- the request.toolExecutionResult- the result of the tool execution.- Returns:
-
from
static ToolExecutionResultMessage from(String id, String toolName, String toolExecutionResult)
Creates a ToolExecutionResultMessage from a ToolExecutionRequest 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:
-
toolExecutionResultMessage
static ToolExecutionResultMessage toolExecutionResultMessage(ToolExecutionRequest request, String toolExecutionResult)
Creates a ToolExecutionResultMessage from a ToolExecutionRequest and the result of the tool execution.
- Parameters:
request- the request.toolExecutionResult- the result of the tool execution.- Returns:
-
toolExecutionResultMessage
static ToolExecutionResultMessage toolExecutionResultMessage(String id, String toolName, String toolExecutionResult)
Creates a ToolExecutionResultMessage from a ToolExecutionRequest 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:
-
-
-
-