ai.clients.Retry

class in the ai package.

Reference version

Signature

class ai.clients.Retry

Source:<builtin>/ai/ns_clients/clients.bamlbytes 10942–16586

Fields

max_attempts

int

Static methods

Instance methods

function

_wants_retry

(self, cause: ai.clients.Retryable) -> bool throws never

The safety gate is not overridable; the judgment is. retry_if judges typed failures; a member timeout passes the gate and is always retried.

Implementations

ai.Client for ai.clients.Retry

Instance methods

function

default_cache_args

(self) -> baml.json.json throws never

The args this client uses for a ${cache()} written with none (or with null): the object its wire's cache marker carries. Null when the client has no cache marker on its wire, or when the model it is configured for would reject one; a ${cache()} then sends nothing.

A client that sends cache markers passes this to ai.wire.prompt_parts(message, default_cache_args).

function

id

(self) -> string throws never
function

render

(
self,
) -> baml.http.Request throws baml.errors.Timeout | baml.errors.UnknownError | reflect.errors.CompilationError | ai.errors.Failure

Rendering is a pure preview of the inner client. It deliberately does not apply retry policy or backoff because no request is sent.

Source:<builtin>/ai/ns_clients/clients.bamlbytes 13337–14287