im stuck creating an assistant. Im using Bubbles OpenAI API plugin.
I managed the workflow to create a thread, create a message in this thread but I get a bit lost in the next steps.
Is ‘retrieve run’ mandatory?
And then… How do I get the messages list (wich action i must use) and how I show it in a way similar to how its showed on ChatGPT website (im trying with the Repeating Group but cant make it work)?
I haven’t had time to play with it yet, but I believe that is how you get it into a RG so you can do a right left SMS like experience (each send and reply is a row). I am choosimg that approach for a little extra personalizatiom omce I cam commit the time.
Guessimg you otherwise are just rendering it in a single element vs a RG if not storing the data. Your RG instead becomes different threads vs the comversatiom itself.
Other option: Search youtube for Zubair’s Assitants video, which is maybe a diff approach, but check the comments for a miss in I think video 1 of 2
Fwiw - Assistants are still in Beta, so may be worth a security blanket to store the history in the short term
Retrieve run is useful for many reasons but not mandatory
I wish they had webhook functionality that allows you to just “catch” the message once it’s ready, or just simply return it like with the old OpenAI API… but to my knowledge they don’t yet have that.
So, you can either “retrieve” it like I showed in that video, or you can simply use this “GET” call inside your RG to grab all messages from OpenAI’s servers.
Problem: If your “GET” call attempts to grab the latest messages, but the most recent isn’t quite ready yet, then your RG simply won’t keep trying to “GET” it anymore.
So, to “trick” Bubble into trying again periodically, you can add a parameter in the API call & name it “refresh” or something (can be simple text), and then on your page, make a custom state called “refresh”.
In your RG’s datasource, just source it from that custom state.
Then, periodically run a workflow that sets that state to a random string of characters (use the “calculate formula” expression). Whenever a new string of characters gets set, the RG’s datasource will technically change, and therefore Bubble will be forced to make that “GET” call again. (Learned this trick from the great @eli )
I’ve read on the OpenAI developers’ forum that retrieving the entire list of messages every time isn’t economically efficient due to the exponential API consumption when requesting the complete list repeatedly. Is there a proposed approach on how the webflow could be structured to, after each run, fetch only the latest message and append it to the repeating group? And would there be a way to do this without storing all the messages in the database?