Table of Contents

Class RetryPolicy

Namespace
TypeSafe.AI.Sdk
Assembly
TypeSafe.AI.Sdk.dll

Retry configuration. Partial overrides inherit unset fields from the client or SDK defaults. Defaults match the JavaScript SDK.

public sealed class RetryPolicy
Inheritance
RetryPolicy
Inherited Members

Properties

ApiConnectionError

Retry connection failures, including interrupted response bodies. Default: true.

public bool ApiConnectionError { get; set; }

Property Value

bool

ApiTimeoutError

Whether to retry ApiTimeoutException. Default: true.

public bool ApiTimeoutError { get; set; }

Property Value

bool

BackoffInitialMs

First backoff delay in milliseconds, doubled up to BackoffMaxMs. Default: 500.

public int BackoffInitialMs { get; set; }

Property Value

int

BackoffJitter

Fraction of each backoff delay randomly subtracted, from 0 to 1. Default: 0.25.

public double BackoffJitter { get; set; }

Property Value

double

BackoffMaxMs

Maximum backoff delay in milliseconds. Default: 5000.

public int BackoffMaxMs { get; set; }

Property Value

int

Default

SDK default retry policy (a new isolated copy).

public static RetryPolicy Default { get; }

Property Value

RetryPolicy

HttpStatuses

HTTP status codes to retry. Default: 408, 429, and 500–599.

public ISet<int> HttpStatuses { get; set; }

Property Value

ISet<int>

MaxRetries

Maximum retries after the initial attempt; 0 disables retries. Default: 2.

public int MaxRetries { get; set; }

Property Value

int

MaxRetryAfterMs

Maximum server retry delay in milliseconds; longer delays use backoff. Default: 60000.

public int MaxRetryAfterMs { get; set; }

Property Value

int

RespectRetryAfter

Honor Retry-After and retry-after-ms up to MaxRetryAfterMs. Default: true.

public bool RespectRetryAfter { get; set; }

Property Value

bool

Methods

Clone()

Copy this policy so later mutations cannot affect in-flight requests.

public RetryPolicy Clone()

Returns

RetryPolicy

Resolve(RetryPolicy, RetryPolicy?)

Merge overrides onto a base policy and validate every numeric field.

public static RetryPolicy Resolve(RetryPolicy baseline, RetryPolicy? overrides)

Parameters

baseline RetryPolicy
overrides RetryPolicy

Returns

RetryPolicy

Validate()

Validate a fully-specified constructor policy.

public RetryPolicy Validate()

Returns

RetryPolicy