@n8n/n8n-nodes-langchain
Version:

58 lines (52 loc) • 2.28 kB
text/typescript
/**
* Structured Output Parser Node - Version 1
* Return data in a defined JSON format
*/
export interface LcOutputParserStructuredV1Params {
/**
* Example JSON object to use to generate the schema
* @displayOptions.show { schemaType: ["fromJson"] }
*/
jsonSchemaExample?: IDataObject | string;
/**
* Schema to use for the function
* @hint Use <a target="_blank" href="https://json-schema.org/">JSON Schema</a> format (<a target="_blank" href="https://json-schema.org/learn/miscellaneous-examples.html">examples</a>). $refs syntax is currently not supported.
* @displayOptions.show { schemaType: ["manual"] }
*/
inputSchema?: IDataObject | string | Expression<string>;
/**
* JSON Schema to structure and validate the output against
*/
jsonSchema?: IDataObject | string | Expression<string>;
/**
* Whether to automatically fix the output when it is not in the correct format. Will cause another LLM call.
* @default false
*/
autoFix?: boolean | Expression<boolean>;
/**
* Whether to customize the prompt used for retrying the output parsing. If disabled, a default prompt will be used.
* @displayOptions.show { autoFix: [true] }
* @default false
*/
customizeRetryPrompt?: boolean | Expression<boolean>;
/**
* Prompt template used for fixing the output. Uses placeholders: "{instructions}" for parsing rules, "{completion}" for the failed attempt, and "{error}" for the validation error message.
* @hint Should include "{error}", "{instructions}", and "{completion}" placeholders
* @displayOptions.show { autoFix: [true], customizeRetryPrompt: [true] }
*/
prompt?: string | Expression<string> | PlaceholderValue;
}
export interface LcOutputParserStructuredV1SubnodeConfig {
/**
* @displayOptions.show { autoFix: [true] }
*/
model: LanguageModelInstance | LanguageModelInstance[];
}
interface LcOutputParserStructuredV1NodeBase {
type: '@n8n/n8n-nodes-langchain.outputParserStructured';
version: 1;
}
export type LcOutputParserStructuredV1ParamsNode = LcOutputParserStructuredV1NodeBase & {
config: NodeConfig<LcOutputParserStructuredV1Params> & { subnodes: LcOutputParserStructuredV1SubnodeConfig };
};
export type LcOutputParserStructuredV1Node = LcOutputParserStructuredV1ParamsNode;