FaustoNisida / Chatbot-Long-Short-Term-Memory

GPT-3 Chatbot with Long and Short Term Memory and advanced logic built in javascript with openai API - short and long memory, KYC, embeddings, openai, database, flexible, gpt-3.5-turbo, react
161 stars 37 forks source link

Reroll #3

Open Jaroslab opened 1 year ago

Jaroslab commented 1 year ago

Is there a way to add a message reroll function after it has been sent by the bot? Or edit function?

FaustoNisida commented 1 year ago

Is there a way to add a message reroll function after it has been sent by the bot? Or edit function?

What do you mean with "reroll"?

tovaru commented 1 year ago

They mean generating the last message with the same prompt again, like what ChatGPT does already.

FaustoNisida commented 1 year ago

Is there a way to add a message reroll function after it has been sent by the bot? Or edit function?

Yes, you can do it by writing a function that simply recalls the createChatCompletion method on the backend with the same input. Note that you would also have to delete the last two messages obtained from the getLastThreeInteractions() function and from the database(here you would have to delete only the last object) when calling this function in order to generate a new response that is not based on the previous generated message.

Jaroslab commented 1 year ago

Hello again. Sorry if I'm taking up your time, I just don't understand this topic at all. If you don't want to waste time on this, then just close the request. In another case, the next question is, is this function suitable? - async function regenerateResponse(input) { const response = await createChatCompletion(input);

const interactionHistory = await getLastThreeInteractions(); await deleteInteraction(interactionHistory[1].id); await deleteInteraction(interactionHistory[2].id);

const conversation = await getConversation(); conversation.pop(); conversation.pop();

return response; }