diff --git a/packages/@n8n/nodes-langchain/nodes/chains/InformationExtractor/InformationExtractor.node.ts b/packages/@n8n/nodes-langchain/nodes/chains/InformationExtractor/InformationExtractor.node.ts
new file mode 100644
index 000000000..bdf5163d8
--- /dev/null
+++ b/packages/@n8n/nodes-langchain/nodes/chains/InformationExtractor/InformationExtractor.node.ts
@@ -0,0 +1,308 @@
+import { jsonParse, NodeConnectionType, NodeOperationError } from 'n8n-workflow';
+import type {
+ INodeType,
+ INodeTypeDescription,
+ IExecuteFunctions,
+ INodeExecutionData,
+ INodePropertyOptions,
+} from 'n8n-workflow';
+import type { JSONSchema7 } from 'json-schema';
+import type { BaseLanguageModel } from '@langchain/core/language_models/base';
+import { ChatPromptTemplate, SystemMessagePromptTemplate } from '@langchain/core/prompts';
+import type { z } from 'zod';
+import { OutputFixingParser, StructuredOutputParser } from 'langchain/output_parsers';
+import { HumanMessage } from '@langchain/core/messages';
+import { generateSchema, getSandboxWithZod } from '../../../utils/schemaParsing';
+import {
+ inputSchemaField,
+ jsonSchemaExampleField,
+ schemaTypeField,
+} from '../../../utils/descriptions';
+import { getTracingConfig } from '../../../utils/tracing';
+import type { AttributeDefinition } from './types';
+import { makeZodSchemaFromAttributes } from './helpers';
+
+const SYSTEM_PROMPT_TEMPLATE = `You are an expert extraction algorithm.
+Only extract relevant information from the text.
+If you do not know the value of an attribute asked to extract, you may omit the attribute's value.`;
+
+export class InformationExtractor implements INodeType {
+ description: INodeTypeDescription = {
+ displayName: 'Information Extractor',
+ name: 'informationExtractor',
+ icon: 'fa:project-diagram',
+ iconColor: 'black',
+ group: ['transform'],
+ version: 1,
+ description: 'Extract information from text in a structured format',
+ codex: {
+ alias: ['NER', 'parse', 'parsing', 'JSON', 'data extraction', 'structured'],
+ categories: ['AI'],
+ subcategories: {
+ AI: ['Chains', 'Root Nodes'],
+ },
+ resources: {
+ primaryDocumentation: [
+ {
+ url: 'https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.information-extractor/',
+ },
+ ],
+ },
+ },
+ defaults: {
+ name: 'Information Extractor',
+ },
+ inputs: [
+ { displayName: '', type: NodeConnectionType.Main },
+ {
+ displayName: 'Model',
+ maxConnections: 1,
+ type: NodeConnectionType.AiLanguageModel,
+ required: true,
+ },
+ ],
+ outputs: [NodeConnectionType.Main],
+ properties: [
+ {
+ displayName: 'Text',
+ name: 'text',
+ type: 'string',
+ default: '',
+ description: 'The text to extract information from',
+ typeOptions: {
+ rows: 2,
+ },
+ },
+ {
+ ...schemaTypeField,
+ description: 'How to specify the schema for the desired output',
+ options: [
+ {
+ name: 'From Attribute Descriptions',
+ value: 'fromAttributes',
+ description:
+ 'Extract specific attributes from the text based on types and descriptions',
+ } as INodePropertyOptions,
+ ...(schemaTypeField.options as INodePropertyOptions[]),
+ ],
+ default: 'fromAttributes',
+ },
+ {
+ ...jsonSchemaExampleField,
+ default: `{
+ "state": "California",
+ "cities": ["Los Angeles", "San Francisco", "San Diego"]
+}`,
+ },
+ {
+ ...inputSchemaField,
+ default: `{
+ "type": "object",
+ "properties": {
+ "state": {
+ "type": "string"
+ },
+ "cities": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+}`,
+ },
+ {
+ displayName:
+ 'The schema has to be defined in the JSON Schema format. Look at this page for examples.',
+ name: 'notice',
+ type: 'notice',
+ default: '',
+ displayOptions: {
+ show: {
+ schemaType: ['manual'],
+ },
+ },
+ },
+ {
+ displayName: 'Attributes',
+ name: 'attributes',
+ placeholder: 'Add Attribute',
+ type: 'fixedCollection',
+ default: {},
+ displayOptions: {
+ show: {
+ schemaType: ['fromAttributes'],
+ },
+ },
+ typeOptions: {
+ multipleValues: true,
+ },
+ options: [
+ {
+ name: 'attributes',
+ displayName: 'Attribute List',
+ values: [
+ {
+ displayName: 'Name',
+ name: 'name',
+ type: 'string',
+ default: '',
+ description: 'Attribute to extract',
+ placeholder: 'e.g. company_name',
+ required: true,
+ },
+ {
+ displayName: 'Type',
+ name: 'type',
+ type: 'options',
+ description: 'Data type of the attribute',
+ required: true,
+ options: [
+ {
+ name: 'Boolean',
+ value: 'boolean',
+ },
+ {
+ name: 'Date',
+ value: 'date',
+ },
+ {
+ name: 'Number',
+ value: 'number',
+ },
+ {
+ name: 'String',
+ value: 'string',
+ },
+ ],
+ default: 'string',
+ },
+ {
+ displayName: 'Description',
+ name: 'description',
+ type: 'string',
+ default: '',
+ description: 'Describe your attribute',
+ placeholder: 'Add description for the attribute',
+ required: true,
+ },
+ {
+ displayName: 'Required',
+ name: 'required',
+ type: 'boolean',
+ default: false,
+ description: 'Whether attribute is required',
+ required: true,
+ },
+ ],
+ },
+ ],
+ },
+ {
+ displayName: 'Options',
+ name: 'options',
+ type: 'collection',
+ default: {},
+ placeholder: 'Add Option',
+ options: [
+ {
+ displayName: 'System Prompt Template',
+ name: 'systemPromptTemplate',
+ type: 'string',
+ default: SYSTEM_PROMPT_TEMPLATE,
+ description: 'String to use directly as the system prompt template',
+ typeOptions: {
+ rows: 6,
+ },
+ },
+ ],
+ },
+ ],
+ };
+
+ async execute(this: IExecuteFunctions): Promise {
+ const items = this.getInputData();
+
+ const llm = (await this.getInputConnectionData(
+ NodeConnectionType.AiLanguageModel,
+ 0,
+ )) as BaseLanguageModel;
+
+ const schemaType = this.getNodeParameter('schemaType', 0, '') as
+ | 'fromAttributes'
+ | 'fromJson'
+ | 'manual';
+
+ let parser: OutputFixingParser