Services Plugins FAQs

Full openAI GPT-4 / assistant / private file doesn't connect

Hi there,

Using the Full OpenAI GPT-4 Plugin to see if perhaps you guys solved the issue of connecting private files to openAI.

I have been struggling with the issue of connecting private files to openAI assistant for a couple of months already.

Getting the file in can be done two ways:
(1). appending the bubble filepath with a bubble api token (very insecure to expose the key like this)
(2). using a seperate S3 and transferring the file to openAi by (1.) requesting a pre-signed url and (2.) post the file based on this url.

The issue in both cases is that the fileType is not recognised (400 error) as the pre mime type identification at openAI just looks at the final “.xyz” for the extentiontype. If it is not .pdf or another supported formated the file cannot be connected to a vectorStore.

Which combination of plugins (or solution within a plugin) helps with this issue?

Thanks!

Hello @HenRy ,

Thank you for reaching out.

To use images with OpenAI, please ensure they are in .png format and have square dimensions, failing to do so may result in a 400 error.

To better understand your use case, could you provide more details about the problem you are experiencing? Specifically, it would be helpful if you could share screenshots or screencasts of your workflow, describe the exact actions you are performing, the issue you encounter, and what you expect to happen.

Additionally, could you please send us a test file that you’re trying to use? This will allow us to reproduce the problem on our end and provide you with more targeted answer.

Thank you once again, and I look forward to your response.

Best regards,
Stefan

Hi Stephan,

Thanks for responding!
I want to add files to openAI assistants for the file_search tool.

Step 1. (front-end): user uploads a file via the file-uploader. The file is set as a private file tied to the User shield it from unauthorised access.

Step 2. after using the plugin function to upload a file to openAI the response: "the parameter file is not a valid file:

Scherm­afbeelding 2024-08-07 om 12.56.39

Because the file is set to ‘private’ i cannot share it with openAI via the plugin (causing the error).
I get this error with any type of file (i used pdf and doc). These filetypes are compatible with the file_search function.

There is no issue when there are no privacy rules applied to the file, so this is causing the error. The problem is that i want to keep files in the app private, so somehow i need to find a work around to get these private files to openAI via the plugin.

Thanks!

@Stephan
When i append the file in the uploader as follows: abc.pdf?api_token=MYBUBBLEAPIKEY then the file is transferred into openAI. However…

There are two reasons not to do this: 1. i’m exposing my API KEY and 2. openAI is not able to identify the file type as it says that [api_token=MYBUBBLEAPIKEY] is not a valid filetype (400 error)

1 Like

Hello @HenRy,

Thank you for the message and for your explanations.

Regarding your question about using a file with privacy rules with the OpenAI plugin: when you apply privacy rules, the file becomes accessible only within your app for a specific user. Consequently, this means you cannot share it with third-party tools like OpenAI. even including an API key in your request won’t circumvent this, as OpenAI is waiting the file to be accessible beforehand.

For more insights into the API architecture utilized in the plugin, you can visit this link: https://platform.openai.com/docs/api-reference/files/create

Thank you for your understanding, and I look forward to hearing your thoughts on this matter.

Best regards,
Stefan

Hi @Stephan

Thanks for getting back on this.

Adding an API token to the filepath actually does work to get private files posted. When I append the filepath like described, files become accessible for the external API.

Nevertheless I understand this plugin does not have a built in solution.

Thanks!

Hello @HenRy,

Thank you for reaching out.

Could you please provide more details about the specific steps you’ve taken? Additionally, how do you envision sending a private image from Bubble to a third-party app without using your app’s API key?

The “Upload file” action in the plugin utilizes this specific API call from OpenAI: https://platform.openai.com/docs/api-reference/files/create. Modifying how we make this call would render it inoperable, as it requires a specific method for data reception. Could you let us know how you envision a built-in solution working for your needs?

Thank you for your understanding and patience.

I look forward to your reply.

Best regards,
Stefan

Hi @Stephan,

I think indeed the underlying issue is more broad than my use case.
As you probably know within AWS you have the possibility to generate pre-signed-URLS to provide time-bound access to files that are stored private.

The only problem is that this generate-pre-signed-urls is not a built in functionality within Bubble. This means that you now have to setup your own AWS S3 file storage outside of the bubble app and store/manage files there.

You can manage the privacy of the S3 and you can generate pre-signed-urls via the AWS api-key that you store in Bubble (there is a wiseable plugin that manages all necessary scripts).

I think it would be really nice broad feature if this pre-signed-url functionality could be directly triggered on the Bubble private file storage as well.

Regarding the subsequent issue that openAI does not recognise the filetype if it is appended with either the api-token or the pre-signing mechanism (when using the seperate S3) i figured out a work around as well by using the upload function of openAI. First you create the upload with your own file name, then in a second API call you can post the file (bytes) into the upload, and in the third step you close the upload.

This means that i’m now able to transfer files securely from bubble’s S3 (via an AWS s3) into openAI but the second step is basically creating ‘unnecessary’ redundancy and app surface.

If there would be a “generate pre-signed-url” function directly on the Bubble S3 or plugin that can manage this, that would be awesome! I think there are thousands of use cases where users want to be able to grant access to private files outside of the app in a secure manner.

Thanks!

Hello @HenRy,

Thanks for your message.

Indeed, AWS and other file storage services offer the option to create temporary access to a file through a “generate pre-signed URL”.

The plugins AWS File Uploader and Wasabi Cloud Storage include the option to create a pre-signed URL. If you’re interested in testing them, you can subscribe and only pay for the days you use them (e.g., $9/31 = $0.28 per day). This allows you to ensure they meet your needs without incurring significant costs.

If you’d like to see such function directly in the Bubble database, I recommend contacting the Bubble support team directly at support@bubble.io to inquire about any upcoming plans for this feature.

Thank you for your cooperation. Please let me know if you have any further questions. :pray:

Wishing you a fantastic weekend ahead!

Best regards,
Stefan