GR™
12/14/2025, 9:55 AMpy
...
async def exec_baml(
stream: bool,
file: UploadFile = File(None),
content: str = Form(None),
url: str = Form(None),
baml_code: str = Form(...),
return_type: str = Form(...)
):
final_content = await read_content(file, content, url)
tb = TypeBuilder()
try:
tb.add_baml(f"""
{baml_code}
dynamic class Response {{
data {return_type}
}}
""")
except BamlError as e:
raise HTTPException(status_code=400, detail={
"error": "BamlError",
"message": str(e),
})
if stream:
stream = b.stream.ExecuteBAML(final_content, { "tb": tb })
return handle_stream(stream, lambda x: x.data)
else:
response = await b.ExecuteBAML(final_content, { "tb": tb })
return response.data
...
https://cdn.discordapp.com/attachments/1449701403693023293/1449701404406059018/image.png?ex=693fdb24&is=693e89a4&hm=c3ae1e6c8404533a6bf38197615153f2a09c79cee24a29aa5b615062ccd9efa4&GR™
12/14/2025, 10:09 AMAntonio Sarosi (BAML 🐑)
12/15/2025, 4:30 AMbaml_code=string and then you call tb.add_baml with string.
You end up with something like this:
string
dynamic class Response {
data string
}
And that's invalid syntax. You have to either skip the {baml_code} part if it''s just a type, or make it a class.
One of these:
dynamic class Response {
data string
}
Or
class WantThisData {
name string
skills string[]
}
dynamic class Response {
data WantThisData
}
In the second case baml_code has to be the entire class definition and return_type has to be the class name.Antonio Sarosi (BAML 🐑)
12/15/2025, 4:31 AMAntonio Sarosi (BAML 🐑)
12/15/2025, 4:32 AMpoppler](https://pypi.org/project/python-poppler/) to make it work.GR™
12/15/2025, 4:33 AMGR™
12/15/2025, 4:33 AMGR™
12/15/2025, 4:33 AMGR™
12/15/2025, 4:34 AMAntonio Sarosi (BAML 🐑)
12/15/2025, 4:35 AMAntonio Sarosi (BAML 🐑)
12/15/2025, 4:35 AMAntonio Sarosi (BAML 🐑)
12/15/2025, 4:35 AMAntonio Sarosi (BAML 🐑)
12/15/2025, 4:36 AM--frozen thing it suggestsAntonio Sarosi (BAML 🐑)
12/15/2025, 4:42 AMAntonio Sarosi (BAML 🐑)
12/15/2025, 4:43 AMAntonio Sarosi (BAML 🐑)
12/15/2025, 4:44 AMbash
sudo apt update
sudo apt install -y \
pkg-config \
cmake \
libpoppler-cpp-dev \
build-essentialGR™
12/15/2025, 4:55 AMAntonio Sarosi (BAML 🐑)
12/15/2025, 4:57 AMGR™
12/15/2025, 6:55 AMGR™
12/15/2025, 6:56 AMAntonio Sarosi (BAML 🐑)
12/15/2025, 12:28 PMAntonio Sarosi (BAML 🐑)
12/15/2025, 12:28 PMpdf typeAntonio Sarosi (BAML 🐑)
12/15/2025, 12:29 PMGR™
12/15/2025, 4:05 PMGR™
12/15/2025, 4:05 PMAntonio Sarosi (BAML 🐑)
12/15/2025, 5:38 PMpdf type I thinkAntonio Sarosi (BAML 🐑)
12/15/2025, 5:38 PMpdf2imageAntonio Sarosi (BAML 🐑)
12/15/2025, 5:38 PMpdf typeGR™
12/19/2025, 12:28 AMAntonio Sarosi (BAML 🐑)
12/19/2025, 12:58 AMAntonio Sarosi (BAML 🐑)
12/20/2025, 8:48 PMAntonio Sarosi (BAML 🐑)
12/20/2025, 8:48 PMGR™
05/07/2026, 3:18 AMGR™
05/07/2026, 3:19 AMGR™
05/07/2026, 3:19 AMbaml-cli init?
2. What steps do you normally follow for updating projects that call an old BAML project version with newest VSCode extension? Feel like changing pyproject.toml and manually editing version on every generators file in the project would get old fast.GR™
05/07/2026, 5:14 AMGR™
05/07/2026, 5:14 AMGR™
05/07/2026, 5:19 AMGR™
05/11/2026, 2:19 PMAntonio Sarosi (BAML 🐑)
05/13/2026, 8:28 PMbaml-src can be, could be outside backend if you're sharing Baml types between frontend and backend, or you wanna generate those types for the frontend as well. In this particular example of extract-anything I don't think there's a reason it needs to be outside of backend.
Steps to update, yes you have to manually update pyproject and generator, the extension only downloads the correct LSP version for you but it doesn't auto update generators and pyproject versionsGR™
05/15/2026, 5:46 PMAntonio Sarosi (BAML 🐑)
05/15/2026, 6:57 PMGR™
05/15/2026, 7:11 PMAntonio Sarosi (BAML 🐑)
05/29/2026, 7:21 PM