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 Details

    • extractErrorFromResult

      Optional<Object> extractErrorFromResult(BaseTool tool, Map<String,Object> toolArgs, ToolContext toolContext, Map<String,Object> result)
      Returns the error in result, such as result itself when it holds "status": "error", or empty if the call succeeded.

      An error that is not a Throwable is reported to the model with error_type "ToolError"; a Map error is passed as data, so like a tool result it must hold only JSON-native values. Past the limit, when throwExceptionIfRetryExceeded is set, a Throwable error is emitted as is and any other error as an IllegalStateException with a generic message.