Saving data from OpenAI API to database

Hi,

I’ve got the following problem…

I want to ask OpenAI to send back a response to a query for a table of data in a format that would allow me to save it to the database.

For example, create a data table for 10 largest cities: name of city, populations, country, etc. Provide the data in X format.

OpenAIs returns a text response and I’m not sure if/how I could extract such data from a text response and save it as a ‘thing’ on the database.

Does anyone have any thoughts on how this might be possible?

Thanks!

1 Like

Don’t forget to put your API key in Quickstart tab

Preview: https://bubble-solutions.bubbleapps.io/version-test/openai?debug_mode=true&section=usecases&subsection=table
Editor: Bubble-solutions | Bubble Editor

feel free ask Qs

Hey @Eugene_West this is cool! Thanks for sharing.

Is there a way of directly saving the list of JSON responses to the database, without having to hit save in each RG cell?

I’ve been trying to see if I can run an API workflow on a list of JSON texts but can’t seem to get it to work.

This’s what i’m thinking to do in next changes

Done. But you need a paid plan to run a recurring event to save all rows of the table at once

Hello Eugene, I’m new to Buble and I need to do exactly what you have done in the “create spreadsheet” use case. But, as I’m very new in Bible and your app handles several use cases, for me is difficult copy the parts I need. Any suggestions?. Thank you.

hi @Eugene_West , which part of your action / workflow where you convert openAI response. all I see is just first item’s message: content…

I am thingking of extracting from, say, bulleted points:

then extract those city values into a table.

also, would something like this:

  • City: Tokyo
  • Population: 20 million

I want to put Tokyo in a field called city, and 20 million in population field.

can something like this be done?

Thank you :pray: