Class ToolExecutionResult
java.lang.Object
dev.langchain4j.service.tool.ToolExecutionResult
Represents the result of a tool execution.
- Since:
- 1.6.0
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns attributes associated with tool execution.static ToolExecutionResult.Builderbuilder()booleaninthashCode()booleanisError()Indicates whether the tool execution result represents an error.result()Returns the tool execution result as object.Returns the tool execution result as text.toString()
-
Constructor Details
-
ToolExecutionResult
-
-
Method Details
-
isError
public boolean isError()Indicates whether the tool execution result represents an error. -
result
Returns the tool execution result as object. This object is the actual value returned by the tool.- See Also:
-
resultText
Returns the tool execution result as text. It is aresult()that is serialized into JSON string. The text is calculated lazily on first access and then cached.Thread-safety: In rare concurrent scenarios, the supplier may be invoked multiple times, but only one result will be cached. Suppliers should be idempotent and side-effect free.
Virtual thread friendly: Uses lock-free atomic operations that do not pin carrier threads.
- See Also:
-
attributes
Returns attributes associated with tool execution. These attributes will be propagated intoToolExecutionResultMessage.attributes()and can be persisted in aChatMemory. They will not be sent to the LLM.- Since:
- 1.12.0
-
equals
-
hashCode
-
toString
-
builder
-