I want to be able to do send 100 values to openAI and get 100 different answers.
For example: I have a list of 100 product names and want from openAI to get a different introduction text for each one of those.
This is NOT about a bulk prompt eg “Write an introduction for the following 100 items…” → As this seems to limit its quality of output.
I rather want to send one dynamic prompt per value and then get 100 different answers.
Would be cool to save the results in the db but I’d take anything (csv export, copy from frontend etc.) as long as it works somehow.
What I have so far:
I’ve got connected to OpenAI API and can send 1 message and get one answer back.
I created two fields input_values and output_values to store the prompt values and get the results back.
But when it comes to introducing the backend workflow and sending multiple things at once I get lost with the existing guides as they seem not to be made for this use case but the single prompt use case.
You may make a backend workflow that includes the API call action, then use the “schedule API workflow on a list” action to trigger this workflow on the product names list, so the prompt will be static except for the product name will be dynamic.
@salemmo409 is right, a little more guidance.
-
Create a backend workflow that takes as a parameter your data type that has the fields input and output. It should have a single action inside with make changes a thing (the parameter) and it should change “output” field using external api as data (your api call to open ai
-
In the front end, you should have the action schedule an api workflow on a list, using the 100 prouct names you want and the API workflow created on step 1
Thanks!
I tried following your suggestions but I don’t get results back when I try to trigger it.
Here is the setup:
API Connector:
Backend workflow:
Frontend Workflow:
There are some issues with your set up:
- The backend workflow input parameter should just be “API response” type
- The thing to change should be this parameter (not the current search for)
- You’re not making change to any field, you should be changing the output value. The value it should be change to is the result from the api call to openai. For this, use the “Get data from an external api” and select the “Call openAI”. (you’ll need to change in the api connector your call in the “Use as” from action to data.
Before moving to the schedule an api workflow on a list, first make sure that this part works. For that, use the Data tab to select one record with a valid “input” and use the “Bulk operation” to perform the api workflow.
I tried following but probably made some mistakes - sorry I’m new to APIs and backend workflows.
API Connector: Changed from action to data type.
l
Backend Workflow: Not sure this is correct
Data: Not possible to select bulk operation:
Here some more pointers for your backend workflow:
- You just need one parameter, the API response
- Return data from api is a complete different thing haha, no use for your case
- The only action you need is Make changes to a thing, the thing will be the “API response” data you pass in the parameter. The data field you will change is the Output value, and the value is going to be “Get data from an external API” and follow to implement your OpenAI api call.
- When you try the bulk operation select only one valid “API response” with an input, to avoid runing a work in progress workflow on all your data
I (or you rather ) got it to run!
Thanks a lot for the patience and help!
1 Like