How to integrate ChatGPT chat completion API with Yellow Messenger?

How can I continuously append objects to the messages array in the ChatGPT chat completion API response when integrating it with Yellow Messenger?

Following is a request body of the API I am using:

{
“model”: “gpt-3.5-turbo”,
“messages”: [
{
“role”: “system”,
“content”: “Hello it’s a system message string!”
},
{
“role”: “user”,
“content”: “Hello it’s a user message string!”
},
{
“role”: “assistant”,
“content”: “Hello it’s an api response string!”
},
and it sholud be appending till conversation overs…
]
}

@Xaif

We have an out of the box integration with gpt-3. This node allows you to pass a prompt into the node and returns the output.

The interaction can be

User asks a question
GPT responds
Store these as

Converation Context

User: Question
Assistant: GPT_Reponse

User performs a follow up question - store this in a string
Write a function to append the string to the Conversation Context variable

And you can create a looped conversation.

How would you want this conversation to end is something you can decide at a Conversation Design level