Trying To Build A Story Generator - Need Help Pulling From Database

So basically I want to build a story generating app that pulls from the OpenAi API and writes a story. However, I have a master excel sheet with a different story in each row. I want to be able to have my app pick a random row as a reference story and then make the api call. I can set up the OpenAI part just fine, I’m just struggling to figure out how pull from a excel or json file

UPDATED:
I need to be able to access that data item in a workflow. Let me show you:

There’s my openai api call. The is going to be a random story within the database. I want to call it in the work flow.

this is where I’d like to call that database item but I have no idea how to attach it here in the workflow.

Lastly, here’s some horror stories I uploaded in my database. Each item in the COMPLETION: column is a story. How can I randomly pick one of those to go into the workflow above?

Thanks all!

Could you just upload your Excel to the Bubble database and pull randomly from there? I feel this would give you more precise control.

1 Like

The question is how would I pull a random row from the database page?

Hi, every list has a “random item” option.

There are also all kinds of random number generators APIs on the web, depending on what kind of “random” you need.

You can also use the Math.random() function via JS in Bubble.

1 Like

I need to be able to access that data item in a workflow. Let me show you:

There’s my openai api call. The is going to be a random story within the database. I want to call it in the work flow.

this is where I’d like to call that database item but I have no idea how to attach it here in the workflow.

Lastly, here’s some horror stories I uploaded in my database. Each item in the COMPLETION: column is a story. How can I randomly pick one of those to go into the workflow above?

Thanks all!

Hi @contenthydra.

Regarding the (body) refstory. You would do a “search for” an entity in your db, leave the constraints blank and pick a random item for the result.
This is a different call, just as an example:

image

This topic was automatically closed after 70 days. New replies are no longer allowed.