I thought the user parameter is doing this job. But it doesn’t work.
You need to refeed your previous responses to maintain context. (The user param is only for OpenAI to monitor abuse). Remember it is a completion AI, meaning that it can only take input and give output. To maintain context, you need to input the context.
Also, keep in mind that the new model, gpt-3.5-turbo
processes info differently than the Davinci model.
Davinci input is like this:
//import and configure...
const response = await openai.createCompletion({
model: "text-davinci-003",
prompt: "Say this is a test",
temperature: 0,
max_tokens: 7,
});
while the gpt-3.5-turbo model is like this:
//import and configure...
const response = await openai.createCompletion({
model: "gpt-3.5-turbo",
messages: [
{role: "user", content: "Say this is a test"},
],
temperature: 0,
});
So it's a little different. If you want to refeed for context, you need to make an input field in the "messages" - something like this...
//import and configure...
const message = "${<user input>}"
const context = "${<user previous messages if any, else empty>}"
const response = await openai.createCompletion({
model: "gpt-3.5-turbo",
messages: [
{role: "system", content: `${context}`},
{role: "user", content: `${message}`},
],
temperature: 0,
});
The "system" role is for the context, so gpt knows to respond to the user input primarily and not the system input. That can also be a useful field for prefacing user prompts fyi.
Hope that helps.
© 2022 - 2024 — McMap. All rights reserved.