Pdf file can be interpreted by assistant in the playground but not via code

Hi and welcome to the community!

For debugging purposes you can try specifying that the file is a PDF in your Python version of the code as described here.

I also suggest to look through the related topics listed below.

Hope this helps!