Class ToolCompensatedEvent.ToolCompensatedEventBuilder
java.lang.Object
dev.langchain4j.observability.api.event.AiServiceEvent.Builder<ToolCompensatedEvent>
dev.langchain4j.observability.api.event.ToolCompensatedEvent.ToolCompensatedEventBuilder
- Enclosing interface:
ToolCompensatedEvent
public static class ToolCompensatedEvent.ToolCompensatedEventBuilder
extends AiServiceEvent.Builder<ToolCompensatedEvent>
- Since:
- 1.20.0
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedCreates a builder initialized from an existingToolCompensatedEvent. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds aToolCompensatedEvent.invocationContext(InvocationContext invocationContext) reason()reason(CompensationReason reason) Sets the reason the tool was compensated.request()request(ToolExecutionRequest request) Sets the compensated tool's request.resultContents(List<Content> resultContents) Sets the compensated tool's result contents.resultText(String resultText) Sets the compensated tool's result text.Methods inherited from class AiServiceEvent.Builder
invocationContext
-
Constructor Details
-
ToolCompensatedEventBuilder
protected ToolCompensatedEventBuilder() -
ToolCompensatedEventBuilder
Creates a builder initialized from an existingToolCompensatedEvent.
-
-
Method Details
-
request
Sets the compensated tool's request. -
resultText
Sets the compensated tool's result text. The text will be wrapped into a singleTextContent. Mutually exclusive withresultContents(List). -
resultContents
@Experimental public ToolCompensatedEvent.ToolCompensatedEventBuilder resultContents(List<Content> resultContents) Sets the compensated tool's result contents. Mutually exclusive withresultText(String).- Since:
- 1.20.0
-
reason
Sets the reason the tool was compensated. -
request
-
resultText
-
resultContents
-
reason
-
invocationContext
public ToolCompensatedEvent.ToolCompensatedEventBuilder invocationContext(InvocationContext invocationContext) - Overrides:
invocationContextin classAiServiceEvent.Builder<ToolCompensatedEvent>
-
build
Builds aToolCompensatedEvent.- Specified by:
buildin classAiServiceEvent.Builder<ToolCompensatedEvent>- Throws:
IllegalArgumentException- if neither or both ofresultTextandresultContentsare set.
-