This API starts a GPT2-XL text generation process and waits for the response.
const booste = require('booste');
const outList = await booste.gpt2XL(apiKey, inString, length)
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 |
List - the predicted text, separated into list form.
To convert to string, add:
var outString = outList.join(' ');
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 (1 sec/word), but output will drift to unrelated topics due to lost context. - Larger values will generate text slowly (4 min/word), but output will retain more context. |
False (default=100) | int | 250 |
This is the asynchronous version of the API.
It starts a GPT2-XL text generation process and returns a taskID.
const booste = require('booste');
const taskID = await booste.gpt2XLStart(apiKey, inString, length)
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 |
String - a task ID for your inference job.
Use this taskID with the check function at a later time to check on the job.
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 (1 sec/word), but output will drift to unrelated topics due to lost context. - Larger values will generate text slowly (4 min/word), but output will retain more context. |
False (default=100) | int | 250 |
This is the asynchronous version of the API.
It checks on an existing GPT2 text generation process and returns the status.
const booste = require('booste');
const jsonOut = await booste.gpt2XLCheck(apiKey, taskID)
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" |
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
}