https://www.boundaryml.com logo
🟡 Query on .baml syntax vs JSON for Gemini
# questions
l
Hi folks, is it better to use the .baml syntax for sending stuff to gemini? Or should i convert it to JSON on my own? We're adding ALOT of metadata. We're processing 100+ screenshots in a single prompt and each one of them comes with a bunch of metadata, so im trying to optimize the formatting. (Also it would be more convenient if i could format it in TS instead of jinja) Here's a pic of what we currently have. https://cdn.discordapp.com/attachments/1253172394345107466/1410620771134345296/Screenshot_2025-08-28_at_16.42.49.png?ex=68b1ae77&is=68b05cf7&hm=3acfa2ad47b5bd89233f8c9e0778c48f95c38e14a940b8397835849ffe355ceb&
v
IMO the thing you’re doing is gonna be better than dumping raw json
Mostly cause json will have a bunch of noise you don’t care about (like “ and , that the LLM could otherwise ignore)
That said with AI it’s really hard to know for sure what is the right thing so the best you can do is just try
r
Why aren’t you using a BAML schema with descriptions and optional fields and instructing the prompt to leave out null values on input and output unless a field is required? That would work way better, I think. Convert to your XML format in local software, it’s one format change per prompt, right?
Ohhhhh screenshots. Cool! Nevermind!