JavaScript
Classification - Javascript SDK
Classification
PromptDesk facilitates the output of classification LLM models.
By default, the LLM classifies generated strings 'yes' and 'true' as True, and 'no' and 'false' as False. LLM output is case-insensitive. f
const text = "I am happy"
const isHappy = pd.generate("is-happy", {
"text": text
}, {
"classification": true
})
console.log(isHappy)
Custom Classification
We can assign generated output to custom classes.
const text = "I am happy"
const isHappy = pd.generate("is_positive", {
"text": text
}, {
"classification": {
true: ["positive", "happy"],
false: ["negative", "sad"],
null: ["neutral"]
}
})
console.log(isHappy)
We can assign generated output to string-based classes.
const text = "I am happy"
const isHappy = pd.generate("is_positive", {
"text": text
}, {
"classification": {
"positive": ["positive", "happy"],
"negative": ["negative", "sad"],
"neutral": ["neutral"]
}
})
console.log(isHappy)
