Bubble.io & OpenAI - Improve your workflow and data structure
In this Bubble tutorial video we demonstrate a simple way you can improve and simplify your OpenAI API workflows in your Bubble app.
Unlock OpenAI's full potential: Learn how to streamline your workflow and improve data structure in Bubble!
Boost your Bubble app's efficiency: Discover the secret to optimizing your OpenAI integration with this quick tip!
Simplify your Bubble development: Master the art of formatting JSON within your workflow for seamless OpenAI integration!
Improving OpenAI Integration Efficiency in Bubble
Here's a quick tip for how to improve the efficiency of your OpenAI integration with your Bubble app. Now if you're learning Bubble and you haven't checked our website planetnoecode.com then you need to check it out because we've got even more Bubble tutorial videos than you can find on our YouTube channel and many of them are member exclusives and you can sign up today to become a member and get access to all of our videos.
Understanding OpenAI Message Context
But this is the bit that I want to draw your attention to with the OpenAI integration. Remember with OpenAI you need to supply all of the previous messages in a conversation in order for it to respond with understanding the historical context of each message.
Efficient Message Formatting
So the way we do that is that we do a search for messages and when this first became possible when OpenAI released GPT 3.5 Turbo and suddenly all of these things that we had in our brains, how could we create them, these AI tools and now you can build them. I came up with this way of formatting it which is that you have a text field like a human readable field and then you also have a JSON field. So whenever you create a message you create the JSON structure for the user here and then the equivalent in here and you can see that I need to update this.
Optimizing the Workflow
So let's fix this and let's put in the step that I want to share with you about making this much more efficient. Instead of saying search for messages then show each item's JSON. Instead we shall say format as text and then that allows and I'm going to have to copy the example they give here. I'll copy that from the documentation. That allows us to format the JSON in the midst of the workflow rather than having to save it to our database.
Using Delimiters and Dynamic Data
The delimiter that's the computer science term for what separates them and what separates them is a comma and a space and then we can just add in dynamic data here. So this message is I don't think I'm saving roll am I? Okay so I need to save roll. Think you can see where this is going. So the roll here is user and then the roll here is assistant.
Formatting JSON Safely
Oh no I'm not adding a new field. I'm saying roll. That then means that in the format as text I can say this message is roll and then in here I'm going to get rid of everything including the speech marks because I'm going to make it JSON safe. So I can say this message is text JSON safe. Because JSON safe wraps it in its own speech marks and that is also going to ensure that I don't get any syntax errors if someone puts in a colon or any other punctuation that's going to cause an issue with the JSON. Bubble protects against that by using this modifier here formatted as JSON safe.
Simplifying the Workflow
So because I've got that in place I now no longer need to save JSON so I can remove the field there and then just because I'm coming back to this demo I'm just going to fix this bit which is to say save the result of step two first items message content. Yeah because that's the reply that opening I sends back.
Conclusion: Improving App Efficiency
Anyway that's a really quick little tip. It's a small thing you can change but if you're trying to reduce workload units if you approach app development how I do which is that if you can make it simpler do then this is something that you can do to make your app simpler which is to use the format as text to take out multiple fields and format them in a way that you're trying to structure your data. In this case we're trying to structure it as the appropriate JSON syntax to be sent over to OpenAI.
Can't find what you're looking for?
Search our 300+ Bubble tutorial videos. Start learning no code today!
Flexible Pricing Plans to Fit Your No-Code Journey
Choose the plan that aligns with your goals and start building your startup today.
Have questions?
We have answers!
Find answers to common questions about our membership plans, programs, and more.
Both plans offer full access to our learning resources, community, and support. The Annual plan provides a significant discount (over 15%) compared to paying monthly, and it allows you to lock in your rate for a full year.
Absolutely! You can easily upgrade or downgrade your membership plan at any time by logging into your account and selecting the desired plan. Any unused portion of your current plan will be prorated and applied to your new plan.
As a Planet No Code member, you'll receive a discount on our Bubble coaching sessions. Monthly members receive a 10% discount, while Annual members receive a 17.5% discount. To redeem your discount, simply log into your account and book a coaching session through our platform.
Our 8-week intensive mentorship program is designed to provide personalized guidance and support to help you accelerate your startup journey. You'll be matched with a startup expert who will work with you one-on-one to set goals, overcome challenges, and make rapid progress.
To apply for the Mastery Program, simply click the "Request Invitation" button on our pricing page and fill out the application form. Our team will review your application and schedule a call with you to discuss your goals and determine if the program is a good fit for your needs.
We accept all major credit cards, including Visa, Mastercard, American Express, and Discover.
While we don't offer a free trial, we do provide a 14-day money-back guarantee. If you're not completely satisfied with your membership within the first 14 days, simply contact our support team, and we'll issue a full refund.
If you decide that Planet No Code isn't the right fit for you, you can cancel your membership at any time by logging into your account and navigating to the subscription management page. Click the "Cancel Membership" button, and your membership will be terminated at the end of your current billing cycle.