When I upload documents for RAG, it works fine. But if I upload documents in other languages, the pdf parser fails. The alternate solution can be the “upload file” feature of OpenAI but isn’t available in Hercules AI Gateway
Hey,
Good news on the main problem. The reason your Chinese PDFs came back empty is that the PDF text library your app started with cannot decode Chinese character maps. Your app has since been updated to use a library that reads Chinese and other non-Latin scripts correctly, with an automatic vision fallback for scanned or image-only PDFs. Delete and re-upload any Chinese document that failed before so it gets processed by the new method, and it will extract correctly.
On the OpenAI file upload point: the Hercules AI Gateway does not currently expose OpenAI’s Files API, which is why that call did not work. You do not need it for this. The supported way to send a document to a model through the gateway is to include it directly in a chat request as a file or image part, which handles PDFs and images without a separate upload step. Your app is already set up to do this as the fallback.
We have logged native OpenAI Files API support as a feature request for the gateway.
Thanks,
Arnav