Interface BatchItemResult<T>

Type Parameters:
T - the type of a successful response payload (e.g., ChatResponse, Embedding)
All Known Implementing Classes:
BatchItemResult.Failure, BatchItemResult.Success

@Experimental public sealed interface BatchItemResult<T> permits BatchItemResult.Success<T>, BatchItemResult.Failure<T>
Represents the outcome of a single request within a batch operation.

Each batch request is processed independently and either succeeds (producing a response) or fails (producing a BatchError). The results of a batch are returned in the same order as the input requests, so the i-th BatchItemResult corresponds to the i-th submitted request, allowing the caller to correlate every outcome with its originating request even when only some requests fail.

See Also:
  • Method Details

    • isSuccess

      boolean isSuccess()
      Returns true if this request succeeded.
    • response

      @Nullable T response()
      Returns the successful response, or null if this request failed.
    • error

      @Nullable BatchError error()
      Returns the error, or null if this request succeeded.
    • success

      static <T> BatchItemResult<T> success(T response)
      Creates a successful BatchItemResult.
    • failure

      static <T> BatchItemResult<T> failure(BatchError error)
      Creates a failed BatchItemResult.