https://www.boundaryml.com logo
pdf as an openai input
# contributing
p
I'd like to be able to support PDF as an input type for openai similar to how I use it with Gemini here https://github.com/ouachitalabs/baml-playground/blob/main/baml_src%2Ftests.baml#L7 Is this out of scope at the BAML language level? I think the workaround is to upload to the openai files API and then reference the file id or something, really not sure. I'd be down to contribute but I'm a rust noob so it's not gonna be pretty 😁 down to give it a try though fr
b
Ooh!
I think it's absolutely in scope, but we could probably do something even simpler, i.e. just implement
Pdf.from_url()
which under the hood will, when calling the LLM, download the PDF and then encode it as b64 when calling the LLM
We all regularly use cursor/claude/codex to build BAML, and they're also super useful for navigating the code!
We have instructions here for how to build and run stuff: https://github.com/BoundaryML/baml/blob/canary/CONTRIBUTING.md
And... oh wow, apparently I actually fixed something with openai and PDFs. So maybe it actually works and we just need to update the docs? https://github.com/BoundaryML/baml/pull/2382/files
p
lol I tried doing it yesterday but tbf I might have been running an old version
I'll build the main branch and verify if it's solved or not. I use cc so I'll poke around and figure it out if it's not yet. I didn't want to start working towards a pr for something that was a "wontfix" 😁
also now that I think of it, I might just need to try using the openai-responses provider instead of straight openai
b
the pr i linked has definitely been released! so maybe it’s an issue with python codegen or just a docs issue
a
Definitely try 0.209 . We fixed issues with pdfs for openai responses api
p
Finally got a chance to take another look at this. I'm able to reproduce on 0.210.0 😬 I opened an issue for it here and I'll take a crack at it this weekend https://github.com/BoundaryML/baml/issues/2569
a
It needs to go in a user message
The pdf i mean
p
dang man what a silly miss on my end πŸ˜‚
a
All good!