Skip to main content

Classify

ug-js-sdk


ug-js-sdk / Classify

Interface: Classify

Defined in: types/index.ts:890

Classify utility for categorizing input into predefined answers.

Use this to classify user input into one of several predefined categories. The classification_question is a template that can use context variables.

Example

const sentimentClassifier: Classify = {
type: 'classify',
classification_question: 'What is the sentiment of: {{user_input}}?',
answers: ['positive', 'negative', 'neutral'],
}

Extends

  • Utility

Properties

debug?

optional debug: boolean

Defined in: types/index.ts:859

Enable debug mode for this utility

Inherited from

Utility.debug


type

type: "classify"

Defined in: types/index.ts:891

The type of utility

Overrides

Utility.type


classification_question

classification_question: string

Defined in: types/index.ts:896

The question to classify. Can be a template with context variables. Has access to the context relevant to the stage when it's evaluated.


additional_context?

optional additional_context: string

Defined in: types/index.ts:898

Optional additional context to help with classification


answers

answers: string[]

Defined in: types/index.ts:900

The possible answer categories