How to Group User Data Fields for OpenAI API Call in Workflow

I’m currently working on sending an OpenAI API call out and having it read the info on a data type and answer based on this info. I have a data type ‘User’ with fields ‘name’, ‘gender’, ‘bio’, ‘location’, and ‘slug’. I’m trying to send an API call to OpenAI that performs a search for a ‘User’ type and uses this information, grouped by user, in the arbitrary text in the prompt and my workflow.

What I’m trying to achieve is to add the user’s ‘name’ and ‘bio’ and then add the next user’s details, and so on, all in the arbitrary text in the workflow. This way, all of this information is sent in the prompt to OpenAI.

  1. How do i ‘search for users: each item’s name’ and then in that same line add ‘each item’s bio’?
  2. Then how do I add each subsequent user after that in the same format?

Basically so that the api call prompt looks like this:
Billy Dean
good guy that likes stuff.
Mary Willis
Nice girl with an attitude.
John Hampton
A guy who’s good at juggling.
… and so on.

Then it’s readable and GPT can answer a question about these users.

Here’s as far as I’ve been able to get,

I’m completely stuck, is there any way to do this?
I’m not concerned with token limits or anything at this point, I’m just trying to get it to work.

Anyone?

One more try :slight_smile:

I’m not sure to totally understand, but I guess what you are looking for is to submit a list of user (array) with a different content for each of them?
So probably you will use prompt with [Do a search for users:format as text] and in the format as text, you will set the JSON and use This user name

Yes! That works perfectly!!! THANKS so much @Jici!

1 Like