Hi everyone,
I’m working on a project where I need to automatically generate and update an array of integers (tags_google
) in a database table (google_reviews
) based on the content of a text column (review
). Here’s the setup:
- Tables Involved:
google_reviews
: Contains columns id
, review
(text), and tags_google
(array of integers).
tags_google_reviews
: Contains columns id
(integer), positive_new
(YES/NO/NULL), and description
(text).
- Objective:
- If
tags_google
already has values, do not modify it.
- If
review
is empty, skip processing.
- If
review
contains text, analyze it to determine which tags (from tags_google_reviews
) are relevant based on their description
.
- Update the
tags_google
array with the IDs of the relevant tags. If no tags match, leave the array unchanged.
- Example:
- Review:
"Easy, reliable, fast. Make sure your phone stays on because you'll need it again. You can also choose to take something and put back your stuff, very convenient."
- Tags:
- ID 1:
"The booking process is simple and straightforward, with few steps and no complications."
- ID 2:
"Trust in the security of the service, ensuring peace of mind when leaving luggage."
- Resulting Array:
[1, 2]
- Questions:
- Is it possible to implement this logic using Workflows and Retool AI ?
Any guidance or examples would be greatly appreciated!
Hey @Carlos_Hidalgo,
Yes, this is absolutely doable.
Quick question, do you want for this to be scheduled/run every so often in the background, or to be triggered by a user in an app?
In any case, let's say you're using a workflow, you could use the following blocks:
1- Get your google_reviews data. If using a database, you could already apply filters mentioned in 2.1 and 2.2. Otherwise you could add another block to apply the filters
2- Get your tags_google_reviews data so you use it as context in a later block for your AI
3- An AI block which analyzises data from block 1, using block 2 as context. You could use Chat GPTs structured outputs so that you already get the resulting array that you can use in the following blocks to update your following blocks
4- Manipulate data from block 3 if needed
5- Update your google_reviews table.
Hope this helps!
2 Likes
Yes, that's a good start.
Something to bear in mind with your AI block is:
- I'm not sure [i] will work. You may want to transform this block to a loop block so that it performs the same operation for each row in the first block.
- Retool AI doesn't have structured output enabled, so it may be difficult to get the output as you need it to use it in the following blocks. It is quite straightforward to create your ChatGPT api key so you can post your own api with structured output.
Hey @Carlos_Hidalgo 
Just checking in to see if this is something you may still need help with?
1 Like
I couldn't complete the automation I wanted in the end, but I've signed up for the webinar "How to build AI apps with (almost) any LLM" on March 4th at 10 AM PST to see if I can clear up my doubts.
2 Likes
Love to hear it. Let us know how you enjoy the webinar!
1 Like