bettergpt
v1.0.5
Published
bettergpt is a node module that allows you to easily interact with the [ChatGPT](https://chat.openai.com/)
Downloads
4
Maintainers
Readme
About
bettergpt is a node module that allows you to easily interact with the ChatGPT
Install
npm install bettergpt
Example
const { GPT } = require("bettergpt")
async function example() {
let gpt = new GPT('your_api_key');
gpt.useProxy('https://ai.fakeopen.com/api/conversation');
let response = await gpt.sendMessage('hey!');
console.log(response)
}
example()
History
import GPT, { Message } from './bettergpt';
function example() {
let gpt = new GPT('your_api_key');
gpt.useProxy('https://ai.fakeopen.com/api/conversation');
gpt.addMessage({
role: 'system',
text: `You can only response with JSON format from now, {
message: "your message",
}`,
})
gpt.onProgress = (message: Message) => {
console.log(message.text);
}
let result = await gpt.sendMessage("hey!");
console.log(result);
}
example();