https://www.boundaryml.com logo
🟡 Parameterizing client choice in a BAML function
# questions
n
is there a way to parameterize the client in a baml function? say I want to let the user pick between claude or chatgpt, then send the model identifier to the client arg in the baml function
v
sadly not yet
we are thinking of this soon. the only way to do this is by using client registry
n
OK cool, so the workflow is to 1. define clients via client registry in the python src 2. switch the primary client then call the function, it overrides the client specified in baml_src
v
yep! you can also define clients in baml, and then refer to them via client registry
n
can you refer to literal clients with that like "anthropic/claude-sonnet-4.5-nnnn" or do they need to be custom clients?
v
both will just work
you can just do: cr.set_primary("anthropic/claude-sonnet-4.5") or cr.set_primary("NameOfClientInBaml")
n
sick thank you, that should work great for what i am doing
v
wooo!! 🙂