Class ToolExecution
java.lang.Object
dev.langchain4j.service.tool.ToolExecution
Represents the execution of a tool, including the request and the result.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic ToolExecution.Builderbuilder()duration()Returns the duration of the tool execution, ornullif timing was not recorded.booleanReturns the time when the tool execution finished, ornullif not recorded.booleanIndicates whether the tool execution result represents an error.inthashCode()Returns the invocation context of the tool execution.request()Returns the request of the tool execution.result()Returns the tool execution result as text.Returns the contents of the tool execution result.Returns the tool execution result as object.Returns the time when the tool execution started, ornullif not recorded.toString()
-
Method Details
-
request
Returns the request of the tool execution.- Returns:
- the request of the tool execution.
-
result
Returns the tool execution result as text.- Returns:
- the result of the tool execution.
- See Also:
-
resultContents
Returns the contents of the tool execution result. For text-only results, returns a singleton list containing aTextContent.- Since:
- 1.13.0
- See Also:
-
resultObject
Returns the tool execution result as object. This object is the actual value returned by the tool.- Returns:
- the result of the tool execution.
- See Also:
-
hasFailed
public boolean hasFailed()Indicates whether the tool execution result represents an error. -
startTime
Returns the time when the tool execution started, ornullif not recorded. -
finishTime
Returns the time when the tool execution finished, ornullif not recorded. -
duration
Returns the duration of the tool execution, ornullif timing was not recorded. -
invocationContext
Returns the invocation context of the tool execution. -
equals
-
hashCode
-
toString
-
builder
-