Create a table out of my text input and gpt output

Hey!! :grinning:

I'm trying to fill my table with what I write in textInput1 and what GPT generates as output in text2 .

For example, I would like my table to be filled like this right now : ID 1, Input "hola," Output "¡Hola! ¿En qué puedo ayudarte hoy?". Then, I would like the next interactions to be added in sequence (ID 2, 3, 4...). I want the table to update with the new interaction only after clicking button1. How can I do this? I'm new to these things and encountering some difficulties. :face_with_peeking_eye:
Thank you very much.

1 Like

Hi Matilde,

Have you set up the query where you save the data?

2 Likes

One way to accomplish this would be to request that GPT return the result in a JSON object (add the directive to the prompt) and create the table from that object.

Depending on what you are trying to do:

  1. You will need to play with the prompting both to get what you want and to define the output consistently
  2. Process the response JSON into a DB (or something) instead of directly off the chat. In the example below, I sent it through a Retool JSON explorer object which cleaned it up for me.
  3. The Chat will look pretty off since GPT is responding in JSON; you might not want to use that format.

As a simplistic POC:

jsonExplorer source {{JSON.parse(chat1.data[1].value)}}
table source: {{jsonExplorer2.value.daily_schedule}}

Good luck.

2 Likes

Thank you very much, you've been very helpful! However, in the end, I used JSON Editor. :slight_smile: