Convert dropdown text to number for API key value

Hello, I currently have an ai app that uses dropdown values (short, med, long) to determine the length of a chatbot response. The dropdown value is directly linked to the API key value.

I would like to use token amounts in my API call (100, 300, 500) to get more consistent responses. How can I convert the dropdown value to a corresponding preset value for the API call?

Any help would be greatly appreciated.

You will create an option set for your dropdown values. The display names will still be short, med, long, but they will also have an attribute to store number values.

See the demo below:
chrome_KFVL1zDN4A

And here is how the option set looks like. See the new attribute:

Here is how you edit the attributes:
chrome_GBKK5r6wrD

And here is the full example if you want to check details: Test for Forum 12 | Bubble Editor

1 Like

Thank you so much! I super appreciate the gifs!

1 Like