UNPKG

@n8n/n8n-nodes-langchain

Version:

![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)

111 lines (105 loc) 4.4 kB
/** * Summarization Chain Node - Version 2.1 * Transforms text into a concise summary */ export interface LcChainSummarizationV21Params { /** * How to pass data into the summarization chain * @default nodeInputJson */ operationMode?: 'nodeInputJson' | 'nodeInputBinary' | 'documentLoader'; /** * Chunk splitting strategy * @displayOptions.show { /operationMode: ["nodeInputJson", "nodeInputBinary"] } * @default simple */ chunkingMode?: 'simple' | 'advanced'; /** * Controls the max size (in terms of number of characters) of the final document chunk * @displayOptions.show { /chunkingMode: ["simple"] } * @default 1000 */ chunkSize?: number | Expression<number>; /** * Specifies how much characters overlap there should be between chunks * @displayOptions.show { /chunkingMode: ["simple"] } * @default 200 */ chunkOverlap?: number | Expression<number>; options?: { /** The name of the field in the agent or chain’s input that contains the binary file to be processed * @displayOptions.show { /operationMode: ["nodeInputBinary"] } * @default data */ binaryDataKey?: string | Expression<string> | PlaceholderValue; /** Summarization Method and Prompts * @default {"values":{"summarizationMethod":"map_reduce","prompt":"Write a concise summary of the following:\n\n\n\"{text}\"\n\n\nCONCISE SUMMARY:","combineMapPrompt":"Write a concise summary of the following:\n\n\n\"{text}\"\n\n\nCONCISE SUMMARY:"}} */ summarizationMethodAndPrompts?: { /** Values */ values?: { /** The type of summarization to run * @default map_reduce */ summarizationMethod?: 'map_reduce' | 'refine' | 'stuff' | Expression<string>; /** Individual Summary Prompt * @hint The prompt to summarize an individual document (or chunk) * @displayOptions.hide { /options.summarizationMethodAndPrompts.values.summarizationMethod: ["stuff", "refine"] } */ combineMapPrompt?: string | Expression<string> | PlaceholderValue; /** Final Prompt to Combine * @hint The prompt to combine individual summaries * @displayOptions.hide { /options.summarizationMethodAndPrompts.values.summarizationMethod: ["stuff", "refine"] } */ prompt?: string | Expression<string> | PlaceholderValue; /** Prompt * @displayOptions.hide { /options.summarizationMethodAndPrompts.values.summarizationMethod: ["refine", "map_reduce"] } */ prompt?: string | Expression<string> | PlaceholderValue; /** Subsequent (Refine) Prompt * @hint The prompt to refine the summary based on the next document (or chunk) * @displayOptions.hide { /options.summarizationMethodAndPrompts.values.summarizationMethod: ["stuff", "map_reduce"] } */ refinePrompt?: string | Expression<string> | PlaceholderValue; /** Initial Prompt * @hint The prompt for the first document (or chunk) * @displayOptions.hide { /options.summarizationMethodAndPrompts.values.summarizationMethod: ["stuff", "map_reduce"] } */ refineQuestionPrompt?: string | Expression<string> | PlaceholderValue; }; }; /** 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 LcChainSummarizationV21SubnodeConfig { model: LanguageModelInstance | LanguageModelInstance[]; /** * @displayOptions.show { operationMode: ["documentLoader"] } */ documentLoader: DocumentLoaderInstance | DocumentLoaderInstance[]; /** * @displayOptions.show { chunkingMode: ["advanced"] } */ textSplitter?: TextSplitterInstance; } interface LcChainSummarizationV21NodeBase { type: '@n8n/n8n-nodes-langchain.chainSummarization'; version: 2.1; } export type LcChainSummarizationV21ParamsNode = LcChainSummarizationV21NodeBase & { config: NodeConfig<LcChainSummarizationV21Params> & { subnodes: LcChainSummarizationV21SubnodeConfig }; }; export type LcChainSummarizationV21Node = LcChainSummarizationV21ParamsNode;