Package com.google.adk.plugins
Interface ReflectAndRetryToolPlugin.ResultErrorExtractor
- Enclosing class:
- ReflectAndRetryToolPlugin
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@Experimental
@FunctionalInterface
public static interface ReflectAndRetryToolPlugin.ResultErrorExtractor
Finds an error that a tool reported in its result instead of throwing.
-
Method Summary
-
Method Details
-
extractErrorFromResult
Optional<Object> extractErrorFromResult(BaseTool tool, Map<String, Object> toolArgs, ToolContext toolContext, Map<String, Object> result) Returns the error inresult, such asresultitself when it holds"status": "error", or empty if the call succeeded.An error that is not a
Throwableis reported to the model witherror_type"ToolError"; aMaperror is passed as data, so like a tool result it must hold only JSON-native values. Past the limit, whenthrowExceptionIfRetryExceededis set, aThrowableerror is emitted as is and any other error as anIllegalStateExceptionwith a generic message.
-