
Node Details
- Name: customDocumentLoader
- Type: Document
- Version: 1.0
- Category: Document Loaders
Input Parameters
-
Input Variables (optional)
- Type: JSON
- Description: Input variables that can be used in the function with a ‘var)
- Accepts variables and lists
-
Javascript Function
- Type: Code
- Description: A JavaScript function that must return either:
- An array of document objects (each containing
pageContent
andmetadata
) if “Document” output is selected - A string if “Text” output is selected
- An array of document objects (each containing
Output
Output
The node provides two possible output types:-
Document
- Description: Array of document objects containing metadata and pageContent
- Base Classes: Document, json
-
Document
- Description: Array of document objects containing metadata and pageContent
- Base Classes: Document, json
-
Text
- Description: Concatenated string from pageContent of documents
- Base Classes: string, json
-
Text
- Description: Concatenated string from pageContent of documents
- Base Classes: string, json
Functionality
Functionality
The Custom Document Loader node allows users to write custom JavaScript code to load and process documents or text. It provides a sandboxed environment with access to various built-in and external dependencies, as well as input variables and flow information. Key features:- Supports both document object arrays and plain text output
- Provides access to input variables, chat flow information, and custom variables
- Runs the custom code in a secure sandbox environment
- Allows for complex document loading and processing logic
Use Cases
- Integrating custom data sources
- Implementing complex document processing logic
- Generating dynamic document content within a chatflow
- Creating custom document loading workflows
- Supports both document object arrays and plain text output
- Provides access to input variables, chat flow information, and custom variables
- Runs the custom code in a secure sandbox environment
- Allows for complex document loading and processing logic
Use Cases
- Integrating custom data sources
- Implementing complex document processing logic
- Generating dynamic document content within a chatflow
- Creating custom document loading workflows
Usage
- Configure any necessary input variables
- Write a JavaScript function that loads and/or processes documents or text
- Choose the appropriate output type (Document or Text)
- Use the node in your chatflow to dynamically load or generate document content