#APi doesn't recognize old conversation with the user.

8 messages · Page 1 of 1 (latest)

open pulsar
#

i have a questions with chat-gpt-turbo

currently this is my implementation...

        messages: [
          {role: "system", content: "You are a helpful assistant."},
          {role: "user", content: `${prompt}`}
        ], 

lets say... all of the chat is stored in a database, should i include it on the api like this? because I am scared requesting lots of data to the api

     const response = await openai.createChatCompletion({
        model: "gpt-3.5-turbo",
        messages: [
          {role: "system", content: "You are a helpful assistant."},
          //...old chat from database here
          {role: "user", content: `${prompt}`}
        ], 
        temperature: 0.2,
        max_tokens: 125,
        top_p: 1,
        frequency_penalty: 0,
        presence_penalty: 0,
     });
     console.error(response.data.choices)
     res.status(200).send({
      bot: response.data.choices[0].message.content
    });
limber bobcat
#

Hi. I'm still trying to figure this out myself, but that's basically what I'm doing with my app right now. Please correct me if I'm wrong on this, but since the API only processes data we send them, they don't have any idea what was in the conversation unless we let them know the history of the conversation itself. Though instead of calling the whole history, I only call the last 10 messages (more or less depends on your situation) to prevent requesting lots of data to the API, and just enough to kick start the context of the conversation.

open pulsar
#
        messages: [      
          {role: "system", content: "You are a helpful assistant."}, 
          ...prompt
        ], 
limber bobcat
#

I see. Thanks for letting me know!

random oak
#

Yup, you must add everything, token usage will build as the conversation builds

open pulsar