Skip to main content

Hi,

I have a GET Webhook that retrieves all the messages from a conversation previously created using an LLM app (CustomGPT)

The data received as the following structure:

data

    Conversation

        Conv ID

        Conv Created at

        …..

    Messages

       Current page

       data

          1 

              xxxx

              AI Response

           2

              yyyyy

              AI response

I want to retrieve the AI response of the last message in the conversation.

I have tried to use a Code step with Python to process the output of the GET.

The output of the GET has a field that contains all the responses in the following format:

responses_list = AI_response1, AI_response 2, AI_response3, etc.

I have tried to split it with:

output = input_datat"responses_list"].split(",")

Since each response may contain commas, I cannot isolate the responses but only phrases between commas.

I have tried to get a JSON key output by selecting the option in the GET step, but I was not able to find a way to access that JSON output from the Code step.

Any suggestion on how to address this issue?

Thanks!

Sorry, I want to access the first response in the list, i.e. reposnse1. The GET request order the messages so that the first messages is the latest


Hi @VittorioP 

Looks like the data from the GET is returned as an array.

One option is to use the Looping (Create Loop from Line Items) app followed by a Filter to only continue if Loop Iteration = 1.

 

Another options would be to use Formatter > Utilities > Line Items to Text, followed by Formatter > Text > Split (return as separate fields).


@Troy Tessalone 

thank you for your answer!

I ended up using Formatter > Utilities > Pick from List > Choose First.

It works in my case in one step.