This commit is contained in:
Lukian LEIZOUR 2023-03-04 15:29:08 +01:00
parent fcd80c5ac8
commit 8654d31004
4 changed files with 126 additions and 11 deletions

View file

@ -24,7 +24,21 @@ async function generateImage(query, ctx, bot) {
async function answerQuestion(query) {
response = await openai.createChatCompletion({
model: "gpt-3.5-turbo",
messages: [{ "role" : "user", "content" : query}],
messages: [{"role":"system", "content" : "You are a helpful assistant."},{ "role" : "user", "content" : "who is the president of the united states?" }, { "role" : "assistant", "content" : "Joe Biden"}],
temperature: 0.9,
}).catch((err) => {
console.log(err);
addToLogs("--> error : " + err);
})
console.log(response);
return response;
}
async function sendConv (messages) {
response = await openai.createChatCompletion({
model: "gpt-3.5-turbo",
messages: messages,
temperature: 0.9,
}).catch((err) => {
console.log(err);
@ -34,4 +48,4 @@ async function answerQuestion(query) {
return response;
}
module.exports = { generateImage, answerQuestion };
module.exports = { generateImage, answerQuestion, sendConv };