RetryPolicy
Namespace: Vercel.AI.ProviderUtils
public sealed class RetryPolicyRetry policy aligned with the AI SDK defaults: 2 retries, 500–5000ms backoff, 25% jitter.
Retryable statuses are 408, 429, and 500–599. Retry-After is honored up to 60 seconds.
Inheritance: object
Properties
Section titled “Properties”Default
Section titled “Default”public static RetryPolicy Default { get; }SDK default policy.
Value: RetryPolicy
InitialDelay
Section titled “InitialDelay”public TimeSpan InitialDelay { get; set; }Initial delay.
Value: TimeSpan
Jitter
Section titled “Jitter”public double Jitter { get; set; }Jitter fraction applied to the delay. 0.25 is 25%.
Value: double
MaxDelay
Section titled “MaxDelay”public TimeSpan MaxDelay { get; set; }Maximum delay.
Value: TimeSpan
MaxRetries
Section titled “MaxRetries”public int MaxRetries { get; set; }Maximum retries after the first attempt.
Value: int
Methods
Section titled “Methods”GetDelay(int, TimeSpan?)
Section titled “GetDelay(int, TimeSpan?)”public TimeSpan GetDelay(int attempt, TimeSpan? retryAfter)Computes the delay before the next attempt. <code class=“paramref”>attempt</code> is zero-based.
Parameters
| Name | Type | Description |
|---|---|---|
attempt |
int | |
retryAfter |
TimeSpan? |
Returns: TimeSpan
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product