Implement the API of OpenAI Whisper on Bubble

Hello everyone, I’m currently trying to implement an API with OpenAI Whisper on my website.
The documentation on the website of openAI indicate this:


I’m currently stuck here, i don’t know how to complete the file directory on bubble

How can have the file directory “C:/…/file.mp3” ? I putted my mp3 file in the file manager of Bubble.io

I have right now this error code:

Thank you for your help

I found the solution, I forgot to put “send file” on the right on the parameter file. But I’m still stuck to change the parameter dynamically if you have some ideas I would appreciate :slight_smile:

1 Like

When you make the API call from inside your workflow, don’t you see an option to insert dynamic data?

Check “Send file” and uncheck “Private” in the parameter settings.

If the “private” checkbox is checked, you can’t access this parameter in the workflows.

Himanshu
Bubble tutorials

2 Likes

I’m having some issues with this same API call and hoping someone might be able to help. I’ve set up my call in API connector just as you’ve done here and initialized just fine. However, when trying to use the call in a workflow with a dynamically specified file, I get an error from Bubble saying that the file parameter is not a valid file. Really has me scratching my head. Paging Bubble-hero @Jici here in case they are willing to enlighten us. :pray:

Can you share screenshot of your settings in both WF and API Connector?

1 Like

Thank you, @Jici! You can see the setup below. Please note that “message_audio” is a state of type file that points to the file in my DB. I’ve run the workflow in debug mode and it shows the state populating just fine, so the problem should not be there, I don’t think.



Screen Shot 2023-04-03 at 3.09.36 PM

Did you try to remove https: ?

1 Like

I actually had done that before and still got the same error, I’m afraid. I also tried using just the file, rather than the URL, etc. etc. ad nauseum. Can’t figure it out.

How do you get the file? explore’s message audio url, for me is not really a file, but a url (string for bubble) and this may be why.
I can recommend you to test sending the request in requestbin.org and check what API Connector send VS workflow. It may help you debugging this

1 Like

You might be right about that. However, I would think that, if this were the case, pointing to the state itself (which is of type file) would solve the issue. When I do this, however, I get the same error. To give a bit more insight, I am uploading the audio from the audio recorder plugin before saving to the state. I can see that the audio is saving just fine and that the state seems to be populating without issue, as well.

Screen Shot 2023-04-03 at 3.19.08 PM

If the type of the state is file, and the recorder save a file, normally, this should be saved to Bubble storage, so shouldn’t be a problem. Try to use requestbin to debug

@ts11 It looks like we’re trying the exact same idea with the Audio Recorder and the OpenAI Whisper API.

I’ve tried all sorts of tutorials and articles, all seem to simply say check the “File” box, which works great upon initialization. However, when you try and pass a URL dynamically within the app, the errors appear about the file not being correct.

I’ve watched these two videos [1] and [2]. One shows how he set up the Whisper API, the other how he set up the action/workflow.

The only thing I can think of at this point is to try a different audio recorder, even though it correctly populates the link and said link is accessible when copy and pasted into web browser. If not, perhaps it’s time to contact Bubble Support.

Any ideas here @chris.williamson1996? (I tag Chris when I get stuck on complicated things, he usually knows).

2 Likes

Yes, it seems we are in the same boat! That said, in toying with the problem this afternoon, I have had some luck in narrowing down the issue. I have been uploading the audio from the recorder and saving to a custom state, which I reference in the “create transcription” api call. I had been using custom events to enforce synchronous execution of each action, which I expected would work. However, it seems this might have been the issue. On a hunch, I swapped my “trigger custom event” action with a “schedule custom event” action for the api call. Even with a millisecond delay, the api call succeeded. So it seems like my problem was with the data not actually being saved to the state before the api call was triggered, despite each action having been wrapped in a custom event :man_shrugging: Let me know if this solves your problem too.

On a more general note, I would add that this issue is just one more example of a much larger, underlying problem — which is the very poor documentation around when workflow actions run synchronously and when they don’t and the terrible job that the current workflow UI does in conveying this issue. Most Bubblers assume (as anyone would) that workflow actions will run sequentially, when, of course, they do not. I think this is one of the biggest and most consequential UI problems with Bubble that remains unaddressed.

End Rant

2 Likes

Did anyone manage to come up with a solution for this?

I’m having the same issue - searching the forums I can’t find anyone that has a solution.

I’m getting the error in my logs: “API Connector error: the parameter file is not a valid file”

I’ve also tried scheduling a backend workflow to prevent any issues with the workflow not executing in order, but that didn’t work either.

1 Like

If anyone is still looking for a solution, I made a video here on how to implement the Whisper API! https://www.youtube.com/watch?v=8kIhNH2fTiM