Class HttpRetryOptions

java.lang.Object
com.google.genai.JsonSerializable
com.google.genai.types.HttpRetryOptions

public abstract class HttpRetryOptions extends JsonSerializable
HTTP retry options to be used in each of the requests.
  • Constructor Details

    • HttpRetryOptions

      public HttpRetryOptions()
  • Method Details

    • attempts

      public abstract Optional<Integer> 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 Optional<Double> initialDelay()
      Initial delay before the first retry, in fractions of a second. If not specified, default to 1.0 second.
    • maxDelay

      public abstract Optional<Double> maxDelay()
      Maximum delay between retries, in fractions of a second. If not specified, default to 60.0 seconds.
    • expBase

      public abstract Optional<Double> expBase()
      Multiplier by which the delay increases after each attempt. If not specified, default to 2.0.
    • jitter

      public abstract Optional<Double> jitter()
      Randomness factor for the delay. If not specified, default to 1.0.
    • httpStatusCodes

      public abstract Optional<List<Integer>> 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.
    • builder

      public static HttpRetryOptions.Builder builder()
      Instantiates a builder for HttpRetryOptions.
    • toBuilder

      public abstract HttpRetryOptions.Builder toBuilder()
      Creates a builder with the same values as this instance.
    • fromJson

      public static HttpRetryOptions fromJson(String jsonString)
      Deserializes a JSON string to a HttpRetryOptions object.