a3lem
08/05/2025, 11:50 AMresponse_template. The Python snippet demonstrates a 'builder' type API interaction to build the chat example. Further down, I've got another BAML snippet showing another syntax for linking the response template to the chat prompt function: using a Rust macro-like annotation. This represents a bigger syntactic change, though, so it's probably not worth the extra effortVaibhav (BAML π)
08/05/2025, 12:17 PMVaibhav (BAML π)
08/05/2025, 12:17 PMa3lem
08/05/2025, 12:45 PMtemplate_string type, but afaik that can't be invoked directly via the Modular API β or can it? (This would be an acceptable solution, actually.)
There are all sorts of interactions between building a request and simulating/handling the response. Even if we could do both with separate BAML functions, it'd be handy if BAML made the relationship between the two explicit.
Another random idea: if it were possible to mock BAML clients from Python, then we could create a mock 'simulated response client' that generates responses for training examples. However, implementing such a client would again mean defining templates in a separate templating framework, e.g. jinja.Vaibhav (BAML π)
08/05/2025, 1:23 PMfunction ExtractResumeResponse(thinking: string, result: Resume) -> string {
client "..."
prompt #"
<do whatever here>
"#
}
then you could use modular API via:
b.request.ExtractResume(params)
b.request.ExtractResumeResponse(thinking, result)Vaibhav (BAML π)
08/05/2025, 1:23 PMVaibhav (BAML π)
08/05/2025, 1:24 PMclient "..." does feel "wrong" to write thereVaibhav (BAML π)
08/05/2025, 1:24 PMVaibhav (BAML π)
08/05/2025, 1:24 PMa3lem
08/05/2025, 1:49 PMa3lem
08/05/2025, 1:51 PMa3lem
08/05/2025, 1:52 PMVaibhav (BAML π)
08/05/2025, 1:53 PMa3lem
08/05/2025, 2:00 PMa3lem
08/05/2025, 2:01 PMtemplate = b.template_strings.ExtractResumeResponse
template.render(**kwargs)
or
b.render_template('ExtractResumeResponse', **kwargs)a3lem
08/05/2025, 2:02 PMVaibhav (BAML π)
08/05/2025, 2:03 PMb.ExtractResumeResponse()
but ExtractResumeResume would be defined as such:
template_string ExtractResumeResume(params...) #"
...
"#Vaibhav (BAML π)
08/05/2025, 2:04 PM#".."# is formally π
Vaibhav (BAML π)
08/05/2025, 2:04 PMtemplate_string does that or not.a3lem
08/05/2025, 2:12 PMVaibhav (BAML π)
08/05/2025, 2:12 PMVaibhav (BAML π)
08/05/2025, 2:13 PMVaibhav (BAML π)
08/05/2025, 2:13 PMVaibhav (BAML π)
08/05/2025, 2:13 PMa3lem
08/05/2025, 2:14 PMVaibhav (BAML π)
08/05/2025, 2:14 PMVaibhav (BAML π)
08/05/2025, 2:14 PMVaibhav (BAML π)
08/05/2025, 2:14 PMVaibhav (BAML π)
08/05/2025, 2:14 PMa3lem
08/05/2025, 2:16 PMa3lem
08/05/2025, 2:17 PMa3lem
08/05/2025, 2:18 PMtemplates attribute. The semantics are different, so it might end up confusing users otherwisea3lem
08/05/2025, 2:19 PMgreg (BAML)
08/08/2025, 5:53 PM