Skip to main content

Input

Type: String The data type that TextClassifierNode accepts as input

Output

Type: GraphTypes.ClassificationResult The data type that TextClassifierNode outputs

Examples

// Using component configuration
const classifierNode = new TextClassifierNode({
id: 'content-classifier',
modelWeightsPath: '/models/classifier_weights.json',
embedderComponentId: 'text_embedder_component',
supportedClasses: ['hategroup', 'selfharm', 'sexual', 'sexualminors', 'substance'],
classifierConfig: {
classes: [
{ label: 'hategroup', threshold: 0.8 },
{ label: 'selfharm', threshold: 0.9 }
]
}
});

// Using existing text classifier component
const classifierComponent = new TextClassifierComponent({
id: 'existing-classifier-component',
modelWeightsPath: '/models/classifier_weights.json',
embedderComponentId: 'text_embedder_component',
supportedClasses: ['hategroup', 'selfharm']
});
const classifierNodeWithComponent = new TextClassifierNode({
id: 'content-classifier',
textClassifierComponent: classifierComponent
});

Constructors

Interfaces


Constructors

constructor

new TextClassifierNode(props: TextClassifierNodeProps | TextClassifierNodeWithComponentProps): TextClassifierNode
Creates a new TextClassifierNode instance.

Parameters

props
TextClassifierNodeProps | TextClassifierNodeWithComponentProps
required
Configuration for the text classifier node.

Returns

TextClassifierNode

Interfaces

ClassifierClass

Configuration for a single classification class

Properties

label: string The class label for the classification category (raw name like “hategroup”, “selfharm”) threshold: number Threshold value for classification confidence

ClassifierConfig

Configuration for the text classifier

Properties

classes: ClassifierClass[] Array of classes to classify with their thresholds

TextClassifierNodeProps

Array of classes to classify with their thresholds

Properties

modelWeightsPath: string Path to model weights for text classification embedderComponentId: string Text embedder component ID to use for semantic analysis supportedClasses: string[] List of supported classes that the model can classify classifierConfig?: ClassifierConfig Optional classifier configuration with classes and thresholds errorHandling?: NodeErrorConfig Optional error handling configuration for the node

TextClassifierNodeWithComponentProps

Optional error handling configuration for the node

Properties

textClassifierComponent: TextClassifierComponent Pre-configured text classifier component to reuse classifierConfig?: ClassifierConfig Optional classifier configuration with classes and thresholds errorHandling?: NodeErrorConfig Optional error handling configuration for the node