classification(prompt, modelopt, choicesopt) → {string}
Classify a piece of text.
Optionally, an array of classification choices can be specified.
Parameters:
Name |
Type |
Attributes |
Description |
prompt |
string |
|
The text to classify.
|
model |
string |
<optional> |
The ID of the model to use. Uses the default if not specified.
|
choices |
Array.<string> |
<optional> |
Optional array of possible classifications.
|
Returns:
string
The classification.
Example:
// Attempt to determine the genre of a book from its first paragraph
var choices = ['sci-fi', 'romance', 'thriller'];
var genre = connectors.verjio.openai.classification(tables.books.first_paragraph.value, 'gpt-3.5-turbo', choices);
keywords(prompt, modelopt, maxopt) → {string}
Determine keywords from a piece of text.
Parameters:
Name |
Type |
Attributes |
Description |
prompt |
string |
|
The text to analyse.
|
model |
string |
<optional> |
The ID of the model to use. Uses the default if not specified.
|
max |
number |
<optional> |
The maximum number of keywords to return.
|
Returns:
string
The keywords as a bullet-list, delineated by -
.
Example:
// Returns 3 keywords, e.g.
// - penguins
// - anartic
// - ice
connectors.verjio.openai.keywords(
'Penguins are natives of the antartic, otherwise known as the southern ice caps.',
'gpt-3.5-turbo',
3
);
sentiment(prompt, modelopt, choicesopt) → {string}
Determine the sentiment of a piece of text.
A sentiment is usually 'positive', 'neutral' or 'negative' but you can specify a custom list.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
prompt |
string |
|
|
The text to analyse.
|
model |
string |
<optional> |
|
The ID of the model to use. Uses the default if not specified.
|
choices |
Array.<string> |
<optional> |
['positive', 'neutral', 'negative'] |
Array of sentiment choices to choose from.
|
Returns:
string
The chosen sentiment from the choices array.
Example:
// Likely to return 'positive'
connectors.verjio.openai.sentiment('The sun was bright and the day was young. Harry felt like he could achieve anything.');