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:Princeton nlp Tree of thought llm Task Registration

From Leeroopedia
Knowledge Sources
Domains Software_Design, CLI_Design
Last Updated 2026-02-14 03:30 GMT

Overview

The process of making a new task available in the framework by adding it to the factory function and the CLI argument parser's valid choices.

Description

Task Registration bridges the gap between implementing a new task class and making it available for experiments. In the Tree of Thoughts framework, this involves two coordinated updates:

  1. Factory registration: Adding an elif branch to the get_task() function in src/tot/tasks/__init__.py that maps the new task name string to its constructor.
  2. CLI registration: Adding the new task name to the choices list in the argparse definition in run.py, so the CLI validates it as a valid input.

Without both registrations, a new task class exists in the codebase but cannot be selected for experiments.

Usage

Use this principle as the final integration step when adding a new benchmark task. It must be done after the task class and prompt templates are implemented, but before running validation experiments.

Theoretical Basis

The registration follows a simple factory + CLI validation pattern:

# Abstract: two-site registration
# Site 1: Factory function
def get_task(name):
    if name == 'existing_task':
        return ExistingTask()
    elif name == 'new_task':          # ADD THIS
        return NewTask()              # ADD THIS
    else:
        raise NotImplementedError

# Site 2: CLI argument parser
parser.add_argument('--task', choices=[
    'existing_task',
    'new_task',                       # ADD THIS
])

The two-site pattern is a trade-off: it requires updating two files when adding a task, but it provides clear CLI validation and keeps imports lazy (only the selected task's dependencies are loaded).

Related Pages

Implemented By

Page Connections

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