Writebot is a Node.js library that enables developers to generate text using AI. Using Writebot, developers can create their own custom text generation presets to fit their specific needs.
You can find the full documentation for Writebot here.
Writebot works by taking a preset and a set of parameters and producing text with the corresponding AI.
However, developers can also create their own custom presets to fit their needs.
To install Writebot, use the following command:
npm install writebot
or
yarn add writebot
Writebot is a Node.js library and can be used in any Node.js project. To use Writebot, import the library and the desired preset:
To generate text with the desired preset first get your API Key from openai, then use the write
method and pass in the preset name or object and the parameters:
This will generate a tweet about AIs with an "afraid" tone.
const {Writebot} = require('writebot');
const TweetGen = require('tweet-gen');
Writebot.initialize({
// You can get this at openai
apiKey: 'API_KEY',
})
const tweet = Writebot.write(TweetGen, {
description: 'A tweet about AIs',
tone: 'Afraid'
});
Result:
I'm scared of the way #AI is taking over our world. It feels like our humanity is being taken away from us, one algorithm at a time. #AIisComing
Or if you would like to use string to identify preset you could do it like this:
const Writebot = require('writebot');
Writebot.initialize({
apiKey: 'API_KEY',
// Add the presets you would like to use here.
types: [
require('tweet-gen')
]
})
const tweet = Writebot.write('tweet', {
description: 'A tweet meme about developers.',
tone: 'Sarcastic'
});
Result:
Developers: Always finding new and creative ways to break things. #ProgrammingProblems
Writebot is released under the MIT License. See LICENSE for details.