How to do OpenAI Function Calling in Bubble.io

Search for a command to run...

No comments yet. Be the first to comment.
I have included all the information related to how you can build the Bubble plugin in this series. Check my course on how to build plugin from scratch- https://nocodetalks.co/bubbleplugin
There are instances when you may need to access an element created within the Bubble editor. For example, in a plugin, you might want to return the number of characters a user types into an input element. Follow these steps: Step 1: Enable the "Expos...
Most websites use CSS :hover for hover effects. You can see them in the stylesheet, copy them, move on. Framer doesn't do that. Framer uses a React animation library (Framer Motion) with a whileHove

https://www.youtube.com/watch?v=63Lkpw8fGAw Introduction to Xano: A No-Code Backend Solution When it comes to choosing the right backend service for your project, Xano emerges as a noteworthy contender. This video explores the various facets of Xan...
Hi Everyone, This newsletter will be a little different from the ones before. In this edition, I'm excited to launch the Xano Cohort program, which I will be running. The program will start on May 6th for 6 weeks. Why I am starting this: Whenever I...

Learn what workload units are in Bubble, how they are calculated, and discover actionable strategies to optimize and reduce your app's workload units for better performance and cost efficiency. One think before moving forward- If you are reading thi...

There are instances when you may need to access an element created within the Bubble editor. For example, in a plugin, you might want to return the number of characters a user types into an input element. Follow these steps: Step 1: Enable the "Expos...

Function Calling is a way to receive the pre-defined JSON-type response from an OpenAI API call.
If you are familiar with OpenAI API, you have observed that it returns the text only. So if you query OpenAI API to list down the list of exercises and you want to show them into repeating groups OpenAI will just return the text that you can't show them into repeating groups.
But now you can-
Here is the step by step to get the pre-defined response using OpenAI -
We are going to fetch the list of recipes based on the user input.
Step 1:
Install the API connector plugin-

Step 2:
Setup the OpenAI API -
Get your OpenAI Key from here-

Now, time to set the API -
Since we want a recipe list that's going to be a list of texts- so we are going to pass the JSON-Array with a custom JSON object.

Here is the complete JSON that needs to be passed-
{
"model": "gpt-4-0613",
"messages": [
{
"role": "user",
"content": "Give me list of receipes that I can prepare to <input>"
}
],
"functions": [
{
"name":"receipe_list",
"description":"Recipe List",
"parameters":{
"type":"object",
"properties":{
"receipe_list":{
"type":"array",
"items":{
"type":"object",
"properties":{
"name":{
"type":"string",
"description":"Name of receipe, e.g. Lentil Soup "
}
}
}
}
},
"required":[
"receipe_list"
]
}
}
],
"temperature": 0.1
}
Step 3-
We need to set up one Backend workflow that will convert JSON string into JSON. Since the response we got from the open ai is in the string we need to convert it into JSON.


To see how you need to set up the workflow, check YouTube video -
Follow me on Twitter to learn more about Bubble.