Using user-defined functions
Using user-defined functions
Extend flows with custom Python user-defined functions (UDFs). Learn to use map and reduce processing functions, lifecycle hooks, reusable functions, and shared packages.
Creating UDFs
Create a UDF module from the modules panel, generate the scripts folder, and edit scripts.py in the built-in editor. This overview covers how UDFs register into the flow and the main UDF types you’ll use in later videos.
Map & reduce UDFs
-
Map UDFs — Process one document at a time in parallel for throughput. Each call receives an
input_recordwith metadata, content, and output naming. -
Reduce UDFs — Aggregate outputs across preceding files into consolidated batch results.
Pre-flow & post-flow UDFs
This tutorial shows how to use lifecycle hooks to run Python code at the start and end of a flow. It covers using pre-flow hooks to prepare inputs, post-flow hooks to export verified results, and platform decorators to register hooks for use in the flow editor.
Reusable functions
This tutorial shows how to work with document and platform libraries inside UDFs. It covers loading OCR documents, reading and modifying text, records, layouts, metadata, and fields, registering reusable functions, and using tools for logging, file operations, and runtime configuration. It also explains how available tools differ between map UDFs and Refiner modules.
Using Marketplace
This video shows how to package helper functions for reuse across projects. It covers defining package.json metadata, publishing the package to the catalog, and using it as shared steps or libraries in other projects.
