UNPKG

@n8n/n8n-nodes-langchain

Version:
61 lines (55 loc) • 2.02 kB
/** * Text Classifier Node - Version 1 * Classify your text into distinct categories */ export interface LcTextClassifierV1Params { /** * Use an expression to reference data in previous nodes or enter static text */ inputText: string | Expression<string>; categories?: { /** Categories */ categories?: Array<{ /** Category to add */ category?: string | Expression<string>; /** Describe your category if it's not obvious */ description?: string | Expression<string>; }>; }; options?: { /** Allow Multiple Classes To Be True * @default false */ multiClass?: boolean | Expression<boolean>; /** What to do with items that don’t match the categories exactly * @default discard */ fallback?: 'discard' | 'other' | Expression<string>; /** Whether to add a classification field to each item with the model's confidence score for every category * @default false */ includeConfidenceScores?: boolean | Expression<boolean>; /** String to use directly as the system prompt template * @default Please classify the text provided by the user into one of the following categories: {categories}, and use the provided formatting instructions below. Don't explain, and only output the json. */ systemPromptTemplate?: string | Expression<string>; /** Whether to enable auto-fixing (may trigger an additional LLM call if output is broken) * @default true */ enableAutoFixing?: boolean | Expression<boolean>; }; } export interface LcTextClassifierV1SubnodeConfig { model: LanguageModelInstance | LanguageModelInstance[]; } interface LcTextClassifierV1NodeBase { type: '@n8n/n8n-nodes-langchain.textClassifier'; version: 1; } export type LcTextClassifierV1ParamsNode = LcTextClassifierV1NodeBase & { config: NodeConfig<LcTextClassifierV1Params> & { subnodes: LcTextClassifierV1SubnodeConfig }; }; export type LcTextClassifierV1Node = LcTextClassifierV1ParamsNode;