When I copy paste below code from npm docs, conversation is tracked but not when I try to save parentMessageId and use it later. Why? Is there anything that I am missing or must know?
const api = new ChatGPTAPI({ apiKey: process.env.OPENAI_API_KEY })
// send a message and wait for the response
let res = await api.sendMessage('What is OpenAI?')
console.log(res.text)
// send a follow-up
res = await api.sendMessage('Can you expand on that?', {
parentMessageId: res.id
})
console.log(res.text)
// send another follow-up
res = await api.sendMessage('What were we talking about?', {
parentMessageId: res.id
})
console.log(res.text)
When I copy paste below code from npm docs, conversation is tracked but not when I try to save parentMessageId and use it later. Why? Is there anything that I am missing or must know?
const api = new ChatGPTAPI({ apiKey: process.env.OPENAI_API_KEY })
// send a message and wait for the response let res = await api.sendMessage('What is OpenAI?') console.log(res.text)
// send a follow-up res = await api.sendMessage('Can you expand on that?', { parentMessageId: res.id }) console.log(res.text)
// send another follow-up res = await api.sendMessage('What were we talking about?', { parentMessageId: res.id }) console.log(res.text)