Hi
I have found a solution that works for me, maybe it can be useful for anyone else:
First I create two arrays of strings:
- workflow.arrayPreguntasUser
- workflow.arrayRespuestasChatbot
Then, in a execute code before sending the request to the LLM:
const productInfo = []
workflow.arrayPreguntasUser.push(workflow.pregDirectaCohere)
workflow.arrayRespuestasChatbot.push(workflow.respuestaCohere)
for (let i = 0; i < workflow.arrayPreguntasUser.length; i++) {
const chatCohereUser =
{
role: "User",
message: workflow.arrayPreguntasUser[i]
}
const chatCohereChatbot =
{
role: "Chatbot",
message: workflow.arrayRespuestasChatbot[i]
}
productInfo.push(chatCohereUser,chatCohereChatbot)
}
This way I always have all the user's questions and all the chatbot's answers to pass to the LLM in order to have complete context of the conversations so I can get more accurate answers.
Hope this can help.
Thanks!!!