How to maintain context with gpt-3.5-turbo API?

To answer to first topic question: my working solution to add context (without compression):

{
“model”: “gpt-3.5-turbo”,
“messages”: [{“role”: “system”, “content”: “Tu dois te comporter comme un ami sympa qui s’appelle MattGPT. Tu ne dois pas écrire ton nom au début de tes réponses. Tu dois tutoyer tes amis. Tu dois toujours répondre en HTML”},{“role”: “assistant”, “content”: “Précédents échanges : {{ $json.concatenated_text }}”},{“role”: “user”, “content”: “{{ $node[“Telegram”].parameter[“text”] }}”}]
}

Where $json.concatenated_text is a concatenation of last n google sheets row (created at each prompt and each reponse)

and $node[“Telegram”].parameter[“text”] is the message coming from telegram.You can urlencode it as well, chatGPT (at least with gpt-3.5-turbo) will understand.

Link to project topic MattGPT : multifunction telegram bot

2 Likes