Interface ToolCompensatedEvent
- All Superinterfaces:
AiServiceEvent
- All Known Implementing Classes:
DefaultToolCompensatedEvent
Invoked after a successfully-executed tool is compensated (rolled back) - for example when another tool in the
same round failed, or when the invocation was cancelled. It carries the tool that was rolled back, its original
(successful) result, and the
CompensationReason. Like ToolExecutedEvent, it can be invoked
multiple times within a single AI Service invocation.- Since:
- 1.20.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classNested classes/interfaces inherited from interface AiServiceEvent
AiServiceEvent.Builder<T> -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a new builder instance for constructing aToolCompensatedEvent.default Class<ToolCompensatedEvent> Retrieves the class type of the event, representing the specific category of the AI Service invocation event.reason()Returns why the tool was compensated.request()Gets theToolExecutionRequestof the tool that was compensated.Returns the contents of the compensated tool's original (successful) result.Returns the original (successful) result of the compensated tool as a plain text string.Creates a new builder instance initialized with the properties of thisAiServiceEvent.Methods inherited from interface AiServiceEvent
invocationContext
-
Method Details
-
request
ToolExecutionRequest request()Gets theToolExecutionRequestof the tool that was compensated. -
resultText
String resultText()Returns the original (successful) result of the compensated tool as a plain text string.- Returns:
- the text of the single
TextContentelement. - Throws:
IllegalStateException- if the result contains non-text or multiple content elements. UseresultContents()instead.
-
resultContents
Returns the contents of the compensated tool's original (successful) result.- Returns:
- the list of
Contentelements, nevernull. - Since:
- 1.20.0
-
reason
CompensationReason reason()Returns why the tool was compensated. -
builder
Creates a new builder instance for constructing aToolCompensatedEvent. -
eventClass
Description copied from interface:AiServiceEventRetrieves the class type of the event, representing the specific category of the AI Service invocation event.- Specified by:
eventClassin interfaceAiServiceEvent
-
toBuilder
Description copied from interface:AiServiceEventCreates a new builder instance initialized with the properties of thisAiServiceEvent. This allows modification of the existing properties and reconstruction of the event.- Specified by:
toBuilderin interfaceAiServiceEvent
-