File Upload in OpenAI Platform from external source

Can I upload files to the OpenAI platform from external sources, such as Streamlit? I’m developing a Streamlit AI Note Assistant app that uses RAG (Retrieval-Augmented Generation). Users enter their API key and upload their files through the app. However, I’m encountering a problem because the client.file.create() method, as described in the OpenAI API documentation, seems to require that files be uploaded from a local directory. How can I adapt this process to upload files directly from Streamlit to the OpenAI platform without needing them to be stored locally first?

there was a related discussion about file readstream in whisper api and one of the suggested workaround is to use your buffer with name parameter to set the file name.