ai.Client

interface in the ai package.

Reference version

Signature

interface ai.Client

Source:<builtin>/ai/turn.bamlbytes 2257–3276

Required instance methods

function

id

(self) -> string throws never
function

render

(self, input: ai.ModelTurnInput) -> baml.http.Request throws ai.errors.InvokeError

Render the provider request shape without performing I/O. Reliability wrappers use this as a stable request-shape preview: they do not sleep, rotate, or try fallback members while rendering.

Default 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).