Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Ucbepic Docetl Programmatic Optimization

From Leeroopedia


Knowledge Sources
Domains Optimization, API_Design
Last Updated 2026-02-08 01:40 GMT

Overview

A programmatic optimization principle that enables automated pipeline rewriting through the Python API, returning an optimized Pipeline object.

Description

Programmatic Optimization exposes DocETL's pipeline optimizer through the Python API's Pipeline.optimize() method. This enables embedding optimization in automated workflows, notebooks, and application code without requiring CLI invocation. The method internally delegates to the V1 Optimizer and returns a new Pipeline instance with optimized operation configurations.

Usage

Use Pipeline.optimize() when you want to programmatically optimize a pipeline. Operations must be marked with optimize=True to be eligible for rewriting.

Theoretical Basis

API-driven optimization:

  1. Pipeline Construction: Build pipeline with optimize-flagged operations
  2. Delegation: Pipeline.optimize() creates DSLRunner and invokes Optimizer
  3. Rewriting: Optimizer rewrites eligible operations for better accuracy/cost
  4. Return: New Pipeline object with optimized configurations

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment