ai.clients.resolve
Resolve a `Selector` to the client to call, at CALL time.
Reference version
Signature
function ai.clients.resolve(
selector: ai.clients.Selector
Resolve a Selector to the client to call, at CALL time.
- a
ai.Clientis returned unchanged (identity); - a string is the
"provider/model"shorthand, constructed here — the runtime twin of the compiler's literal-client:lowering. An unknown prefix throwsai.errors.InvalidRequestlisting the valid ones; - a
baml.env.Refis read now and its value takes the string path. An UNSET variable is a typedai.errors.InvalidRequestnaming it — not a panic, so acatch_allat the call boundary can still fall back.
This is what makes client: env.MODEL.get() ?? "openai/gpt-4o-mini" work:
nothing about the selection is decided until the call happens.
Source:<builtin>/ai/ns_clients/clients.bamlbytes 1552–2412