// if you provide conversation ID, You do not need to send all the messages every single time. supermemory automatically backfills it.
const client = new OpenAI({
baseURL:
"https://api.supermemory.ai/v3/https://api.openai.com/v1",
defaultHeaders: {
"x-supermemory-api-key":
"SUPERMEMORY_API_KEY",
"x-sm-user-id": `dhravya`,
"x-sm-conversation-id": "conversation-id"
},
})
const messages = [
{"role" : "user", "text": "SOme long thing"},
// .... 50 other messages
{"role" : "user", "text": "new message"},
]
const client.generateText(messages)
// Next time, you dont need to send more.
const messages2 = [{"role" : "user", "text": "What did we talk about in this conversation, and the one we did last year?"}]
const client.generateText(messages2)