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 String
id()
Returns the id of the tool. String
toolName()
Returns the name of the tool. String
text()
Returns the result of the tool execution. ChatMessageType
type()
The type of the message. boolean
equals(Object o)
int
hashCode()
String
toString()
static ToolExecutionResultMessage
from(ToolExecutionRequest request, String toolExecutionResult)
Creates a ToolExecutionResultMessage from a ToolExecutionRequest and the result of the tool execution. static ToolExecutionResultMessage
from(String id, String toolName, String toolExecutionResult)
Creates a ToolExecutionResultMessage from a ToolExecutionRequest and the result of the tool execution. static ToolExecutionResultMessage
toolExecutionResultMessage(ToolExecutionRequest request, String toolExecutionResult)
Creates a ToolExecutionResultMessage from a ToolExecutionRequest and the result of the tool execution. static ToolExecutionResultMessage
toolExecutionResultMessage(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:
-
-
-
-