ai.clients.RoundRobin
Rotates invocations across members. Replaces the legacy round-robin provider: distribution is a client-boundary concern, exactly like Retry and Fallback. The counter mutates on the shared value, so every call site holding this client participates in one rotation. A streaming call selects and advances the counter exactly once; a failure from that selected stream never rotates again within the same call.
Signature
class ai.clients.RoundRobinRotates invocations across members. Replaces the legacy round-robin provider: distribution is a client-boundary concern, exactly like Retry and Fallback. The counter mutates on the shared value, so every call site holding this client participates in one rotation. A streaming call selects and advances the counter exactly once; a failure from that selected stream never rotates again within the same call.
Source:<builtin>/ai/ns_clients/clients.bamlbytes 17018–21181
Fields
members
counter
intStatic methods
Implementations
ai.Client for ai.clients.RoundRobin
Instance methods
default_cache_args
(self) -> baml.json.json throws neverThe 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).
id
(self) -> string throws neverinvoke
(render
(Rendering is deterministic and side-effect free: preview the first member rather than mutating the invocation rotation counter.
Source:<builtin>/ai/ns_clients/clients.bamlbytes 17483–19773
ai.stream.StreamingClient for ai.clients.RoundRobin
Instance methods
invoke_stream
(Source:<builtin>/ai/ns_clients/clients.bamlbytes 19779–21179