Getting an API key
- Join the Discord server.
- Get your API key from the
#Bot
channel by using the /key
command. - Copy the API key that the bot gives you
Installation
- Run
npm init -y
- Go to your package.json file and add
"type": "module"
at the end (before the }
) - Run
npm i gpt-proxy
- Add
import gpt from 'gpt-proxy'
to your index.js file
Creating gpt instance
const model = new gpt({
'api_key': 'your API key',
'temperature': 0.7,
'max_tokens': 256
})
Text Completion
const completion = await model.text_completion('Human: Hello!\nAI:', [
'Human:',
'AI:'
])
console.log(completion.choices[0].text)
Chat Completion
const completion = await model.chat_completion([
{
'role': 'system',
'content': `You are a helpful assistant, your name is Joe`
},
{
'role': 'user',
'content': 'What\'s your name?'
}
])
console.log(completion.choices[0].message.content)
Have fun using this library, its great for small projects like chat bots, you can support the project that this library uses in the discord server
Coming soon:
Whisper model
Fine tuning (maybe)