testing chatgpt logic

This commit is contained in:
Daniel Avila 2023-02-04 20:09:02 -05:00
parent 521a8eb704
commit 39781f5318

10
app/chatgpt.js Normal file
View file

@ -0,0 +1,10 @@
require('dotenv').config();
(async () => {
const { ChatGPTAPI } = await import('chatgpt');
const api = new ChatGPTAPI({ apiKey: process.env.OPENAI_KEY });
// send a message and wait for the response
let res = await api.sendMessage('What is OpenAI?');
console.log(res);
})();