Create a task that updates a field with ChatGPT result

Options

Hi guys,

I have a band table with the fields "Name", "About_en" and "About_es" (and some others).

I'd like Xano to have a task that identifies when a "About_en" is empty and use a merged pre-defined prhase to call ChatGPT api and save the result in "About_en" and translaton to "About_es".

The phrase would be like "Describe in 200 words the band" + [name of the band] + "located in XXX"

Is that possible?


Thank you,

Edgard.

Comments

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    edited February 2023
    Options

    Yes. Query the database for records where about_en is blank. Then loop over the result set (using a for each). Within the loop, make a variable to build the text of your prompt. Then query openAI (via their API, not chatGPT). Feed the resulting text into an "edit record" query based on the ID of the current item. Voila!

    We often work on integrating AI into projects in our daily State Change Pro office hours where we work on the hardest 5% of projects. Even held an OpenAI-specific meeting last week!