@n8n/n8n-nodes-langchain
Version:

70 lines (64 loc) • 2.35 kB
text/typescript
/**
* 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> | PlaceholderValue;
categories?: {
/** Categories
*/
categories?: Array<{
/** Category to add
*/
category?: string | Expression<string> | PlaceholderValue;
/** Describe your category if it's not obvious
*/
description?: string | Expression<string> | PlaceholderValue;
}>;
};
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>;
/** 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> | PlaceholderValue;
/** Whether to enable auto-fixing (may trigger an additional LLM call if output is broken)
* @default true
*/
enableAutoFixing?: boolean | Expression<boolean>;
/** Batch processing options for rate limiting
* @default {}
*/
batching?: {
/** How many items to process in parallel. This is useful for rate limiting, but might impact the log output ordering.
* @default 5
*/
batchSize?: number | Expression<number>;
/** Delay in milliseconds between batches. This is useful for rate limiting.
* @default 0
*/
delayBetweenBatches?: number | Expression<number>;
};
};
}
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;