GPT2

This API starts a GPT2 text generation process and waits for the response.

Add this to your Node.js code:

const booste = require('booste');

const outList = await booste.gpt2(apiKey, inString, length)

Arguments:

Arg Description Required Type Example
apiKey Your API key, found on the User Dashboard True string "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
inString The given sequence of words True string "I went on a walk and suddenly, I"
length The quantity of words to predict following the in_string False (default=5) int 10

Return Type:

List - the predicted text, separated into list form.

To convert to string, add:

var outString = outList.join(' ');

Fine-Tuning:

Adjusting these parameters from the default is not recommended.

Arg Description Required Type Example
temperature A value between 0.1 and 1, to adjust randomness.

- Smaller values create seemingly random output.
- Larger values create repeating phrases in the output.
False (default=0.8) float 0.8
windowMax A value between 1 and 1023, to manage inference workload.

GPT-2 can only accept an input string less than 1024 words long. Booste uses a "sliding window" approach to handle longer length requests, where the input string is trimmed to the n=window_max most recent words.

- Smaller values will generate text quickly (0.3 sec/word), but output will drift to unrelated topics due to lost context.
- Larger values will generate text slowly (2 min/word), but output will retain more context.
False (default=100) int 250

GPT2 Start

This is the asynchronous version of the API.
It starts a GPT2 text generation process and returns a taskID.

Add this to your Node.js code:

const booste = require('booste');

const taskID = await booste.gpt2Start(apiKey, inString, length)

Arguments:

Arg Description Required Type Example
apiKey Your API key, found on the User Dashboard True string "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
inString The given sequence of words True string "I went on a walk and suddenly, I"
length The quantity of words to predict following the in_string False (default=5) int 10

Return Type:

String - a task ID for your inference job.
Use this taskID with the check function at a later time to check on the job.

Fine-Tuning:

Adjusting these parameters from the default is not recommended.

Arg Description Required Type Example
temperature A value between 0.1 and 1, to adjust randomness.

- Smaller values create seemingly random output.
- Larger values create repeating phrases in the output.
False (default=0.8) float 0.8
windowMax A value between 1 and 1023, to manage inference workload.

GPT-2 can only accept an input string less than 1024 words long. Booste uses a "sliding window" approach to handle longer length requests, where the input string is trimmed to the n=window_max most recent words.

- Smaller values will generate text quickly (0.3 sec/word), but output will drift to unrelated topics due to lost context.
- Larger values will generate text slowly (2 min/word), but output will retain more context.
False (default=100) int 250

GPT2 Check

This is the asynchronous version of the API.
It checks on an existing GPT2 text generation process and returns the status.

Add this to your Node.js code:

const booste = require('booste');

const jsonOut = await booste.gpt2Check(apiKey, taskID)

Arguments:

Arg Description Required Type Example
apiKey Your API key, found on the User Dashboard True string "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
taskID The task ID returned by the start function True string "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

Return Type:

json - a json object structured as follows:

If the job is still running or has failed:

{
   'Status': jobStatus,
   'TaskID': taskID
}

If the job was successful:

{
   'Status': jobStatus,
   'Output': outList
}