Class GuardedToolExecution.Builder
java.lang.Object
dev.langchain4j.service.guardrail.GuardedToolExecution.Builder
- Enclosing interface:
GuardedToolExecution
Builds a
GuardedToolExecution.- Since:
- 1.25.0
-
Method Summary
Modifier and TypeMethodDescriptionbuild()failedStage(@Nullable ToolGuardrailStage failedStage) request(ToolExecutionRequest request) result(ToolExecutionResult result) resultReplaced(boolean resultReplaced)
-
Method Details
-
request
- Parameters:
request- The tool call as the input guardrails left it. Must not be null.- Returns:
- This builder.
-
result
- Parameters:
result- The result to send to the LLM. Must not be null.- Returns:
- This builder.
-
failedStage
- Parameters:
failedStage- The stage whose guardrails turned the call into an error result, ornull(the default) if no guardrail failed the call.- Returns:
- This builder.
- See Also:
-
resultReplaced
- Parameters:
resultReplaced- Whether a tool output guardrail replaced the result of the tool;falseby default.- Returns:
- This builder.
- See Also:
-
build
- Returns:
- The execution.
- Throws:
IllegalArgumentException- if the request or the result is missing
-