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.

    • clearAttempts

      @CanIgnoreReturnValue public HttpRetryOptions.Builder clearAttempts()
      Clears the value of attempts field.
    • 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.

    • clearInitialDelay

      @CanIgnoreReturnValue public HttpRetryOptions.Builder clearInitialDelay()
      Clears the value of initialDelay field.
    • 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.

    • clearMaxDelay

      @CanIgnoreReturnValue public HttpRetryOptions.Builder clearMaxDelay()
      Clears the value of maxDelay field.
    • 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.

    • clearExpBase

      @CanIgnoreReturnValue public HttpRetryOptions.Builder clearExpBase()
      Clears the value of expBase field.
    • jitter

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

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

    • clearJitter

      @CanIgnoreReturnValue public HttpRetryOptions.Builder clearJitter()
      Clears the value of jitter field.
    • 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

      @CanIgnoreReturnValue 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.

    • clearHttpStatusCodes

      @CanIgnoreReturnValue public HttpRetryOptions.Builder clearHttpStatusCodes()
      Clears the value of httpStatusCodes field.
    • build

      public abstract HttpRetryOptions build()