Class HttpRetryOptions.Builder

java.lang.Object
com.google.genai.types.HttpRetryOptions.Builder
Enclosing class:
HttpRetryOptions

public abstract static class HttpRetryOptions.Builder extends Object
Builder for HttpRetryOptions.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • attempts

      public abstract HttpRetryOptions.Builder attempts(Integer attempts)
      Setter for attempts.

      attempts: Maximum number of attempts, including the original request. If 0 or 1, it means no retries. If not specified, default to 5.

    • initialDelay

      public abstract HttpRetryOptions.Builder initialDelay(Double initialDelay)
      Setter for initialDelay.

      initialDelay: Initial delay before the first retry, in fractions of a second. If not specified, default to 1.0 second.

    • maxDelay

      public abstract HttpRetryOptions.Builder maxDelay(Double maxDelay)
      Setter for maxDelay.

      maxDelay: Maximum delay between retries, in fractions of a second. If not specified, default to 60.0 seconds.

    • expBase

      public abstract HttpRetryOptions.Builder expBase(Double expBase)
      Setter for expBase.

      expBase: Multiplier by which the delay increases after each attempt. If not specified, default to 2.0.

    • jitter

      public abstract HttpRetryOptions.Builder jitter(Double jitter)
      Setter for jitter.

      jitter: Randomness factor for the delay. If not specified, default to 1.0.

    • httpStatusCodes

      public abstract HttpRetryOptions.Builder httpStatusCodes(List<Integer> httpStatusCodes)
      Setter for httpStatusCodes.

      httpStatusCodes: List of HTTP status codes that should trigger a retry. If not specified, a default set of retryable codes (408, 429, and 5xx) may be used.

    • httpStatusCodes

      public HttpRetryOptions.Builder httpStatusCodes(Integer... httpStatusCodes)
      Setter for httpStatusCodes.

      httpStatusCodes: List of HTTP status codes that should trigger a retry. If not specified, a default set of retryable codes (408, 429, and 5xx) may be used.

    • build

      public abstract HttpRetryOptions build()