diff --git a/cli/decompose/decompose.py b/cli/decompose/decompose.py index 4e3f0112f..a7d35e834 100644 --- a/cli/decompose/decompose.py +++ b/cli/decompose/decompose.py @@ -1,3 +1,4 @@ +# decompose/decompose.py """Implementation of the ``m decompose run`` CLI command. Accepts a task prompt (from a text file or interactive input), calls the multi-step @@ -10,32 +11,36 @@ import json import keyword import re +import shutil from enum import StrEnum from graphlib import TopologicalSorter from pathlib import Path from typing import Annotated import typer +from jinja2 import Environment, FileSystemLoader +from . import pipeline +from .logging import LogMode, configure_logging, get_logger, log_section from .pipeline import DecompBackend, DecompPipelineResult, DecompSubtasksResult +from .utils import validate_filename -# Must maintain declaration order -# Newer versions must be declared on the bottom class DecompVersion(StrEnum): """Available versions of the decomposition pipeline template. Newer versions must be declared last to ensure ``latest`` always resolves to the most recent template. - Attributes: + Args: latest (str): Sentinel value that resolves to the last declared version. v1 (str): Version 1 of the decomposition pipeline template. """ latest = "latest" v1 = "v1" - # v2 = "v2" + v2 = "v2" + # v3 = "v3" this_file_dir = Path(__file__).resolve().parent @@ -44,52 +49,27 @@ class DecompVersion(StrEnum): def reorder_subtasks( subtasks: list[DecompSubtasksResult], ) -> list[DecompSubtasksResult]: - """Reorder subtasks based on their dependencies using topological sort. - - Uses Python's graphlib.TopologicalSorter to perform a topological sort of - subtasks based on their depends_on relationships. Also renumbers the subtask - descriptions if they start with a number pattern (e.g., "1. ", "2. "). - - Args: - subtasks: List of subtask dictionaries with 'tag' and 'depends_on' fields - - Returns: - Reordered list of subtasks where all dependencies appear before dependents, - with subtask descriptions renumbered to match the new order - - Raises: - ValueError: If a circular dependency is detected - """ - # Build dependency graph subtask_map = {subtask["tag"].lower(): subtask for subtask in subtasks} - # Build graph for TopologicalSorter - # Format: {node: {dependencies}} graph = {} for tag, subtask in subtask_map.items(): deps = subtask.get("depends_on", []) - # Filter to only include dependencies that exist in subtask_map valid_deps = {dep.lower() for dep in deps if dep.lower() in subtask_map} graph[tag] = valid_deps - # Perform topological sort try: ts = TopologicalSorter(graph) sorted_tags = list(ts.static_order()) except ValueError as e: - # TopologicalSorter raises ValueError for circular dependencies raise ValueError( "Circular dependency detected in subtasks. Cannot automatically reorder." ) from e - # Get reordered subtasks reordered = [subtask_map[tag] for tag in sorted_tags] - # Renumber subtask descriptions if they start with "N. " pattern number_pattern = re.compile(r"^\d+\.\s+") for i, subtask in enumerate(reordered, start=1): if number_pattern.match(subtask["subtask"]): - # Replace the number at the start with the new position subtask["subtask"] = number_pattern.sub(f"{i}. ", subtask["subtask"]) return reordered @@ -98,39 +78,15 @@ def reorder_subtasks( def verify_user_variables( decomp_data: DecompPipelineResult, input_var: list[str] | None ) -> DecompPipelineResult: - """Verify and fix user variable ordering in subtasks. - - Validates that: - 1. All input_vars_required exist in the provided input_var list - 2. All depends_on variables reference existing subtasks - 3. Subtasks are ordered so dependencies appear before dependents - - If dependencies are out of order, automatically reorders them using topological sort. - - Args: - decomp_data: The decomposition pipeline result containing subtasks - input_var: List of user-provided input variable names - - Returns: - The decomp_data with potentially reordered subtasks - - Raises: - ValueError: If a required input variable is missing or dependencies are invalid - """ if input_var is None: input_var = [] - # Normalize input variables to lowercase for comparison available_input_vars = {var.lower() for var in input_var} - - # Build set of all subtask tags all_subtask_tags = {subtask["tag"].lower() for subtask in decomp_data["subtasks"]} - # Validate that all required variables exist for subtask in decomp_data["subtasks"]: subtask_tag = subtask["tag"].lower() - # Check input_vars_required exist in provided input variables for required_var in subtask.get("input_vars_required", []): var_lower = required_var.lower() if var_lower not in available_input_vars: @@ -140,7 +96,6 @@ def verify_user_variables( f"Available input variables: {sorted(available_input_vars) if available_input_vars else 'none'}" ) - # Check that all dependencies exist somewhere in the subtasks for dep_var in subtask.get("depends_on", []): dep_lower = dep_var.lower() if dep_lower not in all_subtask_tags: @@ -150,14 +105,12 @@ def verify_user_variables( f"Available subtask tags: {sorted(all_subtask_tags)}" ) - # Check if reordering is needed needs_reordering = False defined_subtask_tags = set() for subtask in decomp_data["subtasks"]: subtask_tag = subtask["tag"].lower() - # Check if any dependency hasn't been defined yet for dep_var in subtask.get("depends_on", []): dep_lower = dep_var.lower() if dep_lower not in defined_subtask_tags: @@ -169,7 +122,6 @@ def verify_user_variables( defined_subtask_tags.add(subtask_tag) - # Reorder if needed if needs_reordering: decomp_data["subtasks"] = reorder_subtasks(decomp_data["subtasks"]) @@ -182,22 +134,18 @@ def run( typer.Option(help="Path to an existing directory to save the output files."), ], out_name: Annotated[ - str, typer.Option(help='Name for the output files. Defaults to "m_result".') + str, + typer.Option(help='Name for the output files. Defaults to "m_decomp_result".'), ] = "m_decomp_result", - prompt_file: Annotated[ - typer.FileText | None, - typer.Option(help="Path to a raw text file containing a task prompt."), + input_file: Annotated[ + str | None, typer.Option(help="Path to a text file containing user queries.") ] = None, model_id: Annotated[ str, typer.Option( help=( - "Model name/id to be used to run the decomposition pipeline." - + ' Defaults to "mistral-small3.2:latest", which is valid for the "ollama" backend.' - + " If you have a vLLM instance serving a model from HF with vLLM's OpenAI" - + " compatible endpoint, then this option should be set to the model's HF name/id," - + ' e.g. "mistralai/Mistral-Small-3.2-24B-Instruct-2506" and the "--backend" option' - + ' should be set to "openai".' + "Model name/id used to run the decomposition pipeline. " + 'Defaults to "mistral-small3.2:latest", valid for the "ollama" backend.' ) ), ] = "mistral-small3.2:latest", @@ -205,11 +153,7 @@ def run( DecompBackend, typer.Option( help=( - 'Backend to be used for inference. Defaults to "ollama".' - + ' Options are: "ollama" and "openai".' - + ' The "ollama" backend runs a local inference server.' - + ' The "openai" backend will send inference requests to any' - + " endpoint that's OpenAI compatible." + 'Backend used for inference. Options: "ollama", "openai", and "rits".' ), case_sensitive=False, ), @@ -217,35 +161,23 @@ def run( backend_req_timeout: Annotated[ int, typer.Option( - help='Time (in seconds) for timeout to be passed on the model inference requests. Defaults to "300"' + help='Timeout in seconds for backend requests. Defaults to "300".' ), ] = 300, backend_endpoint: Annotated[ str | None, typer.Option( - help=( - 'The "endpoint URL", sometimes called "base URL",' - + ' to reach the model when using the "openai" backend.' - + ' This option is required if using "--backend openai".' - ) + help='Backend endpoint / base URL. Required for "openai" and "rits".' ), ] = None, backend_api_key: Annotated[ str | None, - typer.Option( - help=( - 'The API key for the configured "--backend-endpoint".' - + ' If using "--backend openai" this option must be set,' - + " even if you are running locally (an OpenAI compatible server), you" - + ' must set this option, it can be set to "EMPTY" if your local' - + " server doesn't need it." - ) - ), + typer.Option(help='Backend API key. Required for "openai" and "rits".'), ] = None, version: Annotated[ DecompVersion, typer.Option( - help=("Version of the mellea program generator template to be used."), + help="Version of the mellea program generator template to use.", case_sensitive=False, ), ] = DecompVersion.latest, @@ -253,55 +185,73 @@ def run( list[str] | None, typer.Option( help=( - "If your task needs user input data, you must pass" - + " a descriptive variable name using this option, this way" - + " the variable names can be templated into the generated prompts." - + " You can pass this option multiple times, one for each input variable name." - + " These names must be all uppercase, alphanumeric, with words separated by underscores." + "Optional user input variable names. " + "You may pass this option multiple times. " + "Each value must be a valid Python identifier." ) ), ] = None, + log_mode: Annotated[ + LogMode, + typer.Option( + help='Readable logging mode. Options: "demo" or "debug".', + case_sensitive=False, + ), + ] = LogMode.demo, ) -> None: - """Decompose a task prompt into subtasks with constraints and dependency metadata. + """Decompose one or more user queries into subtasks with constraints and dependency metadata. - Reads the task prompt either from a file or interactively, runs the LLM + Reads user queries either from a file or interactively, runs the LLM decomposition pipeline to produce subtask descriptions, Jinja2 prompt templates, - constraint lists, and dependency metadata, validates variable ordering, then - writes a ``{out_name}.json`` result file and a rendered ``{out_name}.py`` - Python script to the output directory. + constraint lists, and dependency metadata, and writes one ``.json`` result file + plus one rendered ``.py`` script per task job to the output directory. + + If ``input_file`` contains multiple non-empty lines, each line is treated as a + separate task job. Args: out_dir: Path to an existing directory where output files are saved. out_name: Base name (no extension) for the output files. Defaults to ``"m_decomp_result"``. - prompt_file: Optional path to a raw-text file containing the task prompt. - If omitted, the prompt is collected interactively. + input_file: Optional path to a text file containing one or more user + queries. If the file contains multiple non-empty lines, each line is + treated as a separate task job. If omitted, the query is collected + interactively. model_id: Model name or ID used for all decomposition pipeline steps. - backend: Inference backend -- ``"ollama"`` or ``"openai"``. + backend: Inference backend -- ``"ollama"``, ``"openai"``, or ``"rits"``. backend_req_timeout: Request timeout in seconds for model inference calls. - backend_endpoint: Base URL of the OpenAI-compatible endpoint. Required - when ``backend="openai"``. + backend_endpoint: Base URL of the configured endpoint. Required when + ``backend="openai"`` or ``backend="rits"``. backend_api_key: API key for the configured endpoint. Required when - ``backend="openai"``. + ``backend="openai"`` or ``backend="rits"``. version: Version of the decomposition pipeline template to use. input_var: Optional list of user-input variable names (e.g. ``"DOC"``). Each name must be a valid Python identifier. Pass this option multiple times to define multiple variables. + log_mode: Logging detail mode for CLI and pipeline output. Raises: AssertionError: If ``out_name`` contains invalid characters, if ``out_dir`` does not exist or is not a directory, or if any ``input_var`` name is not a valid Python identifier. - ValueError: If a required input variable is missing from ``input_var`` - or if circular dependencies are detected among subtasks. + ValueError: If the input file contains no non-empty task lines. Exception: Re-raised from the decomposition pipeline after cleaning up - any partially written output files. + any partially written output directories. """ - try: - from jinja2 import Environment, FileSystemLoader + created_dirs: list[Path] = [] - from . import pipeline - from .utils import validate_filename + try: + configure_logging(log_mode) + logger = get_logger("m_decompose.cli") + + log_section(logger, "m_decompose cli") + logger.info("out_dir : %s", out_dir) + logger.info("out_name : %s", out_name) + logger.info("backend : %s", backend.value) + logger.info("model_id : %s", model_id) + logger.info("version : %s", version.value) + logger.info("log_mode : %s", log_mode.value) + logger.info("input_vars : %s", input_var or "[]") environment = Environment( loader=FileSystemLoader(this_file_dir), autoescape=False @@ -312,6 +262,8 @@ def run( if version == DecompVersion.latest else version.value ) + logger.info("resolved version: %s", ver) + m_template = environment.get_template(f"m_decomp_result_{ver}.py.jinja2") out_name = out_name.strip() @@ -327,21 +279,30 @@ def run( assert all( var.isidentifier() and not keyword.iskeyword(var) for var in input_var ), ( - 'One or more of the "input-var" are not valid. The input variables\' names must be a valid Python identifier' + 'One or more of the "input-var" are not valid. ' + "Each input variable name must be a valid Python identifier." ) - if prompt_file: - decomp_data = pipeline.decompose( - task_prompt=prompt_file.read(), - user_input_variable=input_var, - model_id=model_id, - backend=backend, - backend_req_timeout=backend_req_timeout, - backend_endpoint=backend_endpoint, - backend_api_key=backend_api_key, + log_section(logger, "load task prompt") + + if input_file: + input_path = Path(input_file) + assert input_path.exists() and input_path.is_file(), ( + f'Path passed in "input-file" is not a file: {input_path.as_posix()}' ) + + raw_lines = input_path.read_text(encoding="utf-8").splitlines() + task_jobs = [line.strip() for line in raw_lines if line.strip()] + user_input_variable = input_var + + logger.info("prompt source : file") + logger.info("input_file : %s", input_path) + logger.info("task jobs : %d", len(task_jobs)) + + if not task_jobs: + raise ValueError("Input file contains no non-empty task lines.") else: - task_prompt: str = typer.prompt( + task_prompt = typer.prompt( ( "\nThis mode doesn't support tasks that need input data." + '\nInput must be provided in a single line. Use "\\n" for new lines.' @@ -350,37 +311,75 @@ def run( type=str, ) task_prompt = task_prompt.replace("\\n", "\n") + task_jobs = [task_prompt] + user_input_variable = None + + logger.info("prompt source : interactive") + logger.info("task jobs : 1") + + for job_idx, task_prompt in enumerate(task_jobs, start=1): + job_out_name = out_name if len(task_jobs) == 1 else f"{out_name}_{job_idx}" + + log_section(logger, f"run pipeline job {job_idx}/{len(task_jobs)}") + logger.info("job out_name : %s", job_out_name) + logger.info("prompt length : %d", len(task_prompt)) + logger.info("task prompt : %s", task_prompt) + decomp_data = pipeline.decompose( task_prompt=task_prompt, - user_input_variable=None, + user_input_variable=user_input_variable, model_id=model_id, backend=backend, backend_req_timeout=backend_req_timeout, backend_endpoint=backend_endpoint, backend_api_key=backend_api_key, + log_mode=log_mode, ) - # Verify that all user variables are properly defined before use - # This may reorder subtasks if dependencies are out of order - decomp_data = verify_user_variables(decomp_data, input_var) + # TODO: verify_user_variables + # logger.info("verify_user_variables: skipped") + + log_section(logger, f"write outputs job {job_idx}/{len(task_jobs)}") + + decomp_dir = out_dir / job_out_name + val_fn_dir = decomp_dir / "validations" + + logger.info("creating output dir: %s", decomp_dir) + decomp_dir.mkdir(parents=True, exist_ok=False) + created_dirs.append(decomp_dir) - with open(out_dir / f"{out_name}.json", "w") as f: - json.dump(decomp_data, f, indent=2) + val_fn_dir.mkdir(exist_ok=True) + (val_fn_dir / "__init__.py").touch() - with open(out_dir / f"{out_name}.py", "w") as f: - f.write( - m_template.render( - subtasks=decomp_data["subtasks"], user_inputs=input_var + val_fn_count = 0 + for constraint in decomp_data["identified_constraints"]: + if constraint["val_fn"] is not None: + val_fn_count += 1 + with open(val_fn_dir / f"{constraint['val_fn_name']}.py", "w") as f: + f.write(constraint["val_fn"] + "\n") + + with open(decomp_dir / f"{job_out_name}.json", "w") as f: + json.dump(decomp_data, f, indent=2) + + with open(decomp_dir / f"{job_out_name}.py", "w") as f: + f.write( + m_template.render( + subtasks=decomp_data["subtasks"], + user_inputs=input_var, + identified_constraints=decomp_data["identified_constraints"], + ) + + "\n" ) - + "\n" - ) - except Exception: - created_json = Path(out_dir / f"{out_name}.json") - created_py = Path(out_dir / f"{out_name}.py") - if created_json.exists() and created_json.is_file(): - created_json.unlink() - if created_py.exists() and created_py.is_file(): - created_py.unlink() + logger.info("json written : %s", decomp_dir / f"{job_out_name}.json") + logger.info("program written : %s", decomp_dir / f"{job_out_name}.py") + logger.info("validation files: %d", val_fn_count) + + logger.info("") + logger.info("m_decompose CLI completed successfully") - raise Exception + except Exception: + for decomp_dir in reversed(created_dirs): + if decomp_dir.exists() and decomp_dir.is_dir(): + shutil.rmtree(decomp_dir) + raise diff --git a/cli/decompose/logging.py b/cli/decompose/logging.py new file mode 100644 index 000000000..4f32440cb --- /dev/null +++ b/cli/decompose/logging.py @@ -0,0 +1,44 @@ +import logging +import sys +from enum import StrEnum + + +class LogMode(StrEnum): + demo = "demo" + debug = "debug" + + +_CONFIGURED = False + + +def configure_logging(log_mode: LogMode = LogMode.demo) -> None: + global _CONFIGURED + + level = logging.DEBUG if log_mode == LogMode.debug else logging.INFO + + root_logger = logging.getLogger() + + if not _CONFIGURED: + handler = logging.StreamHandler(sys.stdout) + handler.setFormatter( + logging.Formatter("[%(levelname)s] %(name)s | %(message)s") + ) + root_logger.handlers.clear() + root_logger.addHandler(handler) + _CONFIGURED = True + + root_logger.setLevel(level) + + logging.getLogger("m_decompose").setLevel(level) + logging.getLogger("mellea").setLevel(level) + + +def get_logger(name: str) -> logging.Logger: + return logging.getLogger(name) + + +def log_section(logger: logging.Logger, title: str) -> None: + logger.info("") + logger.info("=" * 72) + logger.info(title) + logger.info("=" * 72) diff --git a/cli/decompose/m_decomp_result_v1.py.jinja2 b/cli/decompose/m_decomp_result_v1.py.jinja2 index 7aa1d54f4..1f1e3646e 100644 --- a/cli/decompose/m_decomp_result_v1.py.jinja2 +++ b/cli/decompose/m_decomp_result_v1.py.jinja2 @@ -4,6 +4,14 @@ import os import textwrap import mellea +{%- if "code" in identified_constraints | map(attribute="val_strategy") %} +from mellea.stdlib.requirement import req +{% for c in identified_constraints %} +{%- if c.val_fn %} +from validations.{{ c.val_fn_name }} import validate_input as {{ c.val_fn_name }} +{%- endif %} +{%- endfor %} +{%- endif %} m = mellea.start_session() {%- if user_inputs %} @@ -30,7 +38,14 @@ except KeyError as e: {%- if item.constraints %} requirements=[ {%- for c in item.constraints %} + {%- if c.val_fn %} + req( + {{ c.constraint | tojson}}, + validation_fn={{ c.val_fn_name }}, + ), + {%- else %} {{ c.constraint | tojson}}, + {%- endif %} {%- endfor %} ], {%- else %} diff --git a/cli/decompose/m_decomp_result_v2.py.jinja2 b/cli/decompose/m_decomp_result_v2.py.jinja2 new file mode 100644 index 000000000..9b1bb13c6 --- /dev/null +++ b/cli/decompose/m_decomp_result_v2.py.jinja2 @@ -0,0 +1,91 @@ +{% if user_inputs -%} +import os +{% endif -%} +import textwrap + +import mellea +{%- if "code" in identified_constraints | map(attribute="val_strategy") %} +from mellea.stdlib.requirement import req +{% for c in identified_constraints %} +{%- if c.val_fn %} +from validations.{{ c.val_fn_name }} import validate_input as {{ c.val_fn_name }} +{%- endif %} +{%- endfor %} +{%- endif %} + +m = mellea.start_session() +{%- if user_inputs %} + + +# User Input Variables +try: + {%- for var in user_inputs %} + {{ var | lower }} = os.environ["{{ var | upper }}"] + {%- endfor %} +except KeyError as e: + print(f"ERROR: One or more required environment variables are not set; {e}") + exit(1) +{%- endif %} +{%- for item in subtasks %} + + +{{ item.tag | lower }}_gnrl = textwrap.dedent( + R""" + {{ item.general_instructions | trim | indent(width=4, first=False) }} + """.strip() +) +{{ item.tag | lower }} = m.instruct( + {%- if not item.input_vars_required %} + {{ item.subtask[3:] | trim | tojson }}, + {%- else %} + textwrap.dedent( + R""" + {{ item.subtask[3:] | trim }} + + Here are the input variables and their content: + {%- for var in item.input_vars_required %} + + - {{ var | upper }} = {{ "{{" }}{{ var | upper }}{{ "}}" }} + {%- endfor %} + """.strip() + ), + {%- endif %} + {%- if item.constraints %} + requirements=[ + {%- for c in item.constraints %} + {%- if c.val_fn %} + req( + {{ c.constraint | tojson}}, + validation_fn={{ c.val_fn_name }}, + ), + {%- else %} + {{ c.constraint | tojson}}, + {%- endif %} + {%- endfor %} + ], + {%- else %} + requirements=None, + {%- endif %} + {%- if item.input_vars_required %} + user_variables={ + {%- for var in item.input_vars_required %} + {{ var | upper | tojson }}: {{ var | lower }}, + {%- endfor %} + }, + {%- endif %} + grounding_context={ + "GENERAL_INSTRUCTIONS": {{ item.tag | lower }}_gnrl, + {%- for var in item.depends_on %} + {{ var | upper | tojson }}: {{ var | lower }}.value, + {%- endfor %} + }, +) +assert {{ item.tag | lower }}.value is not None, 'ERROR: task "{{ item.tag | lower }}" execution failed' +{%- if loop.last %} + + +final_answer = {{ item.tag | lower }}.value + +print(final_answer) +{%- endif -%} +{%- endfor -%} diff --git a/cli/decompose/pipeline.py b/cli/decompose/pipeline.py index 452e16a5b..91fa8abfb 100644 --- a/cli/decompose/pipeline.py +++ b/cli/decompose/pipeline.py @@ -1,3 +1,4 @@ +# decompose/pipeline.py """Core decomposition pipeline that breaks a task prompt into structured subtasks. Provides the ``decompose()`` function, which orchestrates a series of LLM calls @@ -16,12 +17,14 @@ from mellea.backends.ollama import OllamaModelBackend from mellea.backends.openai import OpenAIBackend +from .logging import LogMode, configure_logging, get_logger, log_section from .prompt_modules import ( constraint_extractor, - # general_instructions, + general_instructions, subtask_constraint_assign, subtask_list, subtask_prompt_generator, + validation_code_generator, validation_decision, ) from .prompt_modules.subtask_constraint_assign import SubtaskPromptConstraintsItem @@ -29,23 +32,30 @@ from .prompt_modules.subtask_prompt_generator import SubtaskPromptItem +class ConstraintValData(TypedDict): + val_strategy: Literal["code", "llm"] + val_fn: str | None + + class ConstraintResult(TypedDict): """A single constraint paired with its assigned validation strategy. - Attributes: + Args: constraint (str): Natural-language description of the constraint. validation_strategy (str): Strategy assigned to validate the constraint; either ``"code"`` or ``"llm"``. """ constraint: str - validation_strategy: str + val_strategy: Literal["code", "llm"] + val_fn: str | None + val_fn_name: str class DecompSubtasksResult(TypedDict): """The full structured result for one decomposed subtask. - Attributes: + Args: subtask (str): Natural-language description of the subtask. tag (str): Short identifier for the subtask, used as a variable name in Jinja2 templates and dependency references. @@ -65,7 +75,7 @@ class DecompSubtasksResult(TypedDict): tag: str constraints: list[ConstraintResult] prompt_template: str - # general_instructions: str + general_instructions: str input_vars_required: list[str] depends_on: list[str] generated_response: NotRequired[str] @@ -97,7 +107,7 @@ class DecompPipelineResult(TypedDict): class DecompBackend(StrEnum): """Inference backends supported by the decomposition pipeline. - Attributes: + Args: ollama (str): Local Ollama inference server backend. openai (str): Any OpenAI-compatible HTTP endpoint backend. rits (str): IBM RITS (Remote Inference and Training Service) backend. @@ -111,51 +121,52 @@ class DecompBackend(StrEnum): RE_JINJA_VAR = re.compile(r"\{\{\s*(.*?)\s*\}\}") -def decompose( - task_prompt: str, - user_input_variable: list[str] | None = None, +def _dedupe_keep_order(items: list[str]) -> list[str]: + return list(dict.fromkeys(items)) + + +def _extract_jinja_vars(prompt_template: str) -> list[str]: + return re.findall(RE_JINJA_VAR, prompt_template) + + +def _preview_text(text: str, max_len: int = 240) -> str: + text = " ".join(text.strip().split()) + if len(text) <= max_len: + return text + return text[:max_len] + " ..." + + +# ------------------------------------------------------------------- +# backend +# ------------------------------------------------------------------- +def build_backend_session( model_id: str = "mistral-small3.2:latest", backend: DecompBackend = DecompBackend.ollama, backend_req_timeout: int = 300, backend_endpoint: str | None = None, backend_api_key: str | None = None, -) -> DecompPipelineResult: - """Break a task prompt into structured subtasks using a multi-step LLM pipeline. - - Orchestrates a series of sequential LLM calls to produce a fully structured - decomposition: subtask listing, constraint extraction, validation strategy - selection, prompt template generation, and per-subtask constraint assignment. - The number of calls depends on the number of constraints extracted. + log_mode: LogMode = LogMode.demo, +) -> MelleaSession: + logger = get_logger("m_decompose.backend") + log_section(logger, "backend") - Args: - task_prompt: Natural-language description of the task to decompose. - user_input_variable: Optional list of variable names that will be - templated into generated prompts as user-provided input data. Pass - ``None`` or an empty list if the task requires no input variables. - model_id: Model name or ID used for all pipeline steps. - backend: Inference backend -- ``"ollama"``, ``"openai"``, or ``"rits"``. - backend_req_timeout: Request timeout in seconds for model inference calls. - backend_endpoint: Base URL of the OpenAI-compatible endpoint. Required - when ``backend`` is ``"openai"`` or ``"rits"``. - backend_api_key: API key for the configured endpoint. Required when - ``backend`` is ``"openai"`` or ``"rits"``. + logger.info("backend : %s", backend.value) + logger.info("model_id : %s", model_id) + logger.info("timeout : %s", backend_req_timeout) + if backend_endpoint: + logger.info("endpoint : %s", backend_endpoint) - Returns: - A ``DecompPipelineResult`` containing the original prompt, subtask list, - identified constraints, and fully annotated subtask objects with prompt - templates, constraint assignments, and dependency information. - """ - if user_input_variable is None: - user_input_variable = [] - - # region Backend Assignment match backend: case DecompBackend.ollama: - m_session = MelleaSession( + logger.info("initializing Ollama backend") + session = MelleaSession( OllamaModelBackend( - model_id=model_id, model_options={ModelOption.CONTEXT_WINDOW: 16384} + model_id=model_id, + base_url=backend_endpoint, + model_options={ModelOption.CONTEXT_WINDOW: 16384}, ) ) + case DecompBackend.openai: assert backend_endpoint is not None, ( 'Required to provide "backend_endpoint" for this configuration' @@ -163,7 +174,9 @@ def decompose( assert backend_api_key is not None, ( 'Required to provide "backend_api_key" for this configuration' ) - m_session = MelleaSession( + + logger.info("initializing OpenAI-compatible backend") + session = MelleaSession( OpenAIBackend( model_id=model_id, base_url=backend_endpoint, @@ -171,6 +184,7 @@ def decompose( model_options={"timeout": backend_req_timeout}, ) ) + case DecompBackend.rits: assert backend_endpoint is not None, ( 'Required to provide "backend_endpoint" for this configuration' @@ -179,28 +193,98 @@ def decompose( 'Required to provide "backend_api_key" for this configuration' ) + logger.info("initializing RITS backend") from mellea_ibm.rits import RITSBackend, RITSModelIdentifier # type: ignore - m_session = MelleaSession( + session = MelleaSession( RITSBackend( RITSModelIdentifier(endpoint=backend_endpoint, model_name=model_id), api_key=backend_api_key, model_options={"timeout": backend_req_timeout}, ) ) - # endregion + logger.info("backend session ready") + return session + + +# ------------------------------------------------------------------- +# task_decompose +# ------------------------------------------------------------------- +def task_decompose( + m_session: MelleaSession, task_prompt: str, log_mode: LogMode = LogMode.demo +) -> tuple[list[SubtaskItem], list[str]]: + logger = get_logger("m_decompose.task_decompose") + log_section(logger, "task_decompose") + + logger.info("generating subtask list") subtasks: list[SubtaskItem] = subtask_list.generate(m_session, task_prompt).parse() - task_prompt_constraints: list[str] = constraint_extractor.generate( + logger.info("subtasks found: %d", len(subtasks)) + for i, item in enumerate(subtasks, start=1): + logger.info(" [%02d] tag=%s | subtask=%s", i, item.tag, item.subtask) + + logger.info("extracting task constraints") + task_constraints: list[str] = constraint_extractor.generate( m_session, task_prompt, enforce_same_words=False ).parse() - constraint_validation_strategies: dict[str, Literal["code", "llm"]] = { - cons_key: validation_decision.generate(m_session, cons_key).parse() or "llm" - for cons_key in task_prompt_constraints - } + logger.info("constraints found: %d", len(task_constraints)) + for i, cons in enumerate(task_constraints, start=1): + logger.info(" [%02d] %s", i, cons) + + return subtasks, task_constraints + + +# ------------------------------------------------------------------- +# constraint_validate +# ------------------------------------------------------------------- +def constraint_validate( + m_session: MelleaSession, + task_constraints: list[str], + log_mode: LogMode = LogMode.demo, +) -> dict[str, ConstraintValData]: + logger = get_logger("m_decompose.constraint_validate") + log_section(logger, "constraint_validate") + + constraint_val_data: dict[str, ConstraintValData] = {} + + for idx, cons_key in enumerate(task_constraints, start=1): + logger.info("constraint [%02d]: %s", idx, cons_key) + + val_strategy: Literal["code", "llm"] = ( + validation_decision.generate(m_session, cons_key).parse() or "llm" + ) + logger.info(" strategy: %s", val_strategy) + val_fn: str | None = None + if val_strategy == "code": + logger.info(" generating validation code") + val_fn = validation_code_generator.generate(m_session, cons_key).parse() + logger.debug(" generated val_fn length: %d", len(val_fn) if val_fn else 0) + else: + logger.info(" validation mode: llm") + + constraint_val_data[cons_key] = {"val_strategy": val_strategy, "val_fn": val_fn} + + return constraint_val_data + + +# ------------------------------------------------------------------- +# task_execute +# ------------------------------------------------------------------- +def task_execute( + m_session: MelleaSession, + task_prompt: str, + user_input_variable: list[str], + subtasks: list[SubtaskItem], + task_constraints: list[str], + log_mode: LogMode = LogMode.demo, +) -> list[SubtaskPromptConstraintsItem]: + logger = get_logger("m_decompose.task_execute") + log_section(logger, "task_execute") + + logger.info("generating prompt templates for subtasks") subtask_prompts: list[SubtaskPromptItem] = subtask_prompt_generator.generate( m_session, task_prompt, @@ -208,66 +292,278 @@ def decompose( subtasks_and_tags=subtasks, ).parse() - subtask_prompts_with_constraints: list[SubtaskPromptConstraintsItem] = ( - subtask_constraint_assign.generate( - m_session, - subtasks_tags_and_prompts=subtask_prompts, - constraint_list=task_prompt_constraints, - ).parse() + logger.info("subtask prompt templates generated: %d", len(subtask_prompts)) + for i, prompt_item in enumerate(subtask_prompts, start=1): + logger.info(" [%02d] tag=%s", i, prompt_item.tag) + if log_mode == LogMode.debug: + logger.debug(" prompt_template=%s", prompt_item.prompt_template) + + subtasks_tags_and_prompts: list[tuple[str, str, str]] = [ + (prompt_item.subtask, prompt_item.tag, prompt_item.prompt_template) + for prompt_item in subtask_prompts + ] + + logger.info("assigning constraints to subtasks") + logger.info(" total subtasks : %d", len(subtasks_tags_and_prompts)) + logger.info(" total constraints: %d", len(task_constraints)) + + if log_mode == LogMode.debug: + for i, (subtask, tag, prompt_template) in enumerate( + subtasks_tags_and_prompts, start=1 + ): + logger.debug( + " subtask_input[%02d]: subtask=%s | tag=%s | prompt=%s", + i, + subtask, + tag, + prompt_template, + ) + for i, cons in enumerate(task_constraints, start=1): + logger.debug(" constraint[%02d]: %s", i, cons) + + retry_count = 2 + last_exc: Exception | None = None + + for attempt in range(1, retry_count + 1): + try: + logger.info( + "subtask_constraint_assign attempt: %d/%d", attempt, retry_count + ) + + subtask_prompts_with_constraints: list[SubtaskPromptConstraintsItem] = ( + subtask_constraint_assign.generate( + m_session, + subtasks_tags_and_prompts=subtasks_tags_and_prompts, + constraint_list=task_constraints, + ).parse() + ) + + if log_mode == LogMode.debug: + logger.debug( + "parsed subtask_constraint_assign result:\n%s", + subtask_prompts_with_constraints, + ) + else: + preview_lines: list[str] = [] + for constraint_item in subtask_prompts_with_constraints[:3]: + preview_lines.append( + f"[{constraint_item.tag}] constraints={len(constraint_item.constraints)}" + ) + if len(subtask_prompts_with_constraints) > 3: + preview_lines.append("...") + preview = "\n".join(preview_lines) + logger.info("parsed subtask_constraint_assign preview:\n%s", preview) + + logger.info( + "constraint assignment completed: %d", + len(subtask_prompts_with_constraints), + ) + for i, constraint_item in enumerate( + subtask_prompts_with_constraints, start=1 + ): + logger.info( + " [%02d] tag=%s | assigned_constraints=%d", + i, + constraint_item.tag, + len(constraint_item.constraints), + ) + if log_mode == LogMode.debug: + for cons in constraint_item.constraints: + logger.debug(" - %s", cons) + + return subtask_prompts_with_constraints + + except Exception as exc: + last_exc = exc + logger.warning( + "subtask_constraint_assign failed on attempt %d/%d: %s", + attempt, + retry_count, + exc, + ) + + logger.error("subtask_constraint_assign failed after %d attempts", retry_count) + raise ( + last_exc + if last_exc is not None + else RuntimeError("subtask_constraint_assign failed with unknown error") ) - decomp_subtask_result: list[DecompSubtasksResult] = [ - DecompSubtasksResult( + +# ------------------------------------------------------------------- +# finalize_result +# ------------------------------------------------------------------- +def finalize_result( + m_session: MelleaSession, + task_prompt: str, + user_input_variable: list[str], + subtasks: list[SubtaskItem], + task_constraints: list[str], + constraint_val_data: dict[str, ConstraintValData], + subtask_prompts_with_constraints: list[SubtaskPromptConstraintsItem], + log_mode: LogMode = LogMode.demo, +) -> DecompPipelineResult: + logger = get_logger("m_decompose.finalize_result") + log_section(logger, "finalize_result") + + decomp_subtask_result: list[DecompSubtasksResult] = [] + + for subtask_i, subtask_data in enumerate(subtask_prompts_with_constraints, start=1): + jinja_vars = _extract_jinja_vars(subtask_data.prompt_template) + + input_vars_required = _dedupe_keep_order( + [var_name for var_name in jinja_vars if var_name in user_input_variable] + ) + depends_on = _dedupe_keep_order( + [var_name for var_name in jinja_vars if var_name not in user_input_variable] + ) + + logger.info("finalizing subtask [%02d] tag=%s", subtask_i, subtask_data.tag) + logger.info(" input_vars_required: %s", input_vars_required or "[]") + logger.info(" depends_on : %s", depends_on or "[]") + + if log_mode == LogMode.debug: + logger.debug(" prompt_template=%s", subtask_data.prompt_template) + + subtask_constraints: list[ConstraintResult] = [ + { + "constraint": cons_str, + "val_strategy": constraint_val_data[cons_str]["val_strategy"], + "val_fn_name": f"val_fn_{task_constraints.index(cons_str) + 1}", + "val_fn": constraint_val_data[cons_str]["val_fn"], + } + for cons_str in subtask_data.constraints + ] + + parsed_general_instructions: str = general_instructions.generate( + m_session, input_str=subtask_data.prompt_template + ).parse() + + if log_mode == LogMode.debug: + logger.debug(" general_instructions=%s", parsed_general_instructions) + + subtask_result: DecompSubtasksResult = DecompSubtasksResult( subtask=subtask_data.subtask, tag=subtask_data.tag, - constraints=[ - { - "constraint": cons_str, - "validation_strategy": constraint_validation_strategies.get( - cons_str, "llm" - ), - } - for cons_str in subtask_data.constraints - ], + constraints=subtask_constraints, prompt_template=subtask_data.prompt_template, - # general_instructions=general_instructions.generate( - # m_session, input_str=subtask_data.prompt_template - # ).parse(), - input_vars_required=list( - dict.fromkeys( # Remove duplicates while preserving the original order. - [ - item - for item in re.findall( - RE_JINJA_VAR, subtask_data.prompt_template - ) - if item in user_input_variable - ] - ) - ), - depends_on=list( - dict.fromkeys( # Remove duplicates while preserving the original order. - [ - item - for item in re.findall( - RE_JINJA_VAR, subtask_data.prompt_template - ) - if item not in user_input_variable - ] - ) - ), + general_instructions=parsed_general_instructions, + input_vars_required=input_vars_required, + depends_on=depends_on, ) - for subtask_data in subtask_prompts_with_constraints - ] - return DecompPipelineResult( + decomp_subtask_result.append(subtask_result) + + result = DecompPipelineResult( original_task_prompt=task_prompt, - subtask_list=[item.subtask for item in subtasks], + subtask_list=[subtask_item.subtask for subtask_item in subtasks], identified_constraints=[ { "constraint": cons_str, - "validation_strategy": constraint_validation_strategies[cons_str], + "val_strategy": constraint_val_data[cons_str]["val_strategy"], + "val_fn": constraint_val_data[cons_str]["val_fn"], + "val_fn_name": f"val_fn_{cons_i + 1}", } - for cons_str in task_prompt_constraints + for cons_i, cons_str in enumerate(task_constraints) ], subtasks=decomp_subtask_result, ) + + logger.info("pipeline result finalized") + logger.info(" total_subtasks : %d", len(result["subtasks"])) + logger.info(" total_constraints: %d", len(result["identified_constraints"])) + logger.info(" verify step : skipped") + + return result + + +# ------------------------------------------------------------------- +# public entry +# ------------------------------------------------------------------- +def decompose( + task_prompt: str, + user_input_variable: list[str] | None = None, + model_id: str = "mistral-small3.2:latest", + backend: DecompBackend = DecompBackend.ollama, + backend_req_timeout: int = 300, + backend_endpoint: str | None = None, + backend_api_key: str | None = None, + log_mode: LogMode = LogMode.demo, +) -> DecompPipelineResult: + """Break a task prompt into structured subtasks using a multi-step LLM pipeline. + + Orchestrates a series of sequential LLM calls to produce a fully structured + decomposition: subtask listing, constraint extraction, validation strategy + selection, prompt template generation, and per-subtask constraint assignment. + The number of calls depends on the number of constraints extracted. + + Args: + task_prompt: Natural-language description of the task to decompose. + user_input_variable: Optional list of variable names that will be + templated into generated prompts as user-provided input data. Pass + ``None`` or an empty list if the task requires no input variables. + model_id: Model name or ID used for all pipeline steps. + backend: Inference backend -- ``"ollama"``, ``"openai"``, or ``"rits"``. + backend_req_timeout: Request timeout in seconds for model inference calls. + backend_endpoint: Base URL of the OpenAI-compatible endpoint. Required + when ``backend`` is ``"openai"`` or ``"rits"``. + backend_api_key: API key for the configured endpoint. Required when + ``backend`` is ``"openai"`` or ``"rits"``. + log_mode: Mode of logging detail to emit during pipeline execution. + + Returns: + A ``DecompPipelineResult`` containing the original prompt, subtask list, + identified constraints, and fully annotated subtask objects with prompt + templates, constraint assignments, and dependency information. + """ + + configure_logging(log_mode) + logger = get_logger("m_decompose.pipeline") + log_section(logger, "m_decompose pipeline") + + if user_input_variable is None: + user_input_variable = [] + + logger.info("log_mode : %s", log_mode.value) + logger.info("user_input_vars: %s", user_input_variable or "[]") + + m_session = build_backend_session( + model_id=model_id, + backend=backend, + backend_req_timeout=backend_req_timeout, + backend_endpoint=backend_endpoint, + backend_api_key=backend_api_key, + log_mode=log_mode, + ) + + subtasks, task_constraints = task_decompose( + m_session=m_session, task_prompt=task_prompt, log_mode=log_mode + ) + + constraint_val_data = constraint_validate( + m_session=m_session, task_constraints=task_constraints, log_mode=log_mode + ) + + subtask_prompts_with_constraints = task_execute( + m_session=m_session, + task_prompt=task_prompt, + user_input_variable=user_input_variable, + subtasks=subtasks, + task_constraints=task_constraints, + log_mode=log_mode, + ) + + result = finalize_result( + m_session=m_session, + task_prompt=task_prompt, + user_input_variable=user_input_variable, + subtasks=subtasks, + task_constraints=task_constraints, + constraint_val_data=constraint_val_data, + subtask_prompts_with_constraints=subtask_prompts_with_constraints, + log_mode=log_mode, + ) + + logger.info("") + logger.info("m_decompose pipeline completed successfully") + return result diff --git a/cli/decompose/prompt_modules/__init__.py b/cli/decompose/prompt_modules/__init__.py index 19b7079e3..922bdcbe8 100644 --- a/cli/decompose/prompt_modules/__init__.py +++ b/cli/decompose/prompt_modules/__init__.py @@ -7,4 +7,7 @@ from .subtask_prompt_generator import ( subtask_prompt_generator as subtask_prompt_generator, ) +from .validation_code_generator import ( + validation_code_generator as validation_code_generator, +) from .validation_decision import validation_decision as validation_decision diff --git a/cli/decompose/prompt_modules/general_instructions/_prompt/system_template.jinja2 b/cli/decompose/prompt_modules/general_instructions/_prompt/system_template.jinja2 index 71a073a25..58047c155 100644 --- a/cli/decompose/prompt_modules/general_instructions/_prompt/system_template.jinja2 +++ b/cli/decompose/prompt_modules/general_instructions/_prompt/system_template.jinja2 @@ -6,6 +6,10 @@ Remove any segment instructing to review or look at some other content, since th Remove mention to specific entities, your general instructions must be generic. Write your generalized version of the instructions inside the tags. +Do not omit the and tags. +Do not write anything before . +Do not write anything between and the final sentence except a newline. + Here are some complete examples to guide you on how to complete your assignment: {% for item in icl_examples -%} diff --git a/cli/decompose/prompt_modules/subtask_constraint_assign/_prompt/system_template.jinja2 b/cli/decompose/prompt_modules/subtask_constraint_assign/_prompt/system_template.jinja2 index 30baaf93a..e5cad42e7 100644 --- a/cli/decompose/prompt_modules/subtask_constraint_assign/_prompt/system_template.jinja2 +++ b/cli/decompose/prompt_modules/subtask_constraint_assign/_prompt/system_template.jinja2 @@ -8,7 +8,7 @@ You will be provided with the following 4 parameters inside their respective tag 4. : A list of candidate (possible) constraints that can be assigned to the target task. -The list contain the constraints of all tasks on the , your job is to filter and select only the constraints belonging to your target task. +The is a list of constraints identified for the entire , your job is to filter and select only the constraints belonging to your target task. It is possible that none of the constraints in the are relevant or related to your target task. Below, enclosed in tags, are instructions to guide you on how to complete your assignment: diff --git a/cli/decompose/prompt_modules/validation_code_generator/__init__.py b/cli/decompose/prompt_modules/validation_code_generator/__init__.py new file mode 100644 index 000000000..dfb4bd0ce --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/__init__.py @@ -0,0 +1,7 @@ +from ._exceptions import ( + BackendGenerationError as BackendGenerationError, + TagExtractionError as TagExtractionError, +) +from ._validation_code_generator import ( + validation_code_generator as validation_code_generator, +) diff --git a/cli/decompose/prompt_modules/validation_code_generator/_exceptions.py b/cli/decompose/prompt_modules/validation_code_generator/_exceptions.py new file mode 100644 index 000000000..a8dad141b --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_exceptions.py @@ -0,0 +1,24 @@ +from typing import Any + + +class ValidationCodeGeneratorError(Exception): + def __init__(self, error_message: str, **kwargs: Any): + self.error_message = error_message + self.__dict__.update(kwargs) + super().__init__( + f'Module Error "validation_code_generator"; {self.error_message}' + ) + + +class BackendGenerationError(ValidationCodeGeneratorError): + """Raised when LLM generation fails in the "validation_code_generator" prompt module.""" + + def __init__(self, error_message: str, **kwargs: Any): + super().__init__(error_message, **kwargs) + + +class TagExtractionError(ValidationCodeGeneratorError): + """Raised when tag extraction fails in the "validation_code_generator" prompt module.""" + + def __init__(self, error_message: str, **kwargs: Any): + super().__init__(error_message, **kwargs) diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/__init__.py b/cli/decompose/prompt_modules/validation_code_generator/_prompt/__init__.py new file mode 100644 index 000000000..0b985cbe6 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/__init__.py @@ -0,0 +1,5 @@ +from ._icl_examples import icl_examples as default_icl_examples +from ._prompt import ( + get_system_prompt as get_system_prompt, + get_user_prompt as get_user_prompt, +) diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/__init__.py b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/__init__.py new file mode 100644 index 000000000..052fe7c99 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/__init__.py @@ -0,0 +1,2 @@ +from ._icl_examples import icl_examples as icl_examples +from ._types import ICLExample as ICLExample diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_1/__init__.py b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_1/__init__.py new file mode 100644 index 000000000..1f9f32ea5 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_1/__init__.py @@ -0,0 +1 @@ +from ._example import example as example diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_1/_example.py b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_1/_example.py new file mode 100644 index 000000000..9bb4e23da --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_1/_example.py @@ -0,0 +1,24 @@ +# ruff: noqa: W293 +from .._types import ICLExample + +constraint_requirement = """You must not use any uppercase letters""" + +validation_function = """def validate_input(input: str) -> bool: + \""" + Validates that the input contains only lowercase letters. + + Args: + input (str): The input to validate + + Returns: + bool: True if all characters are lowercase, False otherwise + \""" + try: + return answer.islower() + except Exception: + return False""" + +example: ICLExample = { + "constraint_requirement": constraint_requirement, + "validation_function": validation_function, +} diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_2/__init__.py b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_2/__init__.py new file mode 100644 index 000000000..1f9f32ea5 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_2/__init__.py @@ -0,0 +1 @@ +from ._example import example as example diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_2/_example.py b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_2/_example.py new file mode 100644 index 000000000..6e2d98fe0 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_2/_example.py @@ -0,0 +1,31 @@ +# ruff: noqa: W293 +from .._types import ICLExample + +constraint_requirement = """The answer must be a JSON with the following keys: +1. "subject" +2. "content\"""" + +validation_function = """import json + +def validate_input(input: str) -> bool: + \""" + Validates that the input is a JSON with required keys: subject and content. + + Args: + input (str): The input to validate + + Returns: + bool: True if JSON has required keys, False otherwise + \""" + try: + data = json.loads(response) + return isinstance(data, dict) and "subject" in data and "content" in data + except json.JSONDecodeError: + return False + except Exception: + return False""" + +example: ICLExample = { + "constraint_requirement": constraint_requirement, + "validation_function": validation_function, +} diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_3/__init__.py b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_3/__init__.py new file mode 100644 index 000000000..1f9f32ea5 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_3/__init__.py @@ -0,0 +1 @@ +from ._example import example as example diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_3/_example.py b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_3/_example.py new file mode 100644 index 000000000..65070a6ed --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_3/_example.py @@ -0,0 +1,58 @@ +# ruff: noqa: W293 +from .._types import ICLExample + +constraint_requirement = "Return a list of requirements, using dash bullets (-), where each item begins with the relevant entity" + +validation_function = """def validate_input(input: str) -> bool: + \""" + Validates that the input is a list of requirements using dash bullets, + where each item begins with the relevant entity. + + Args: + input (str): The input to validate + + Returns: + bool: True if input follows the required format, False otherwise + \""" + try: + if not input or not isinstance(input, str): + return False + + lines = input.strip().split('\n') + + # Check if all lines are empty + if not any(line.strip() for line in lines): + return False + + for line in lines: + line = line.strip() + + # Skip empty lines + if not line: + continue + + # Check if line starts with a dash bullet + if not line.startswith('- '): + return False + + # Check if there's content after the dash bullet + content = line[2:].strip() # Remove '- ' prefix + if not content: + return False + + # Check if content has an entity (word) at the beginning + words = content.split() + if not words: + return False + + # Entity should be the first word - just check it exists + # We're not validating what constitutes a valid entity here + + return True + except Exception: + return False""" + +example: ICLExample = { + "constraint_requirement": constraint_requirement, + "validation_function": validation_function, +} diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_4/__init__.py b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_4/__init__.py new file mode 100644 index 000000000..1f9f32ea5 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_4/__init__.py @@ -0,0 +1 @@ +from ._example import example as example diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_4/_example.py b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_4/_example.py new file mode 100644 index 000000000..f1af01ab1 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_example_4/_example.py @@ -0,0 +1,31 @@ +# ruff: noqa: W293 +from .._types import ICLExample + +constraint_requirement = 'Avoid the words "daughter-in-law" and "grandson"' + +validation_function = """def validate_input(input: str) -> bool: + \""" + Validates that the input does not contain the words "daughter-in-law" and "grandson". + + Args: + input (str): The input to validate + + Returns: + bool: True if neither word is found, False otherwise + \""" + try: + if not input: + return False + + # Convert to lowercase for case-insensitive comparison + input_lower = input.lower() + + # Check if either forbidden word is present + return "daughter-in-law" not in input_lower and "grandson" not in input_lower + except Exception: + return False""" + +example: ICLExample = { + "constraint_requirement": constraint_requirement, + "validation_function": validation_function, +} diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_icl_examples.py b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_icl_examples.py new file mode 100644 index 000000000..c018d2e41 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_icl_examples.py @@ -0,0 +1,5 @@ +from ._example_1 import example as example_1 +from ._example_2 import example as example_2 +from ._types import ICLExample + +icl_examples: list[ICLExample] = [example_1, example_2] diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_types.py b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_types.py new file mode 100644 index 000000000..bdd1f2372 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_icl_examples/_types.py @@ -0,0 +1,6 @@ +from typing import TypedDict + + +class ICLExample(TypedDict): + constraint_requirement: str + validation_function: str diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/_prompt.py b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_prompt.py new file mode 100644 index 000000000..b324180fc --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/_prompt.py @@ -0,0 +1,19 @@ +from pathlib import Path + +from jinja2 import Environment, FileSystemLoader + +from ._icl_examples import ICLExample, icl_examples as default_icl_examples + +this_file_dir = Path(__file__).resolve().parent + +environment = Environment(loader=FileSystemLoader(this_file_dir), autoescape=False) +system_template = environment.get_template("system_template.jinja2") +user_template = environment.get_template("user_template.jinja2") + + +def get_system_prompt(icl_examples: list[ICLExample] = default_icl_examples) -> str: + return system_template.render(icl_examples=icl_examples).strip() + + +def get_user_prompt(constraint_requirement: str) -> str: + return user_template.render(constraint_requirement=constraint_requirement).strip() diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/system_template.jinja2 b/cli/decompose/prompt_modules/validation_code_generator/_prompt/system_template.jinja2 new file mode 100644 index 000000000..7b414d0d5 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/system_template.jinja2 @@ -0,0 +1,77 @@ +You are a Python developer specialized in writing validation functions based on natural language constraints or requirements. + +## Function Requirements + +You will be provided with a constraint/requirement inside the tags. +Your task is to write a Python function capable of validating the against a text input to your function. + +Your code must: +- Be a single Python function. +- Take exactly one string parameter (the text input to be validated). +- Return a boolean value (True if valid or False if invalid). +- Use only standard Python libraries. No third-party dependencies. +- Be deterministic and self-contained. +- If the constraint/requirement mentions data that was not provided, just return `False` (don't need to implement code). + +## Output Format + +Your response must be structured as follows: +- Your Python function must be inside the tags. +- The function signature must be: `def validate_input(input: str) -> bool:`. +- Always enclose your code on a "try..except Exception:" clause and return `False` in case of exceptions. + +## Examples + +Here are some complete examples showing constraints/requirements and their corresponding validation functions: + +{% for item in icl_examples -%} + + +{{ item["constraint_requirement"] }} + + +{{ item["validation_function"] }} + + +All tags are closed and my assignment is finished. + + +{% endfor -%} +That concludes the complete examples of your assignment. + +## Additional Instructions + +When writing your answer, follow these additional instructions below to be successful: +1. The function signature must be: `def validate_input(input: str) -> bool:` +2. The function must handle `None` and empty string inputs by returning `False` +3. Use appropriate Python standard library modules (re, json, etc.) as needed +4. Ensure the function is simple and doesn't have unnecessary complexity +5. The validation logic should directly correspond to the provided constraint/requirement + +## Common Validation Patterns + +Here are some typical validation scenarios you might encounter: + +1. Character limit validation: + - Check if the answer has a specific number of characters or words + - Example: "The answer must be less than 100 characters" + +2. Format validation: + - Validate JSON structure, XML format, or other structured data + - Example: "The answer must be valid JSON with 'name' and 'age' fields" + +3. Content validation: + - Check for specific content patterns like uppercase letters, numbers, etc. + - Example: "The answer must contain at least one uppercase letter" + +4. Pattern matching: + - Use regex to validate specific patterns + - Example: "The answer must be in the format 'Name: [text], Age: [number]'" + +Important: Use only standard Python libraries that don't require additional installation. +Important: Your function must be deterministic and produce consistent results. +Important: You must always close the tags that were opened by using their corresponding close tag. You will be penalized if you don't close all tags. + +Very Important: After closing all tags, finish your assignment by writing (without the double quotes): "All tags are closed and my assignment is finished.". +Very Important: Always enclose your code on a "try..except Exception:" clause and return `False` in case of exceptions. +Very Important: If the constraint/requirement is not clear, or missing information, just return `False`. diff --git a/cli/decompose/prompt_modules/validation_code_generator/_prompt/user_template.jinja2 b/cli/decompose/prompt_modules/validation_code_generator/_prompt/user_template.jinja2 new file mode 100644 index 000000000..867af52e4 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_prompt/user_template.jinja2 @@ -0,0 +1,9 @@ +## Requirements: +- The function name must be: "validate_input" +- The function signature must be: `def validate_input(input: str) -> bool:` + +Now, here is the constraint/requirement for you to write a Python validation function: + + +{{ constraint_requirement }} + diff --git a/cli/decompose/prompt_modules/validation_code_generator/_validation_code_generator.py b/cli/decompose/prompt_modules/validation_code_generator/_validation_code_generator.py new file mode 100644 index 000000000..4b65401db --- /dev/null +++ b/cli/decompose/prompt_modules/validation_code_generator/_validation_code_generator.py @@ -0,0 +1,115 @@ +import re +from collections.abc import Callable +from typing import Any, TypeVar, cast, final + +from mellea import MelleaSession +from mellea.backends import ModelOption +from mellea.stdlib.components.chat import Message + +from .._prompt_modules import PromptModule, PromptModuleString +from ._exceptions import BackendGenerationError, TagExtractionError +from ._prompt import get_system_prompt, get_user_prompt + +T = TypeVar("T") + +RE_VALIDATION_FUNCTION = re.compile( + r"(.+?)", flags=re.IGNORECASE | re.DOTALL +) + + +@final +class _ValidationCodeGenerator(PromptModule): + @staticmethod + def _default_parser(generated_str: str) -> str: + r"""Default parser of the `validation_code_generator` module. + + _**Disclaimer**: This is a LLM-prompting module, so the results will vary depending + on the size and capabilities of the LLM used. The results are also not guaranteed, so + take a look at this module's Exceptions and plan for unreliable results._ + + Args: + generated_str (`str`): The LLM's answer to be parsed. + + Returns: + str: The extracted Python validation function code. + + Raises: + TagExtractionError: An error occurred trying to extract content from the + generated output. The LLM probably failed to open and close + the \ tags. + """ + validation_function_match = re.search(RE_VALIDATION_FUNCTION, generated_str) + + validation_function_str: str | None = ( + validation_function_match.group(1).strip() + if validation_function_match + else None + ) + + if validation_function_str is None: + raise TagExtractionError( + 'LLM failed to generate correct tags for extraction: ""' + ) + + return validation_function_str + + def generate( + self, + mellea_session: MelleaSession, + input_str: str | None, + max_new_tokens: int = 4096, + parser: Callable[[str], T] | None = None, + **kwargs: dict[str, Any], + ) -> PromptModuleString[T]: + """Generates a Python validation function based on a provided constraint/requirement. + + Args: + mellea_session (`MelleaSession`): A mellea session with a backend. + input_str (`str`): Natural language constraint/requirement to generate validation code for. + prompt (`str`, optional): The original task prompt for context. Defaults to None. + max_new_tokens (`int`, optional): Maximum tokens to generate. + Defaults to `4096`. + parser (`Callable[[str], Any]`, optional): A string parsing function. + Defaults to `_ValidationCodeGenerator._default_parser`. + + Returns: + PromptModuleString: A `PromptModuleString` class containing the generated output. + + The `PromptModuleString` class behaves like a `str`, but with an additional `parse()` method + to execute the parsing function passed in the `parser` argument of + this method (the `parser` argument defaults to `_ValidationCodeGenerator._default_parser`). + + Raises: + BackendGenerationError: Some error occurred during the LLM generation call. + """ + assert input_str is not None, 'This module requires the "input_str" argument' + + if parser is None: + parser = cast(Callable[[str], T], self._default_parser) + + system_prompt = get_system_prompt() + user_prompt = get_user_prompt(constraint_requirement=input_str) + + action = Message("user", user_prompt) + + try: + gen_result = mellea_session.act( + action=action, + model_options={ + ModelOption.SYSTEM_PROMPT: system_prompt, + ModelOption.TEMPERATURE: 0, + ModelOption.MAX_NEW_TOKENS: max_new_tokens, + }, + ).value + except Exception as e: + raise BackendGenerationError(f"LLM generation failed: {e}") + + if gen_result is None: + raise BackendGenerationError( + "LLM generation failed: value attribute is None" + ) + + return PromptModuleString(gen_result, parser) + + +validation_code_generator = _ValidationCodeGenerator() diff --git a/cli/decompose/prompt_modules/validation_decision/_prompt/system_template.jinja2 b/cli/decompose/prompt_modules/validation_decision/_prompt/system_template.jinja2 index 8e5cb00fb..fc0be317c 100644 --- a/cli/decompose/prompt_modules/validation_decision/_prompt/system_template.jinja2 +++ b/cli/decompose/prompt_modules/validation_decision/_prompt/system_template.jinja2 @@ -1,14 +1,14 @@ -You are a Validation Decision Expert specialized in determining whether prompt requirements can be validated deterministically by writing Python code or if they're best suited for LLM validation. +You are a Validation Decision Expert specialized in determining whether prompt requirements can be validated deterministically, by writing Python code, or if they're best suited for LLM validation. ## Decision Criteria ### Code Validation A requirement should be classified as "code" if it: -- Can be checked with deterministic algorithms +- Can be validated deterministically - Involves structured data validation (e.g., JSON schema, regex patterns) -- Requires mathematical computations or logical operations - Can be validated with simple string operations - Has clearly defined success/failure criteria that can be programmatically determined +- Is a straightforward requirement to validate the task output ### LLM Validation A requirement should be classified as "llm" if it: @@ -59,6 +59,7 @@ When writing your answer, follow these additional instructions below to be succe 3. After closing all tags, finish your assignment by writing (without the double quotes): "All tags are closed and my assignment is finished." Important: You must always close the tags that were opened by using their corresponding close tag. You will be penalized if you don't close all tags. +Important: The "code" classification is usually for validating the task output format or other deterministic requirements. Your response must contain exactly one of these two words inside tags: - code diff --git a/cli/decompose/prompt_modules/validation_report_generator/__init__.py b/cli/decompose/prompt_modules/validation_report_generator/__init__.py new file mode 100644 index 000000000..cdd3dee4c --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/__init__.py @@ -0,0 +1,7 @@ +from ._exceptions import ( + BackendGenerationError as BackendGenerationError, + TagExtractionError as TagExtractionError, +) +from ._validation_report_generator import ( + validation_report_generator as validation_report_generator, +) diff --git a/cli/decompose/prompt_modules/validation_report_generator/_exceptions.py b/cli/decompose/prompt_modules/validation_report_generator/_exceptions.py new file mode 100644 index 000000000..71b37da4b --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_exceptions.py @@ -0,0 +1,24 @@ +from typing import Any + + +class ValidationReportError(Exception): + def __init__(self, error_message: str, **kwargs: Any): + self.error_message = error_message + self.__dict__.update(kwargs) + super().__init__( + f'Module Error "validation_report_generator"; {self.error_message}' + ) + + +class BackendGenerationError(ValidationReportError): + """Raised when LLM generation fails in the "validation_report_generator" prompt module.""" + + def __init__(self, error_message: str, **kwargs: Any): + super().__init__(error_message, **kwargs) + + +class TagExtractionError(ValidationReportError): + """Raised when tag extraction fails in the "validation_report_generator" prompt module.""" + + def __init__(self, error_message: str, **kwargs: Any): + super().__init__(error_message, **kwargs) diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt.py new file mode 100644 index 000000000..b324180fc --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt.py @@ -0,0 +1,19 @@ +from pathlib import Path + +from jinja2 import Environment, FileSystemLoader + +from ._icl_examples import ICLExample, icl_examples as default_icl_examples + +this_file_dir = Path(__file__).resolve().parent + +environment = Environment(loader=FileSystemLoader(this_file_dir), autoescape=False) +system_template = environment.get_template("system_template.jinja2") +user_template = environment.get_template("user_template.jinja2") + + +def get_system_prompt(icl_examples: list[ICLExample] = default_icl_examples) -> str: + return system_template.render(icl_examples=icl_examples).strip() + + +def get_user_prompt(constraint_requirement: str) -> str: + return user_template.render(constraint_requirement=constraint_requirement).strip() diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/__init__.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/__init__.py new file mode 100644 index 000000000..0b985cbe6 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/__init__.py @@ -0,0 +1,5 @@ +from ._icl_examples import icl_examples as default_icl_examples +from ._prompt import ( + get_system_prompt as get_system_prompt, + get_user_prompt as get_user_prompt, +) diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/__init__.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/__init__.py new file mode 100644 index 000000000..052fe7c99 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/__init__.py @@ -0,0 +1,2 @@ +from ._icl_examples import icl_examples as icl_examples +from ._types import ICLExample as ICLExample diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_1/__init__.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_1/__init__.py new file mode 100644 index 000000000..1f9f32ea5 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_1/__init__.py @@ -0,0 +1 @@ +from ._example import example as example diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_1/_example.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_1/_example.py new file mode 100644 index 000000000..afcae4eb9 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_1/_example.py @@ -0,0 +1,21 @@ +from .._types import ICLExample + +# Example 1: Code validation case +# This example demonstrates a requirement that can be validated deterministically. + +constraint_requirement = """Don't mention the word "water".""" + +validation_report = """{ + "constraint_requirement": "Don't mention the word \"water\".", + "constraint_name": "no_water", + "is_valid": true, + "failure_cause": null, + "failure_trackback": null, + "error_type": null, + "error_trackback": null +}""" + +example: ICLExample = { + "constraint_requirement": constraint_requirement, + "validation_report": validation_report, +} diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_2/__init__.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_2/__init__.py new file mode 100644 index 000000000..1f9f32ea5 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_2/__init__.py @@ -0,0 +1 @@ +from ._example import example as example diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_2/_example.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_2/_example.py new file mode 100644 index 000000000..8c7247190 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_2/_example.py @@ -0,0 +1,21 @@ +from .._types import ICLExample + +# Example 2: LLM validation case +# This example demonstrates a requirement that needs subjective evaluation. + +constraint_requirement = """The user interface should be intuitive and provide a seamless experience for first-time users.""" + +validation_report = """{ + "constraint_requirement": "The user interface should be intuitive and provide a seamless experience for first-time users.", + "constraint_name": "intuitive_user_experience", + "is_valid": true, + "failure_cause": null, + "failure_trackback": null, + "error_type": null, + "error_trackback": null +}""" + +example: ICLExample = { + "constraint_requirement": constraint_requirement, + "validation_report": validation_report, +} diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_3/__init__.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_3/__init__.py new file mode 100644 index 000000000..1f9f32ea5 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_3/__init__.py @@ -0,0 +1 @@ +from ._example import example as example diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_3/_example.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_3/_example.py new file mode 100644 index 000000000..a8825bf25 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_3/_example.py @@ -0,0 +1,30 @@ +from .._types import ICLExample + +# Example 3: Code validation case +# This example demonstrates a requirement that involves structured data validation. + +constraint_requirement = """The API response must conform to the following JSON schema: +{ + "type": "object", + "properties": { + "id": {"type": "integer"}, + "name": {"type": "string"}, + "email": {"type": "string", "format": "email"} + }, + "required": ["id", "name", "email"] +}""" + +validation_report = """{ + "constraint_requirement": "The API response must conform to the following JSON schema: { \\\"type\\\": \\\"object\\\", \\\"properties\\\": { \\\"id\\\": {\\\"type\\\": \\\"integer\\\"}, \\\"name\\\": {\\\"type\\\": \\\"string\\\"}, \\\"email\\\": {\\\"type\\\": \\\"string\\\", \\\"format\\\": \\\"email\\\"} }, \\\"required\\\": [\\\"id\\\", \\\"name\\\", \\\"email\\\"] }", + "constraint_name": "api_response_schema", + "is_valid": false, + "failure_cause": "Response is missing required property 'email'.", + "failure_trackback": ["Required property 'email' not found in response."], + "error_type": null, + "error_trackback": null +}""" + +example: ICLExample = { + "constraint_requirement": constraint_requirement, + "validation_report": validation_report, +} diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_4/__init__.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_4/__init__.py new file mode 100644 index 000000000..1f9f32ea5 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_4/__init__.py @@ -0,0 +1 @@ +from ._example import example as example diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_4/_example.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_4/_example.py new file mode 100644 index 000000000..6352ec0e8 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_4/_example.py @@ -0,0 +1,21 @@ +from .._types import ICLExample + +# Example 4: LLM validation case +# This example demonstrates a requirement that involves creative evaluation. + +constraint_requirement = """The generated marketing copy should be compelling and persuasive, effectively communicating the product's value proposition to potential customers.""" + +validation_report = """{ + "constraint_requirement": "The generated marketing copy should be compelling and persuasive, effectively communicating the product's value proposition to potential customers.", + "constraint_name": "marketing_copy_quality", + "is_valid": true, + "failure_cause": null, + "failure_trackback": null, + "error_type": null, + "error_trackback": null +}""" + +example: ICLExample = { + "constraint_requirement": constraint_requirement, + "validation_report": validation_report, +} diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_5/__init__.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_5/__init__.py new file mode 100644 index 000000000..1f9f32ea5 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_5/__init__.py @@ -0,0 +1 @@ +from ._example import example as example diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_5/_example.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_5/_example.py new file mode 100644 index 000000000..31920745b --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_example_5/_example.py @@ -0,0 +1,22 @@ +from .._types import ICLExample + +# Example 5: LLM validation case +# This example demonstrates a requirement that involves semantic content interpretation +# and structural elements in test case descriptions. + +constraint_requirement = """Each test case should include: Test Case description, Precondition, Test Steps, and Expected Outcome""" + +validation_report = """{ + "constraint_requirement": "Each test case should include: Test Case description, Precondition, Test Steps, and Expected Outcome", + "constraint_name": "test_case_structure", + "is_valid": false, + "failure_cause": "The 'Expected Outcome' section is missing from the test case.", + "failure_trackback": ["Expected Outcome section not found."], + "error_type": null, + "error_trackback": null +}""" + +example: ICLExample = { + "constraint_requirement": constraint_requirement, + "validation_report": validation_report, +} diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_icl_examples.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_icl_examples.py new file mode 100644 index 000000000..6b3d11ca0 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_icl_examples.py @@ -0,0 +1,10 @@ +from ._example_1 import example as example_1 +from ._example_2 import example as example_2 +from ._example_3 import example as example_3 +from ._example_4 import example as example_4 +from ._example_5 import example as example_5 + +# Add more examples as needed +from ._types import ICLExample + +icl_examples: list[ICLExample] = [example_1, example_2, example_3, example_4, example_5] diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_types.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_types.py new file mode 100644 index 000000000..51503c3f8 --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_icl_examples/_types.py @@ -0,0 +1,6 @@ +from typing import TypedDict + + +class ICLExample(TypedDict): + constraint_requirement: str + validation_report: str diff --git a/cli/decompose/prompt_modules/validation_report_generator/_prompt/_prompt.py b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_prompt.py new file mode 100644 index 000000000..8e8fe890f --- /dev/null +++ b/cli/decompose/prompt_modules/validation_report_generator/_prompt/_prompt.py @@ -0,0 +1,19 @@ +from pathlib import Path + +from jinja2 import Environment, FileSystemLoader + +from ._icl_examples import ICLExample, icl_examples as default_icl_examples + +this_file_dir = Path(__file__).resolve().parent + +environment = Environment(loader=FileSystemLoader(this_file_dir), autoescape=False) +system_template = environment.get_template("system_template.jinja2") +user_template = environment.get_template("user_template.jinja2") + + +def get_system_prompt(icl_examples: list[ICLExample] = default_icl_examples) -> str: + return system_template.render(icl_examples=icl_examples).strip() + + +def get_user_prompt(requirement: str) -> str: + return user_template.render(requirement=requirement).strip() diff --git a/docs/docs/guide/m-decompose.md b/docs/docs/guide/m-decompose.md index 2457b284a..2e20ec9c3 100644 --- a/docs/docs/guide/m-decompose.md +++ b/docs/docs/guide/m-decompose.md @@ -19,7 +19,7 @@ Write your task description to a text file, then run: ```bash mkdir -p ./output -m decompose run --prompt-file task.txt --out-dir ./output/ +m decompose run --input-file task.txt --out-dir ./output/ ``` > **Note:** The output directory must already exist — the command will error if it @@ -48,7 +48,7 @@ their morning exercise routine. Run: ```bash -m decompose run --prompt-file task.txt --out-dir ./output/ +m decompose run --input-file task.txt --out-dir ./output/ ``` Then execute the generated script: @@ -64,7 +64,7 @@ python output/m_decomp_result.py ```bash m decompose run \ - --prompt-file task.txt \ + --input-file task.txt \ --out-dir ./output/ \ --backend openai \ --model-id gpt-4o-mini diff --git a/docs/examples/m_decompose/README.md b/docs/examples/m_decompose/README.md new file mode 100644 index 000000000..838a2325f --- /dev/null +++ b/docs/examples/m_decompose/README.md @@ -0,0 +1,102 @@ +# m_decompose + +This automatic pipeline demonstrates **task decomposition and execution** built with *Mellea generative programs*. + +Instead of solving a complex task with a single prompt, the system first **decomposes the task into subtasks**, then executes them sequentially through a assembled pipeline. + +This pattern improves reasoning quality, interpretability, and modularity in LLM-powered systems. + +--- + +# Overview + +Many complex tasks contain multiple reasoning steps. +The `m_decompose` pipeline handles this by splitting the task into smaller units. + +``` +User Request + ↓ +Task Decomposition + ↓ +Subtasks + ↓ +Task Execution + ↓ +Final Result +``` + +Rather than writing a large prompt, the workflow uses **generative modules and reusable prompts**. + +--- + +# Directory + +``` +m_decompose/ +├── decompose.py +├── pipeline.py +├── prompt_modules +└── README.md +``` + +**decompose.py** + +Generates the refined subtasks from the user request. + +**pipeline.py** + +Runs the full workflow: + +1. decompose the task +2. execute subtasks +3. aggregate results + +**prompt_modules** + +Reusable prompt components used by the pipeline. + +**m_decomp_result_v1.py.jinja2** + +Template used to format the final output. + +--- + +# Quick Start + +Example usage: + +```python +from mellea.cli.decompose.pipeline import decompose, DecompBackend +import json + +query = """I will visit Grand Canyon National Park for 3 days in early May. Please create a travel itinerary that includes major scenic viewpoints and short hiking trails. The daily walking distance should stay under 6 miles, and each day should include at least one sunset or sunrise viewpoint.""" + +result = decompose( + task_prompt=query, + model_id="mistralai/Mistral-Small-3.2-24B-Instruct-2506", + backend=DecompBackend.openai, + backend_endpoint="http://localhost:8000/v1", + backend_api_key="EMPTY", +) + +print(json.dumps(result, indent=2, ensure_ascii=False)) +``` + + +The pipeline then executes each step and produces the final answer. + +--- + +# What This Example Shows + +This example highlights three key ideas: + +- **Task Decomposition and Execution** — analyze complex problems into smaller planning and execution steps. +- **Generative Mellea Program** — conduct LLM workflows as an programmatic pipeline instead of single call. +- **Instruction Modular** — separate instruction design from execution logic using reusable modules. + +--- + +# Summary + +`m_decompose` shows how to build **LLM pipelines** using task decomposition. diff --git a/docs/examples/m_decompose/decompose_using_cli.sh b/docs/examples/m_decompose/decompose_using_cli.sh old mode 100644 new mode 100755 index 169596b56..dd6215f5a --- a/docs/examples/m_decompose/decompose_using_cli.sh +++ b/docs/examples/m_decompose/decompose_using_cli.sh @@ -1 +1,7 @@ -m decompose run --out-dir ./ --prompt-file ./docs/examples/m_decomposeexample_decompose_prompt.txt \ No newline at end of file +#MODEL_ID=granite3.3 +#MODEL_ID=granite4 + +MODEL_ID=qwen2.5:7b + +m decompose run --model-id $MODEL_ID --out-dir ./ --input-file example.txt + diff --git a/docs/examples/m_decompose/example.txt b/docs/examples/m_decompose/example.txt new file mode 100644 index 000000000..f6c2f4af5 --- /dev/null +++ b/docs/examples/m_decompose/example.txt @@ -0,0 +1,3 @@ +I will visit Grand Canyon National Park for 3 days in early May. Please create a travel itinerary that includes major scenic viewpoints and short hiking trails. The daily walking distance should stay under 6 miles, and each day should include at least one sunset or sunrise viewpoint. +I am preparing my U.S. federal tax return for 2025. My income sources include W-2 salary, house rental, and investment dividends. Please help estimate my federal tax liability and suitable which types of program of TurboTax for possible deductions. Assume I can take the standard/itemized deduction, and the calculation should assume I live in Virginia. +We are building an AI assistant for meeting productivity that can summarize meetings and generate follow-up tasks. Please propose 5 core product features that would provide the most value to users. The features should be feasible and simple enough for a MVP, and each feature should be under 60 words. \ No newline at end of file diff --git a/docs/examples/m_decompose/example_decompose_prompt.txt b/docs/examples/m_decompose/example_decompose_prompt.txt deleted file mode 100644 index 41336c1b7..000000000 --- a/docs/examples/m_decompose/example_decompose_prompt.txt +++ /dev/null @@ -1,53 +0,0 @@ -I need you to help me plan, organize, and execute a comprehensive corporate team-building -event for our company with 100-300 employees that will strengthen team cohesion, -improve cross-departmental collaboration, boost morale, and create lasting memories, -and I need you to create a complete event strategy document that includes detailed planning -timelines starting 6 months before the event with weekly milestones, budget breakdowns for venue -rental at $15,000-25,000, catering at $75-125 per person, entertainment and activities -at $10,000-20,000, transportation at $3,000-8,000, technology at $5,000-10,000, and total -estimated budget of $50,000-125,000, and I need you to design a marketing and communication -strategy with save-the-date announcements 4 months in advance, formal invitations 2 months before, -weekly reminder emails, internal campaigns, dedicated Slack channel, executive videos, and mobile -event app, and I need you to develop a venue selection process evaluating 10 venues based on -capacity for 100-300 people, accessibility, parking, indoor/outdoor space, AV capabilities, -WiFi for 300+ devices, catering facilities, accommodations, and cost-effectiveness, -and I need you to design a detailed event schedule from 8:00 AM to 8:00 PM including -registration and breakfast at 8:00-9:00 AM, opening ceremony at 9:00-9:30 AM with CEO speech, -icebreaker activities at 9:30-10:30 AM including human bingo and speed networking, -morning workshops at 10:30 AM-12:30 PM with tracks on leadership, innovation, communication, -and wellness, lunch at 12:30-2:00 PM with diverse menu options, afternoon team challenges -at 2:00-5:00 PM including scavenger hunt, escape rooms, outdoor adventures, cooking competition, -and sports tournaments, awards ceremony at 5:00-5:30 PM, and dinner with entertainment -at 5:30-8:00 PM, and I need you to create icebreaker plans with 15 options including -human knot, marshmallow tower, obstacle course, pictionary, charades, and trust falls, -and I need you to develop team formation strategy with diverse mix of departments and -seniority in teams of 8-12 people, pre-event survey for dietary restrictions and preferences, -and team assignments 2 weeks before with names and colors, and I need you to design workshop -content with leadership case studies, innovation brainstorming, communication exercises, -and wellness meditation, and I need you to create catering plan with breakfast coffee station -and pastries, lunch buffet with salad bar and hot entrees, afternoon snacks, and dinner with -three entree choices and full bar, and I need you to develop activity logistics with equipment -lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation -schedules, and I need you to create transportation plan with charter buses, parking management, -shuttle service, and contingency plans, and I need you to design registration process with online -portal, on-site check-in, name tags, welcome packets with schedule and swag, and staff training, -and I need you to develop safety plan with insurance, first aid stations, evacuation procedures, -weather contingencies, food safety with allergen labeling, security personnel, and incident -reporting, and I need you to create vendor management strategy with selection criteria, contracts, -payment schedules, and evaluation forms, and I need you to design technology plan with event -app for scheduling and messaging, AV equipment, WiFi for 300+ connections, photography services, -live streaming, and tech support, and I need you to develop decoration strategy with signage, -team colors, photo backdrops, and sustainable options, and I need you to create entertainment -plan with live band or DJ, emcee, interactive activities, and evening games, and I need you to -design prize strategy with team prizes at $500, $300, and $200, individual awards, participation -gifts, and raffle prizes, and I need you to create post-event evaluation with participant -survey within 24 hours, debriefing sessions, budget reconciliation, photo compilation, -impact assessment, and thank you communications, and I need you to design accessibility plan -with ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive -team formation, and I need you to develop sustainability plan with eco-friendly venue, local -catering, reusable serving ware, digital communications, recyclable decorations, and -waste management, and I need you to create contingency planning for weather emergencies, -vendor cancellations, technology failures, medical emergencies, and budget overruns, -and ensure all planning follows best practices, creates memorable experiences, -accommodates diverse needs, stays within budget, prioritizes safety, incorporates sustainable -practices, leverages technology, builds excitement, and measures success. \ No newline at end of file diff --git a/docs/examples/m_decompose/m_decomp_result.json b/docs/examples/m_decompose/m_decomp_result.json deleted file mode 100644 index 88e917071..000000000 --- a/docs/examples/m_decompose/m_decomp_result.json +++ /dev/null @@ -1,688 +0,0 @@ -{ - "original_task_prompt": "I need you to help me plan, organize, and execute a comprehensive corporate team-building event for our company with 100-300 employees that will strengthen team cohesion, improve cross-departmental collaboration, boost morale, and create lasting memories, and I need you to create a complete event strategy document that includes detailed planning timelines starting 6 months before the event with weekly milestones, budget breakdowns for venue rental at $15,000-25,000, catering at $75-125 per person, entertainment and activities at $10,000-20,000, transportation at $3,000-8,000, technology at $5,000-10,000, and total estimated budget of $50,000-125,000, and I need you to design a marketing and communication strategy with save-the-date announcements 4 months in advance, formal invitations 2 months before, weekly reminder emails, internal campaigns, dedicated Slack channel, executive videos, and mobile event app, and I need you to develop a venue selection process evaluating 10 venues based on capacity for 100-300 people, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi for 300+ devices, catering facilities, accommodations, and cost-effectiveness, and I need you to design a detailed event schedule from 8:00 AM to 8:00 PM including registration and breakfast at 8:00-9:00 AM, opening ceremony at 9:00-9:30 AM with CEO speech, icebreaker activities at 9:30-10:30 AM including human bingo and speed networking, morning workshops at 10:30 AM-12:30 PM with tracks on leadership, innovation, communication, and wellness, lunch at 12:30-2:00 PM with diverse menu options, afternoon team challenges at 2:00-5:00 PM including scavenger hunt, escape rooms, outdoor adventures, cooking competition, and sports tournaments, awards ceremony at 5:00-5:30 PM, and dinner with entertainment at 5:30-8:00 PM, and I need you to create icebreaker plans with 15 options including human knot, marshmallow tower, obstacle course, pictionary, charades, and trust falls, and I need you to develop team formation strategy with diverse mix of departments and seniority in teams of 8-12 people, pre-event survey for dietary restrictions and preferences, and team assignments 2 weeks before with names and colors, and I need you to design workshop content with leadership case studies, innovation brainstorming, communication exercises, and wellness meditation, and I need you to create catering plan with breakfast coffee station and pastries, lunch buffet with salad bar and hot entrees, afternoon snacks, and dinner with three entree choices and full bar, and I need you to develop activity logistics with equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules, and I need you to create transportation plan with charter buses, parking management, shuttle service, and contingency plans, and I need you to design registration process with online portal, on-site check-in, name tags, welcome packets with schedule and swag, and staff training, and I need you to develop safety plan with insurance, first aid stations, evacuation procedures, weather contingencies, food safety with allergen labeling, security personnel, and incident reporting, and I need you to create vendor management strategy with selection criteria, contracts, payment schedules, and evaluation forms, and I need you to design technology plan with event app for scheduling and messaging, AV equipment, WiFi for 300+ connections, photography services, live streaming, and tech support, and I need you to develop decoration strategy with signage, team colors, photo backdrops, and sustainable options, and I need you to create entertainment plan with live band or DJ, emcee, interactive activities, and evening games, and I need you to design prize strategy with team prizes at $500, $300, and $200, individual awards, participation gifts, and raffle prizes, and I need you to create post-event evaluation with participant survey within 24 hours, debriefing sessions, budget reconciliation, photo compilation, impact assessment, and thank you communications, and I need you to design accessibility plan with ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation, and I need you to develop sustainability plan with eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management, and I need you to create contingency planning for weather emergencies, vendor cancellations, technology failures, medical emergencies, and budget overruns, and ensure all planning follows best practices, creates memorable experiences, accommodates diverse needs, stays within budget, prioritizes safety, incorporates sustainable practices, leverages technology, builds excitement, and measures success.", - "subtask_list": [ - "1. Gather all necessary information about the company, event requirements, and constraints. -", - "2. Create a detailed planning timeline starting 6 months before the event with weekly milestones. -", - "3. Develop a budget breakdown for venue rental, catering, entertainment, transportation, technology, and total estimated budget. -", - "4. Design a marketing and communication strategy including save-the-date announcements, formal invitations, reminder emails, internal campaigns, and other communication methods. -", - "5. Develop a venue selection process to evaluate and select the best venue based on capacity, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi, catering facilities, accommodations, and cost-effectiveness. -", - "6. Design a detailed event schedule from 8:00 AM to 8:00 PM including registration, breakfast, opening ceremony, icebreaker activities, workshops, lunch, team challenges, awards ceremony, and dinner with entertainment. -", - "7. Create a list of 15 icebreaker activities with detailed plans. -", - "8. Develop a team formation strategy with diverse mix of departments and seniority, pre-event survey for dietary restrictions, and team assignments 2 weeks before the event. -", - "9. Design content for leadership, innovation, communication, and wellness workshops. -", - "10. Create a detailed catering plan with breakfast, lunch, afternoon snacks, and dinner options. -", - "11. Develop logistics for all planned activities including equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules. -", - "12. Create a transportation plan with charter buses, parking management, shuttle service, and contingency plans. -", - "13. Design a registration process with online portal, on-site check-in, name tags, welcome packets, and staff training. -", - "14. Develop a comprehensive safety plan including insurance, first aid stations, evacuation procedures, weather contingencies, food safety, security personnel, and incident reporting. -", - "15. Create a vendor management strategy with selection criteria, contracts, payment schedules, and evaluation forms. -", - "16. Design a technology plan with event app, AV equipment, WiFi, photography services, live streaming, and tech support. -", - "17. Develop a decoration strategy with signage, team colors, photo backdrops, and sustainable options. -", - "18. Create an entertainment plan with live band or DJ, emcee, interactive activities, and evening games. -", - "19. Design a prize strategy with team prizes, individual awards, participation gifts, and raffle prizes. -", - "20. Develop a post-event evaluation plan with participant survey, debriefing sessions, budget reconciliation, photo compilation, impact assessment, and thank you communications. -", - "21. Create an accessibility plan with ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation. -", - "22. Develop a sustainability plan with eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management. -", - "23. Create a contingency plan for weather emergencies, vendor cancellations, technology failures, medical emergencies, and budget overruns. -", - "24. Compile all the information into a comprehensive event strategy document. -" - ], - "identified_constraints": [ - { - "constraint": "The event strategy document must include detailed planning timelines starting 6 months before the event with weekly milestones", - "validation_strategy": "llm" - }, - { - "constraint": "The budget breakdowns must include venue rental at $15,000-25,000, catering at $75-125 per person, entertainment and activities at $10,000-20,000, transportation at $3,000-8,000, technology at $5,000-10,000, and total estimated budget of $50,000-125,000", - "validation_strategy": "code" - }, - { - "constraint": "The marketing and communication strategy must include save-the-date announcements 4 months in advance, formal invitations 2 months before, weekly reminder emails, internal campaigns, dedicated Slack channel, executive videos, and mobile event app", - "validation_strategy": "llm" - }, - { - "constraint": "The venue selection process must evaluate 10 venues based on capacity for 100-300 people, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi for 300+ devices, catering facilities, accommodations, and cost-effectiveness", - "validation_strategy": "llm" - }, - { - "constraint": "The event schedule must include registration and breakfast at 8:00-9:00 AM, opening ceremony at 9:00-9:30 AM with CEO speech, icebreaker activities at 9:30-10:30 AM including human bingo and speed networking, morning workshops at 10:30 AM-12:30 PM with tracks on leadership, innovation, communication, and wellness, lunch at 12:30-2:00 PM with diverse menu options, afternoon team challenges at 2:00-5:00 PM including scavenger hunt, escape rooms, outdoor adventures, cooking competition, and sports tournaments, awards ceremony at 5:00-5:30 PM, and dinner with entertainment at 5:30-8:00 PM", - "validation_strategy": "llm" - }, - { - "constraint": "The icebreaker plans must include 15 options including human knot, marshmallow tower, obstacle course, pictionary, charades, and trust falls", - "validation_strategy": "llm" - }, - { - "constraint": "The team formation strategy must include diverse mix of departments and seniority in teams of 8-12 people, pre-event survey for dietary restrictions and preferences, and team assignments 2 weeks before with names and colors", - "validation_strategy": "llm" - }, - { - "constraint": "The workshop content must include leadership case studies, innovation brainstorming, communication exercises, and wellness meditation", - "validation_strategy": "llm" - }, - { - "constraint": "The catering plan must include breakfast coffee station and pastries, lunch buffet with salad bar and hot entrees, afternoon snacks, and dinner with three entree choices and full bar", - "validation_strategy": "llm" - }, - { - "constraint": "The activity logistics must include equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules", - "validation_strategy": "llm" - }, - { - "constraint": "The transportation plan must include charter buses, parking management, shuttle service, and contingency plans", - "validation_strategy": "llm" - }, - { - "constraint": "The registration process must include online portal, on-site check-in, name tags, welcome packets with schedule and swag, and staff training", - "validation_strategy": "llm" - }, - { - "constraint": "The safety plan must include insurance, first aid stations, evacuation procedures, weather contingencies, food safety with allergen labeling, security personnel, and incident reporting", - "validation_strategy": "llm" - }, - { - "constraint": "The vendor management strategy must include selection criteria, contracts, payment schedules, and evaluation forms", - "validation_strategy": "llm" - }, - { - "constraint": "The technology plan must include event app for scheduling and messaging, AV equipment, WiFi for 300+ connections, photography services, live streaming, and tech support", - "validation_strategy": "llm" - }, - { - "constraint": "The decoration strategy must include signage, team colors, photo backdrops, and sustainable options", - "validation_strategy": "llm" - }, - { - "constraint": "The entertainment plan must include live band or DJ, emcee, interactive activities, and evening games", - "validation_strategy": "llm" - }, - { - "constraint": "The prize strategy must include team prizes at $500, $300, and $200, individual awards, participation gifts, and raffle prizes", - "validation_strategy": "llm" - }, - { - "constraint": "The post-event evaluation must include participant survey within 24 hours, debriefing sessions, budget reconciliation, photo compilation, impact assessment, and thank you communications", - "validation_strategy": "llm" - }, - { - "constraint": "The accessibility plan must include ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation", - "validation_strategy": "llm" - }, - { - "constraint": "The sustainability plan must include eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management", - "validation_strategy": "llm" - }, - { - "constraint": "The contingency planning must include weather emergencies, vendor cancellations, technology failures, medical emergencies, and budget overruns", - "validation_strategy": "llm" - }, - { - "constraint": "All planning must follow best practices, create memorable experiences, accommodate diverse needs, stay within budget, prioritize safety, incorporate sustainable practices, leverage technology, build excitement, and measure success", - "validation_strategy": "llm" - } - ], - "subtasks": [ - { - "subtask": "1. Gather all necessary information about the company, event requirements, and constraints. -", - "tag": "INFORMATION_GATHERING", - "constraints": [ - { - "constraint": "The budget breakdowns must include venue rental at $15,000-25,000, catering at $75-125 per person, entertainment and activities at $10,000-20,000, transportation at $3,000-8,000, technology at $5,000-10,000, and total estimated budget of $50,000-125,000", - "validation_strategy": "code" - }, - { - "constraint": "The venue selection process must evaluate 10 venues based on capacity for 100-300 people, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi for 300+ devices, catering facilities, accommodations, and cost-effectiveness", - "validation_strategy": "llm" - }, - { - "constraint": "The safety plan must include insurance, first aid stations, evacuation procedures, weather contingencies, food safety with allergen labeling, security personnel, and incident reporting", - "validation_strategy": "llm" - }, - { - "constraint": "The accessibility plan must include ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation", - "validation_strategy": "llm" - }, - { - "constraint": "The sustainability plan must include eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management", - "validation_strategy": "llm" - }, - { - "constraint": "All planning must follow best practices, create memorable experiences, accommodate diverse needs, stay within budget, prioritize safety, incorporate sustainable practices, leverage technology, build excitement, and measure success", - "validation_strategy": "llm" - } - ], - "prompt_template": "To gather all necessary information about the company, event requirements, and constraints, follow these steps:\n\n1. **Company Information**:\n - **Company Size**: Determine the number of employees (100-300).\n - **Departments**: Identify the different departments within the company.\n - **Employee Demographics**: Gather information about the diversity of employees, including age, seniority, and roles.\n - **Company Culture**: Understand the company's values, mission, and current team dynamics.\n\n2. **Event Requirements**:\n - **Objectives**: Clearly define the goals of the event, such as strengthening team cohesion, improving cross-departmental collaboration, boosting morale, and creating lasting memories.\n - **Event Type**: Specify the type of event (e.g., corporate team-building event).\n - **Duration**: Determine the start and end times of the event (8:00 AM to 8:00 PM).\n - **Key Activities**: List the key activities planned for the event, such as registration, breakfast, opening ceremony, icebreaker activities, workshops, lunch, team challenges, awards ceremony, and dinner with entertainment.\n\n3. **Event Constraints**:\n - **Budget**: Identify the budget constraints for different aspects of the event, including venue rental ($15,000-25,000), catering ($75-125 per person), entertainment and activities ($10,000-20,000), transportation ($3,000-8,000), technology ($5,000-10,000), and total estimated budget ($50,000-125,000).\n - **Venue Requirements**: Specify the venue requirements, such as capacity for 100-300 people, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi for 300+ devices, catering facilities, accommodations, and cost-effectiveness.\n - **Safety and Accessibility**: Ensure the event follows best practices for safety, accessibility, and sustainability.\n - **Technology**: Identify the technology requirements, such as event app for scheduling and messaging, AV equipment, WiFi for 300+ connections, photography services, live streaming, and tech support.\n\n4. **Additional Information**:\n - **Marketing and Communication**: Gather information about the marketing and communication strategy, including save-the-date announcements, formal invitations, reminder emails, internal campaigns, dedicated Slack channel, executive videos, and mobile event app.\n - **Team Formation**: Understand the team formation strategy, including diverse mix of departments and seniority, pre-event survey for dietary restrictions and preferences, and team assignments 2 weeks before the event.\n - **Workshop Content**: Identify the content for leadership, innovation, communication, and wellness workshops.\n - **Catering Plan**: Gather information about the catering plan, including breakfast, lunch, afternoon snacks, and dinner options.\n - **Activity Logistics**: Understand the logistics for all planned activities, including equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules.\n - **Transportation Plan**: Gather information about the transportation plan, including charter buses, parking management, shuttle service, and contingency plans.\n - **Registration Process**: Understand the registration process, including online portal, on-site check-in, name tags, welcome packets, and staff training.\n - **Safety Plan**: Gather information about the safety plan, including insurance, first aid stations, evacuation procedures, weather contingencies, food safety, security personnel, and incident reporting.\n - **Vendor Management**: Understand the vendor management strategy, including selection criteria, contracts, payment schedules, and evaluation forms.\n - **Technology Plan**: Gather information about the technology plan, including event app, AV equipment, WiFi, photography services, live streaming, and tech support.\n - **Decoration Strategy**: Understand the decoration strategy, including signage, team colors, photo backdrops, and sustainable options.\n - **Entertainment Plan**: Gather information about the entertainment plan, including live band or DJ, emcee, interactive activities, and evening games.\n - **Prize Strategy**: Understand the prize strategy, including team prizes, individual awards, participation gifts, and raffle prizes.\n - **Post-Event Evaluation**: Gather information about the post-event evaluation plan, including participant survey, debriefing sessions, budget reconciliation, photo compilation, impact assessment, and thank you communications.\n - **Accessibility Plan**: Understand the accessibility plan, including ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation.\n - **Sustainability Plan**: Gather information about the sustainability plan, including eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management.\n - **Contingency Planning**: Understand the contingency planning for weather emergencies, vendor cancellations, technology failures, medical emergencies, and budget overruns.\n\n5. **Documentation**:\n - Compile all the gathered information into a comprehensive document that will serve as the basis for the event strategy document.\n\nBy following these steps, you will gather all necessary information about the company, event requirements, and constraints to ensure a successful and well-organized corporate team-building event.", - "input_vars_required": [], - "depends_on": [] - }, - { - "subtask": "2. Create a detailed planning timeline starting 6 months before the event with weekly milestones. -", - "tag": "PLANNING_TIMELINE", - "constraints": [ - { - "constraint": "The event strategy document must include detailed planning timelines starting 6 months before the event with weekly milestones", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to create a detailed planning timeline starting 6 months before the event with weekly milestones. Follow these steps to accomplish your task:\n\nFirst, review the gathered information about the company, event requirements, and constraints from the previous step:\n\n{{INFORMATION_GATHERING}}\n\n\nNext, consider the key components of the event that need to be planned, such as venue selection, marketing and communication, team formation, workshops, catering, activities, transportation, registration, safety, vendor management, technology, decorations, entertainment, prizes, post-event evaluation, accessibility, sustainability, and contingency planning.\n\nBreak down the planning process into weekly milestones starting 6 months before the event. Ensure that each milestone is specific, measurable, achievable, relevant, and time-bound (SMART).\n\nHere is a suggested structure for the planning timeline:\n\n**6 Months Before the Event:**\n- Finalize event objectives and key performance indicators (KPIs).\n- Establish the event budget and allocate funds to different categories.\n- Develop a high-level event plan and timeline.\n- Identify and assemble the event planning team.\n- Begin researching and evaluating potential venues.\n\n**5 Months Before the Event:**\n- Select and book the venue.\n- Develop a detailed event schedule and share it with key stakeholders.\n- Create a marketing and communication strategy.\n- Begin designing the event branding and promotional materials.\n- Start planning the team formation strategy.\n\n**4 Months Before the Event:**\n- Send save-the-date announcements to employees.\n- Finalize the event schedule and share it with vendors and participants.\n- Develop the workshop content and identify facilitators.\n- Create a catering plan and send out a pre-event survey for dietary restrictions.\n- Begin planning the icebreaker activities.\n\n**3 Months Before the Event:**\n- Send formal invitations to employees.\n- Finalize the team formation strategy and assign teams.\n- Develop the activity logistics and equipment lists.\n- Create a transportation plan and arrange charter buses if necessary.\n- Design the registration process and set up the online portal.\n\n**2 Months Before the Event:**\n- Send weekly reminder emails to employees.\n- Finalize the catering plan and confirm menu options.\n- Develop the safety plan and evacuation procedures.\n- Create a vendor management strategy and finalize contracts.\n- Design the technology plan and arrange AV equipment.\n\n**1 Month Before the Event:**\n- Send team assignments and welcome packets to employees.\n- Finalize the decoration strategy and order necessary materials.\n- Develop the entertainment plan and book a live band or DJ.\n- Create a prize strategy and order prizes.\n- Finalize the post-event evaluation plan.\n\n**2 Weeks Before the Event:**\n- Conduct a final walkthrough of the venue.\n- Train staff on the registration process and safety protocols.\n- Finalize the accessibility plan and make necessary accommodations.\n- Develop a sustainability plan and implement eco-friendly practices.\n- Create a contingency plan for potential emergencies.\n\n**1 Week Before the Event:**\n- Send a final reminder email to employees.\n- Confirm all vendor arrangements and payment schedules.\n- Finalize the event schedule and share it with participants.\n- Prepare the welcome packets and name tags.\n- Conduct a final review of the event strategy document.\n\nEnsure that the planning timeline is comprehensive and covers all aspects of the event. The timeline should be flexible and allow for adjustments as needed.\n\nFinally, write the detailed planning timeline starting 6 months before the event with weekly milestones. Your answer will serve as basis for the next steps.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING" - ] - }, - { - "subtask": "3. Develop a budget breakdown for venue rental, catering, entertainment, transportation, technology, and total estimated budget. -", - "tag": "BUDGET_BREAKDOWN", - "constraints": [ - { - "constraint": "The budget breakdowns must include venue rental at $15,000-25,000, catering at $75-125 per person, entertainment and activities at $10,000-20,000, transportation at $3,000-8,000, technology at $5,000-10,000, and total estimated budget of $50,000-125,000", - "validation_strategy": "code" - } - ], - "prompt_template": "Your task is to develop a detailed budget breakdown for the corporate team-building event. This budget should include estimates for venue rental, catering, entertainment, transportation, technology, and the total estimated budget.\n\nTo accomplish this, follow these steps:\n\n1. **Review Gathered Information**:\n First, review the information gathered about the company, event requirements, and constraints. This information will help you understand the scope and specific needs of the event:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **Understand Budget Constraints**:\n The event has specific budget constraints for each category:\n - **Venue Rental**: $15,000 - $25,000\n - **Catering**: $75 - $125 per person\n - **Entertainment and Activities**: $10,000 - $20,000\n - **Transportation**: $3,000 - $8,000\n - **Technology**: $5,000 - $10,000\n - **Total Estimated Budget**: $50,000 - $125,000\n\n3. **Calculate Catering Costs**:\n The catering cost is per person. The event will have 100-300 employees attending. Calculate the total catering cost based on the number of attendees and the per-person cost.\n\n4. **Estimate Other Costs**:\n Provide a detailed estimate for each of the remaining categories (venue rental, entertainment, transportation, and technology) within the specified budget ranges.\n\n5. **Summarize Total Estimated Budget**:\n Add up the estimated costs for each category to provide a total estimated budget for the event. Ensure that the total estimated budget falls within the specified range of $50,000 - $125,000.\n\n6. **Provide Detailed Breakdown**:\n Present the budget breakdown in a clear and organized manner. Include the following information for each category:\n - **Category**: Name of the budget category (e.g., Venue Rental)\n - **Estimated Cost**: The estimated cost for that category\n - **Notes**: Any additional notes or considerations for that category\n\n7. **Review and Adjust**:\n Review your budget breakdown to ensure it is accurate and aligns with the event's requirements and constraints. Make any necessary adjustments to ensure the total estimated budget is within the specified range.\n\n8. **Final Answer**:\n Provide the detailed budget breakdown as your final answer. Ensure it is clear, concise, and adheres to the specified budget constraints.\n\nExample Format:\n- **Venue Rental**: $20,000\n - Notes: Includes rental fee for the venue and basic setup.\n- **Catering**: $25,000\n - Notes: Based on 200 attendees at $125 per person.\n- **Entertainment and Activities**: $15,000\n - Notes: Includes costs for activities and entertainment.\n- **Transportation**: $5,000\n - Notes: Includes charter buses and shuttle service.\n- **Technology**: $7,000\n - Notes: Includes AV equipment, WiFi, and tech support.\n- **Total Estimated Budget**: $72,000", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING" - ] - }, - { - "subtask": "4. Design a marketing and communication strategy including save-the-date announcements, formal invitations, reminder emails, internal campaigns, and other communication methods. -", - "tag": "MARKETING_STRATEGY", - "constraints": [ - { - "constraint": "The marketing and communication strategy must include save-the-date announcements 4 months in advance, formal invitations 2 months before, weekly reminder emails, internal campaigns, dedicated Slack channel, executive videos, and mobile event app", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to design a comprehensive marketing and communication strategy for a corporate team-building event. This strategy should ensure effective engagement and participation from all employees. Follow these steps to accomplish your task:\n\n1. **Review Gathered Information**:\n Begin by reviewing the information gathered about the company, event requirements, and constraints. This will help you tailor the marketing and communication strategy to the specific needs and preferences of the employees:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **Understand the Planning Timeline**:\n Familiarize yourself with the planning timeline to ensure that all marketing and communication activities are scheduled appropriately. This will help you create a timeline for save-the-date announcements, formal invitations, reminder emails, and internal campaigns:\n \n {{PLANNING_TIMELINE}}\n \n\n3. **Budget Considerations**:\n Consider the budget breakdown to ensure that the marketing and communication strategy is cost-effective and aligns with the overall budget for the event:\n \n {{BUDGET_BREAKDOWN}}\n \n\n4. **Develop the Marketing and Communication Strategy**:\n Create a detailed marketing and communication strategy that includes the following components:\n\n - **Save-the-Date Announcements**:\n Plan to send save-the-date announcements 4 months in advance. These announcements should be sent via email and should include the event date, purpose, and a brief overview of what to expect.\n\n - **Formal Invitations**:\n Design formal invitations to be sent 2 months before the event. These invitations should include detailed information about the event schedule, dress code, and any specific instructions or requirements.\n\n - **Weekly Reminder Emails**:\n Schedule weekly reminder emails leading up to the event. These emails should provide updates, reminders, and any additional information that may be relevant to the participants.\n\n - **Internal Campaigns**:\n Develop internal campaigns to build excitement and engagement. These campaigns can include posters, flyers, and announcements on internal communication platforms.\n\n - **Dedicated Slack Channel**:\n Create a dedicated Slack channel for event-related discussions, updates, and announcements. This channel will serve as a central hub for all event-related communication.\n\n - **Executive Videos**:\n Plan to create and share videos featuring executive messages about the event. These videos can be shared via email, internal communication platforms, and the dedicated Slack channel.\n\n - **Mobile Event App**:\n Develop a mobile event app that provides participants with access to the event schedule, maps, speaker information, and other relevant details. The app should also include features for messaging and networking.\n\n5. **Ensure Consistency and Clarity**:\n Ensure that all marketing and communication materials are consistent in tone, style, and branding. This will help create a cohesive and professional image for the event.\n\n6. **Review and Finalize**:\n Review the marketing and communication strategy to ensure that it meets all the requirements and aligns with the overall event goals. Make any necessary adjustments and finalize the strategy.\n\nYour final answer should be a detailed marketing and communication strategy document that includes all the components mentioned above.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING", - "PLANNING_TIMELINE", - "BUDGET_BREAKDOWN" - ] - }, - { - "subtask": "5. Develop a venue selection process to evaluate and select the best venue based on capacity, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi, catering facilities, accommodations, and cost-effectiveness. -", - "tag": "VENUE_SELECTION", - "constraints": [ - { - "constraint": "The venue selection process must evaluate 10 venues based on capacity for 100-300 people, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi for 300+ devices, catering facilities, accommodations, and cost-effectiveness", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to develop a comprehensive venue selection process to evaluate and select the best venue for the corporate team-building event. Follow these steps to accomplish your task:\n\n1. **Understand the Requirements**:\n Review the gathered information about the company and event requirements, including the need to accommodate 100-300 employees. Ensure the venue selection process aligns with the overall event goals of strengthening team cohesion, improving cross-departmental collaboration, boosting morale, and creating lasting memories.\n\n2. **Define Evaluation Criteria**:\n Based on the event requirements, define the key criteria for evaluating potential venues. The criteria should include:\n - **Capacity**: Ability to accommodate 100-300 people.\n - **Accessibility**: Ease of access for all attendees, including those with disabilities.\n - **Parking**: Adequate parking facilities for attendees and staff.\n - **Indoor/Outdoor Space**: Availability of both indoor and outdoor spaces for various activities.\n - **AV Capabilities**: Sufficient audio-visual equipment and support.\n - **WiFi**: Reliable WiFi for 300+ devices.\n - **Catering Facilities**: Ability to support breakfast, lunch, afternoon snacks, and dinner.\n - **Accommodations**: Proximity to accommodations for out-of-town attendees, if necessary.\n - **Cost-Effectiveness**: Budget-friendly options within the estimated budget of $15,000-25,000.\n\n3. **Research Potential Venues**:\n Identify at least 10 potential venues that meet the initial criteria. Gather detailed information about each venue, including:\n - Location and contact information.\n - Capacity and layout.\n - Availability of required facilities and services.\n - Cost estimates for rental and additional services.\n\n4. **Create Evaluation Forms**:\n Develop evaluation forms to systematically assess each venue against the defined criteria. The forms should include:\n - Checklists for each criterion.\n - Rating scales for subjective assessments.\n - Space for notes and additional comments.\n\n5. **Conduct Venue Visits or Virtual Tours**:\n Schedule visits or virtual tours of the shortlisted venues. During the visits, evaluate:\n - The overall ambiance and suitability for the event.\n - The condition and functionality of facilities.\n - The responsiveness and professionalism of the venue staff.\n\n6. **Compare and Contrast Venues**:\n Use the evaluation forms to compare and contrast the venues. Create a summary table or matrix that highlights the strengths and weaknesses of each venue based on the defined criteria.\n\n7. **Select the Best Venue**:\n Based on the evaluations, select the venue that best meets the event requirements and aligns with the budget. Consider factors such as overall value, flexibility, and the ability to create a memorable experience for attendees.\n\n8. **Document the Selection Process**:\n Prepare a detailed report documenting the venue selection process. The report should include:\n - The defined evaluation criteria.\n - The list of potential venues and their evaluations.\n - The comparison and contrast of venues.\n - The rationale for selecting the final venue.\n\n9. **Finalize Venue Contract**:\n Work with the selected venue to finalize the contract, ensuring all agreed-upon terms and conditions are clearly outlined. Include details such as:\n - Rental costs and payment schedules.\n - Cancellation policies.\n - Additional services and their costs.\n\n10. **Integrate with Overall Event Plan**:\n Ensure the selected venue aligns with the overall event strategy document. Coordinate with other event planning components, such as catering, transportation, and technology, to ensure seamless integration.\n\nBy following these steps, you will develop a thorough and effective venue selection process that meets the event's requirements and contributes to its success.", - "input_vars_required": [], - "depends_on": [] - }, - { - "subtask": "6. Design a detailed event schedule from 8:00 AM to 8:00 PM including registration, breakfast, opening ceremony, icebreaker activities, workshops, lunch, team challenges, awards ceremony, and dinner with entertainment. -", - "tag": "EVENT_SCHEDULE", - "constraints": [ - { - "constraint": "The event schedule must include registration and breakfast at 8:00-9:00 AM, opening ceremony at 9:00-9:30 AM with CEO speech, icebreaker activities at 9:30-10:30 AM including human bingo and speed networking, morning workshops at 10:30 AM-12:30 PM with tracks on leadership, innovation, communication, and wellness, lunch at 12:30-2:00 PM with diverse menu options, afternoon team challenges at 2:00-5:00 PM including scavenger hunt, escape rooms, outdoor adventures, cooking competition, and sports tournaments, awards ceremony at 5:00-5:30 PM, and dinner with entertainment at 5:30-8:00 PM", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to design a detailed event schedule from 8:00 AM to 8:00 PM for a corporate team-building event. The schedule should include the following key components:\n\n1. **Registration and Breakfast (8:00 - 9:00 AM)**\n - Plan for registration process and breakfast setup.\n - Include details on coffee stations, pastries, and any other breakfast items.\n\n2. **Opening Ceremony (9:00 - 9:30 AM)**\n - Outline the opening ceremony, including the CEO's speech.\n - Include any additional opening activities or announcements.\n\n3. **Icebreaker Activities (9:30 - 10:30 AM)**\n - Plan for icebreaker activities such as human bingo and speed networking.\n - Include any necessary setup or facilitation details.\n\n4. **Morning Workshops (10:30 AM - 12:30 PM)**\n - Design tracks on leadership, innovation, communication, and wellness.\n - Include details on workshop content, facilitators, and any required materials.\n\n5. **Lunch (12:30 - 2:00 PM)**\n - Plan for lunch with diverse menu options.\n - Include details on catering setup, dietary restrictions, and any special considerations.\n\n6. **Afternoon Team Challenges (2:00 - 5:00 PM)**\n - Plan for team challenges such as scavenger hunt, escape rooms, outdoor adventures, cooking competition, and sports tournaments.\n - Include details on equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules.\n\n7. **Awards Ceremony (5:00 - 5:30 PM)**\n - Plan for the awards ceremony, including any necessary setup or facilitation details.\n - Include details on award categories, presentation, and any additional activities.\n\n8. **Dinner with Entertainment (5:30 - 8:00 PM)**\n - Plan for dinner with three entree choices and a full bar.\n - Include details on entertainment such as live band or DJ, emcee, interactive activities, and evening games.\n\nTo accomplish this task, follow these steps:\n\n1. **Review Gathered Information**:\n - Carefully review the gathered information about the company, event requirements, and constraints from the previous step:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **Review Planning Timeline**:\n - Review the planning timeline starting 6 months before the event with weekly milestones from the previous step:\n \n {{PLANNING_TIMELINE}}\n \n\n3. **Review Budget Breakdown**:\n - Review the budget breakdown for venue rental, catering, entertainment, transportation, technology, and total estimated budget from the previous step:\n \n {{BUDGET_BREAKDOWN}}\n \n\n4. **Review Marketing Strategy**:\n - Review the marketing and communication strategy including save-the-date announcements, formal invitations, reminder emails, internal campaigns, and other communication methods from the previous step:\n \n {{MARKETING_STRATEGY}}\n \n\n5. **Review Venue Selection**:\n - Review the venue selection process to evaluate and select the best venue based on capacity, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi, catering facilities, accommodations, and cost-effectiveness from the previous step:\n \n {{VENUE_SELECTION}}\n \n\n6. **Design the Event Schedule**:\n - Use the information gathered in the previous steps to design a detailed event schedule from 8:00 AM to 8:00 PM.\n - Ensure the schedule includes all the key components mentioned above.\n - Make sure the schedule is realistic, feasible, and aligns with the event's goals and constraints.\n\n7. **Finalize the Schedule**:\n - Review the designed event schedule to ensure it meets all the requirements and constraints.\n - Make any necessary adjustments to ensure the schedule is comprehensive and detailed.\n\n8. **Output the Event Schedule**:\n - Provide the detailed event schedule as your final answer. Ensure the output is clear, concise, and well-organized.\n\nRemember to adhere to the event's goals of strengthening team cohesion, improving cross-departmental collaboration, boosting morale, and creating lasting memories. Ensure the schedule is inclusive, accessible, and sustainable, following best practices and leveraging technology where appropriate.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING", - "PLANNING_TIMELINE", - "BUDGET_BREAKDOWN", - "MARKETING_STRATEGY", - "VENUE_SELECTION" - ] - }, - { - "subtask": "7. Create a list of 15 icebreaker activities with detailed plans. -", - "tag": "ICEBREAKER_PLANS", - "constraints": [ - { - "constraint": "The icebreaker plans must include 15 options including human knot, marshmallow tower, obstacle course, pictionary, charades, and trust falls", - "validation_strategy": "llm" - }, - { - "constraint": "The event schedule must include registration and breakfast at 8:00-9:00 AM, opening ceremony at 9:00-9:30 AM with CEO speech, icebreaker activities at 9:30-10:30 AM including human bingo and speed networking, morning workshops at 10:30 AM-12:30 PM with tracks on leadership, innovation, communication, and wellness, lunch at 12:30-2:00 PM with diverse menu options, afternoon team challenges at 2:00-5:00 PM including scavenger hunt, escape rooms, outdoor adventures, cooking competition, and sports tournaments, awards ceremony at 5:00-5:30 PM, and dinner with entertainment at 5:30-8:00 PM", - "validation_strategy": "llm" - }, - { - "constraint": "The activity logistics must include equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules", - "validation_strategy": "llm" - }, - { - "constraint": "The safety plan must include insurance, first aid stations, evacuation procedures, weather contingencies, food safety with allergen labeling, security personnel, and incident reporting", - "validation_strategy": "llm" - }, - { - "constraint": "The accessibility plan must include ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to create a list of 15 icebreaker activities with detailed plans for a corporate team-building event. These activities should be engaging, inclusive, and designed to foster team cohesion and collaboration among 100-300 employees.\n\nTo approach this task, follow these steps:\n\n1. **Understand the Event Context**:\n Review the gathered information about the company, event requirements, and constraints from the previous step:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **Review the Event Schedule**:\n Ensure that the icebreaker activities align with the event schedule, particularly the time slot allocated for icebreaker activities from 9:30 AM to 10:30 AM:\n \n {{EVENT_SCHEDULE}}\n \n\n3. **List of Icebreaker Activities**:\n Create a list of 15 icebreaker activities. Each activity should include the following details:\n - **Activity Name**: A clear and descriptive title.\n - **Objective**: The purpose of the activity and how it contributes to team-building.\n - **Materials Needed**: A list of any equipment or materials required.\n - **Setup Instructions**: Step-by-step instructions for setting up the activity.\n - **Instructions for Participants**: Clear guidelines on how to participate.\n - **Duration**: The estimated time required for the activity.\n - **Facilitator Notes**: Any special instructions or tips for the facilitator.\n - **Safety Protocols**: Any safety considerations or guidelines.\n - **Scoring System (if applicable)**: How the activity will be scored or evaluated.\n - **Rotation Schedule (if applicable)**: How the activity will be rotated among teams.\n\n4. **Diverse and Inclusive Activities**:\n Ensure that the activities are diverse and inclusive, catering to different personalities, abilities, and preferences. Consider activities that can be adapted for various team sizes and dynamics.\n\n5. **Engaging and Fun**:\n The activities should be engaging and fun, designed to create a positive and memorable experience for all participants.\n\n6. **Alignment with Event Goals**:\n Ensure that the activities align with the overall goals of the event, which include strengthening team cohesion, improving cross-departmental collaboration, boosting morale, and creating lasting memories.\n\nHere is an example structure to guide your writing:\n- **Activity 1: Human Knot**\n - **Objective**: Promote teamwork and problem-solving.\n - **Materials Needed**: None.\n - **Setup Instructions**: Have participants stand in a circle.\n - **Instructions for Participants**: Each person must hold hands with two people across from them to form a \"human knot.\"\n - **Duration**: 15-20 minutes.\n - **Facilitator Notes**: Encourage communication and teamwork.\n - **Safety Protocols**: Ensure participants are careful not to pull too hard.\n - **Scoring System**: Not applicable.\n - **Rotation Schedule**: Not applicable.\n\nRepeat the above structure for all 15 icebreaker activities.\n\nEnsure that each activity is clearly described and includes all the necessary details for successful execution.\n\nFinally, compile the list of 15 icebreaker activities with detailed plans into a comprehensive document.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING", - "EVENT_SCHEDULE" - ] - }, - { - "subtask": "8. Develop a team formation strategy with diverse mix of departments and seniority, pre-event survey for dietary restrictions, and team assignments 2 weeks before the event. -", - "tag": "TEAM_FORMATION", - "constraints": [ - { - "constraint": "The team formation strategy must include diverse mix of departments and seniority in teams of 8-12 people, pre-event survey for dietary restrictions and preferences, and team assignments 2 weeks before with names and colors", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to develop a team formation strategy for a corporate team-building event. This strategy should ensure a diverse mix of departments and seniority levels, accommodate dietary restrictions, and assign teams two weeks before the event.\n\nTo accomplish this, follow these steps:\n\n1. **Understand the Event Requirements**:\n Review the gathered information about the company, event requirements, and constraints from the previous step:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **Diverse Team Formation**:\n Create a strategy to form teams with a diverse mix of departments and seniority levels. Each team should consist of 8-12 people. Ensure that the teams are balanced in terms of experience, roles, and departments to foster collaboration and learning.\n\n3. **Pre-Event Survey**:\n Design a pre-event survey to collect information about dietary restrictions and preferences from all participants. This survey should be distributed at least one month before the event to allow sufficient time for planning.\n\n4. **Team Assignments**:\n Develop a process for assigning participants to teams. This process should consider the survey responses regarding dietary restrictions and ensure that teams are formed in a way that accommodates these needs. Team assignments should be communicated to participants two weeks before the event.\n\n5. **Team Identification**:\n Assign unique names and colors to each team to facilitate easy identification and foster team spirit. Ensure that the names and colors are inclusive and appropriate for all participants.\n\n6. **Communication Plan**:\n Outline a communication plan for informing participants about their team assignments, including the team name, color, and any other relevant information. This plan should include the distribution of team assignments and any follow-up communications.\n\n7. **Documentation**:\n Document the team formation strategy, including the criteria used for team formation, the survey questions, the process for assigning teams, and the communication plan. This documentation will be included in the comprehensive event strategy document.\n\nEnsure that your strategy aligns with the overall event goals of strengthening team cohesion, improving cross-departmental collaboration, boosting morale, and creating lasting memories.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING" - ] - }, - { - "subtask": "9. Design content for leadership, innovation, communication, and wellness workshops. -", - "tag": "WORKSHOP_CONTENT", - "constraints": [ - { - "constraint": "The workshop content must include leadership case studies, innovation brainstorming, communication exercises, and wellness meditation", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to design content for leadership, innovation, communication, and wellness workshops as part of the corporate team-building event. Follow these steps to accomplish your task:\n\n1. **Understand the Workshop Requirements**:\n - The workshops should focus on four key areas: leadership, innovation, communication, and wellness.\n - Each workshop should be engaging, informative, and relevant to the attendees, who are employees from various departments and seniority levels.\n - The workshops should align with the overall goals of strengthening team cohesion, improving cross-departmental collaboration, boosting morale, and creating lasting memories.\n\n2. **Review Gathered Information**:\n - Use the information gathered in the previous steps to understand the company's needs, event requirements, and constraints:\n \n {{INFORMATION_GATHERING}}\n \n\n3. **Design Leadership Workshop Content**:\n - Create a workshop that focuses on leadership case studies, practical exercises, and group discussions.\n - Include real-world examples and interactive activities that encourage participants to apply leadership principles.\n - Ensure the content is relevant to both current leaders and those aspiring to leadership roles.\n\n4. **Design Innovation Workshop Content**:\n - Develop a workshop that emphasizes innovation brainstorming, creative problem-solving, and idea generation.\n - Incorporate activities that encourage out-of-the-box thinking and collaboration.\n - Provide tools and techniques that participants can use to foster innovation within their teams.\n\n5. **Design Communication Workshop Content**:\n - Create a workshop that covers effective communication strategies, active listening, and conflict resolution.\n - Include exercises that help participants practice clear and concise communication.\n - Address both verbal and non-verbal communication skills.\n\n6. **Design Wellness Workshop Content**:\n - Develop a workshop that focuses on wellness meditation, stress management, and work-life balance.\n - Incorporate activities that promote physical and mental well-being.\n - Provide practical tips and techniques that participants can integrate into their daily routines.\n\n7. **Ensure Alignment with Event Schedule**:\n - Refer to the detailed event schedule to ensure the workshops fit within the allocated time slots:\n \n {{EVENT_SCHEDULE}}\n \n\n8. **Consider Team Formation Strategy**:\n - Take into account the team formation strategy to ensure the workshops cater to diverse groups:\n \n {{TEAM_FORMATION}}\n \n\n9. **Create Detailed Workshop Plans**:\n - For each workshop, provide a detailed plan that includes:\n - Objectives and learning outcomes\n - Agenda and timeline\n - Materials and resources needed\n - Facilitator guidelines\n - Participant activities and exercises\n - Evaluation methods\n\n10. **Review and Finalize**:\n - Ensure the workshop content aligns with the overall event goals and constraints.\n - Make any necessary adjustments to ensure the workshops are engaging, informative, and relevant to the attendees.\n\nYour final answer should be a detailed plan for each of the four workshops, including all the elements listed above.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING", - "EVENT_SCHEDULE", - "TEAM_FORMATION" - ] - }, - { - "subtask": "10. Create a detailed catering plan with breakfast, lunch, afternoon snacks, and dinner options. -", - "tag": "CATERING_PLAN", - "constraints": [ - { - "constraint": "The catering plan must include breakfast coffee station and pastries, lunch buffet with salad bar and hot entrees, afternoon snacks, and dinner with three entree choices and full bar", - "validation_strategy": "llm" - }, - { - "constraint": "The safety plan must include insurance, first aid stations, evacuation procedures, weather contingencies, food safety with allergen labeling, security personnel, and incident reporting", - "validation_strategy": "llm" - }, - { - "constraint": "The sustainability plan must include eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management", - "validation_strategy": "llm" - }, - { - "constraint": "The team formation strategy must include diverse mix of departments and seniority in teams of 8-12 people, pre-event survey for dietary restrictions and preferences, and team assignments 2 weeks before with names and colors", - "validation_strategy": "llm" - }, - { - "constraint": "The budget breakdowns must include venue rental at $15,000-25,000, catering at $75-125 per person, entertainment and activities at $10,000-20,000, transportation at $3,000-8,000, technology at $5,000-10,000, and total estimated budget of $50,000-125,000", - "validation_strategy": "code" - } - ], - "prompt_template": "Your task is to create a detailed catering plan for the corporate team-building event. The catering plan should include options for breakfast, lunch, afternoon snacks, and dinner, ensuring a diverse menu that accommodates various dietary restrictions and preferences.\n\nTo approach this task, follow these steps:\n\n1. **Review Gathered Information**:\n Begin by reviewing the information gathered about the company and event requirements:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **Understand the Event Schedule**:\n Familiarize yourself with the event schedule to ensure the catering plan aligns with the timing of meals and breaks:\n \n {{EVENT_SCHEDULE}}\n \n\n3. **Consider Dietary Restrictions**:\n Use the team formation strategy, which includes a pre-event survey for dietary restrictions and preferences, to ensure the catering plan accommodates all attendees:\n \n {{TEAM_FORMATION}}\n \n\n4. **Breakfast Options**:\n Plan a breakfast menu that includes a coffee station and pastries. Ensure there are options for different dietary needs, such as gluten-free, vegan, and lactose-free choices.\n\n5. **Lunch Options**:\n Design a lunch buffet with a variety of options, including a salad bar and hot entrees. Provide diverse menu choices to cater to different tastes and dietary restrictions.\n\n6. **Afternoon Snacks**:\n Plan for afternoon snacks that are light and refreshing. Consider options like fruits, vegetables, and healthy snacks to keep energy levels up during the event.\n\n7. **Dinner Options**:\n Create a dinner menu with three entree choices and a full bar. Ensure there are options for different dietary needs and preferences, such as vegetarian, vegan, and gluten-free choices.\n\n8. **Allergen Labeling**:\n Include allergen labeling for all food items to ensure the safety and well-being of all attendees.\n\n9. **Sustainability Considerations**:\n Incorporate sustainable practices into the catering plan, such as using reusable serving ware and minimizing food waste.\n\n10. **Budget Constraints**:\n Ensure the catering plan stays within the budget constraints outlined in the budget breakdown:\n \n {{BUDGET_BREAKDOWN}}\n \n\n11. **Finalize the Catering Plan**:\n Compile all the information into a detailed catering plan that includes timings, menu options, and any special considerations.\n\nYour final answer should be a comprehensive catering plan that meets all the requirements and constraints of the event.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING", - "EVENT_SCHEDULE", - "TEAM_FORMATION", - "BUDGET_BREAKDOWN" - ] - }, - { - "subtask": "11. Develop logistics for all planned activities including equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules. -", - "tag": "ACTIVITY_LOGISTICS", - "constraints": [ - { - "constraint": "The activity logistics must include equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to develop detailed logistics for all planned activities for the corporate team-building event. This includes creating equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules.\n\nTo approach this task, follow these steps:\n\n1. **Review the Event Schedule and Activity Plans**:\n - Carefully review the event schedule and the list of planned activities from the previous steps. These include icebreaker activities, workshops, team challenges, and other events.\n - Ensure you have a clear understanding of the timeline and the sequence of activities.\n\n2. **Create Equipment Lists**:\n - For each activity, identify the necessary equipment and materials required.\n - Ensure that the equipment lists are comprehensive and include all items needed for smooth execution.\n\n3. **Develop Setup Instructions**:\n - Provide detailed setup instructions for each activity.\n - Include information on how to arrange the space, set up equipment, and prepare the area for participants.\n\n4. **Establish Safety Protocols**:\n - Develop safety protocols for each activity to ensure the well-being of all participants.\n - Include guidelines for emergency procedures, first aid, and any specific safety measures related to the activity.\n\n5. **Prepare Facilitator Guides**:\n - Create facilitator guides that outline the roles and responsibilities of the activity facilitators.\n - Include step-by-step instructions, tips for engaging participants, and any other relevant information.\n\n6. **Design Scoring Systems**:\n - For competitive activities, design scoring systems that are fair and transparent.\n - Ensure that the scoring criteria are clearly communicated to all participants.\n\n7. **Plan Rotation Schedules**:\n - Develop rotation schedules for activities that involve multiple groups or teams.\n - Ensure that the schedules are efficient and allow for smooth transitions between activities.\n\n8. **Integrate with Other Plans**:\n - Ensure that the activity logistics align with the catering plan, transportation plan, and other relevant aspects of the event.\n - Coordinate with the technology plan to ensure that any necessary AV equipment or WiFi access is available.\n\n9. **Review and Finalize**:\n - Review all the logistics plans to ensure they are comprehensive and practical.\n - Make any necessary adjustments to ensure that the activities run smoothly and safely.\n\nHere is an example structure to guide your writing:\n- **Activity Name**: [Name of the activity]\n- **Equipment List**: [List of required equipment]\n- **Setup Instructions**: [Detailed setup instructions]\n- **Safety Protocols**: [Safety guidelines and emergency procedures]\n- **Facilitator Guide**: [Roles and responsibilities, step-by-step instructions]\n- **Scoring System**: [Scoring criteria and guidelines]\n- **Rotation Schedule**: [Schedule for team rotations]\n\nEnsure that each section is clearly outlined and provides all necessary information for the successful execution of the activity.\n\nFinally, compile all the logistics plans into a detailed document that can be easily referenced during the event planning and execution phases.", - "input_vars_required": [], - "depends_on": [] - }, - { - "subtask": "12. Create a transportation plan with charter buses, parking management, shuttle service, and contingency plans. -", - "tag": "TRANSPORTATION_PLAN", - "constraints": [ - { - "constraint": "The transportation plan must include charter buses, parking management, shuttle service, and contingency plans", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to create a comprehensive transportation plan for the corporate team-building event. This plan should include charter buses, parking management, shuttle service, and contingency plans. Follow these steps to accomplish your task:\n\n1. **Review Gathered Information**:\n Start by reviewing the information gathered about the company, event requirements, and constraints. This will help you understand the specific needs and logistics of the event:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **Understand the Event Schedule**:\n Familiarize yourself with the detailed event schedule to ensure that the transportation plan aligns with the timing and logistics of the event:\n \n {{EVENT_SCHEDULE}}\n \n\n3. **Develop Charter Bus Plan**:\n Create a plan for charter buses that includes:\n - Number of buses required based on the number of attendees.\n - Pick-up and drop-off locations.\n - Schedule for bus arrivals and departures.\n - Cost estimates and budget considerations.\n\n4. **Design Parking Management Plan**:\n Develop a parking management plan that includes:\n - Availability of parking spaces at the venue.\n - Designated parking areas for attendees, staff, and vendors.\n - Parking fees and payment methods.\n - Accessibility considerations for attendees with disabilities.\n\n5. **Create Shuttle Service Plan**:\n Outline a shuttle service plan that includes:\n - Routes and schedules for shuttles.\n - Pick-up and drop-off points.\n - Frequency of shuttle services.\n - Cost estimates and budget considerations.\n\n6. **Develop Contingency Plans**:\n Prepare contingency plans for potential issues such as:\n - Weather-related delays or cancellations.\n - Mechanical failures of buses or shuttles.\n - Unexpected changes in attendee numbers.\n - Alternative transportation options in case of emergencies.\n\n7. **Integrate with Other Logistics**:\n Ensure that the transportation plan is integrated with other event logistics, such as registration, catering, and activities. This will help ensure a smooth and coordinated event experience.\n\n8. **Finalize the Transportation Plan**:\n Compile all the information into a detailed transportation plan that includes all the elements mentioned above. Ensure that the plan is clear, organized, and easy to follow.\n\nYour final answer should be a comprehensive transportation plan that addresses all the requirements and considerations mentioned above.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING", - "EVENT_SCHEDULE" - ] - }, - { - "subtask": "13. Design a registration process with online portal, on-site check-in, name tags, welcome packets, and staff training. -", - "tag": "REGISTRATION_PROCESS", - "constraints": [ - { - "constraint": "The registration process must include online portal, on-site check-in, name tags, welcome packets with schedule and swag, and staff training", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to design a comprehensive registration process for the corporate team-building event. This process should include an online portal, on-site check-in, name tags, welcome packets, and staff training. Follow these steps to accomplish your task:\n\n1. **Online Portal**:\n - Design an online registration portal that allows employees to register for the event.\n - Ensure the portal collects necessary information such as name, department, dietary restrictions, and any special needs.\n - Include a confirmation email feature that sends registration details and event information to participants.\n\n2. **On-Site Check-In**:\n - Develop a streamlined on-site check-in process to ensure smooth and efficient entry for all attendees.\n - Plan for check-in stations with clear signage and trained staff to assist participants.\n - Consider using technology such as QR codes or barcode scanners to expedite the check-in process.\n\n3. **Name Tags**:\n - Design and prepare name tags for all attendees.\n - Include the participant's name, department, and any additional information that may be relevant (e.g., dietary restrictions, accessibility needs).\n - Ensure name tags are durable, easy to read, and can be worn comfortably throughout the event.\n\n4. **Welcome Packets**:\n - Create welcome packets that include essential event information such as the schedule, map of the venue, and any necessary forms or documents.\n - Include a welcome letter from the event organizers or company executives.\n - Add promotional items or swag to the packets to enhance the participant experience.\n\n5. **Staff Training**:\n - Develop a training program for event staff to ensure they are prepared to handle registration, check-in, and any issues that may arise.\n - Train staff on the use of the online portal, check-in technology, and how to assist participants with special needs.\n - Conduct mock drills to simulate the registration process and identify any potential issues or areas for improvement.\n\n6. **Integration with Other Plans**:\n - Ensure the registration process aligns with the overall event schedule, transportation plan, and safety plan.\n - Coordinate with the technology plan to integrate any necessary tech solutions for registration and check-in.\n - Consider the accessibility plan to ensure the registration process is inclusive and accommodates all participants.\n\n7. **Contingency Planning**:\n - Develop a contingency plan for potential issues such as technical difficulties with the online portal, high check-in volumes, or last-minute registrations.\n - Ensure staff are trained to handle these scenarios and have backup plans in place.\n\n8. **Review and Finalize**:\n - Review the registration process to ensure it meets all requirements and aligns with the event's goals.\n - Make any necessary adjustments and finalize the registration process.\n\nUse the information gathered in the previous steps to guide your design. Ensure the registration process is user-friendly, efficient, and aligns with the overall event strategy.\n\n\n{{INFORMATION_GATHERING}}\n\n\n\n{{PLANNING_TIMELINE}}\n\n\n\n{{BUDGET_BREAKDOWN}}\n\n\n\n{{MARKETING_STRATEGY}}\n\n\n\n{{VENUE_SELECTION}}\n\n\n\n{{EVENT_SCHEDULE}}\n\n\n\n{{ICEBREAKER_PLANS}}\n\n\n\n{{TEAM_FORMATION}}\n\n\n\n{{WORKSHOP_CONTENT}}\n\n\n\n{{CATERING_PLAN}}\n\n\n\n{{ACTIVITY_LOGISTICS}}\n\n\n\n{{TRANSPORTATION_PLAN}}\n", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING", - "PLANNING_TIMELINE", - "BUDGET_BREAKDOWN", - "MARKETING_STRATEGY", - "VENUE_SELECTION", - "EVENT_SCHEDULE", - "ICEBREAKER_PLANS", - "TEAM_FORMATION", - "WORKSHOP_CONTENT", - "CATERING_PLAN", - "ACTIVITY_LOGISTICS", - "TRANSPORTATION_PLAN" - ] - }, - { - "subtask": "14. Develop a comprehensive safety plan including insurance, first aid stations, evacuation procedures, weather contingencies, food safety, security personnel, and incident reporting. -", - "tag": "SAFETY_PLAN", - "constraints": [ - { - "constraint": "The safety plan must include insurance, first aid stations, evacuation procedures, weather contingencies, food safety with allergen labeling, security personnel, and incident reporting", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to develop a comprehensive safety plan for the corporate team-building event. This plan should ensure the safety and well-being of all participants and staff. Follow these steps to accomplish your task:\n\n1. **Understand the Event Details**:\n Review the gathered information about the company, event requirements, and constraints from the previous step:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **Identify Key Safety Components**:\n The safety plan should include the following components:\n - **Insurance**: Ensure that the event has adequate insurance coverage for all activities and participants.\n - **First Aid Stations**: Plan for the setup of first aid stations at strategic locations within the venue.\n - **Evacuation Procedures**: Develop clear evacuation procedures in case of emergencies.\n - **Weather Contingencies**: Prepare contingency plans for adverse weather conditions.\n - **Food Safety**: Implement food safety measures, including allergen labeling and proper handling procedures.\n - **Security Personnel**: Arrange for security personnel to be present throughout the event.\n - **Incident Reporting**: Establish a system for reporting and managing incidents during the event.\n\n3. **Create Detailed Plans for Each Component**:\n - **Insurance**: Specify the type and amount of insurance required, and ensure that all vendors and participants are covered.\n - **First Aid Stations**: Determine the number and location of first aid stations, and ensure that they are staffed by qualified medical personnel.\n - **Evacuation Procedures**: Develop a clear and concise evacuation plan, including designated assembly points and communication protocols.\n - **Weather Contingencies**: Prepare alternative plans for outdoor activities in case of bad weather, including indoor alternatives and rescheduling options.\n - **Food Safety**: Work with caterers to ensure that all food is prepared and served safely, with clear labeling of allergens.\n - **Security Personnel**: Hire and brief security personnel on their roles and responsibilities, including crowd control and emergency response.\n - **Incident Reporting**: Create a system for reporting incidents, including forms and protocols for documenting and addressing issues.\n\n4. **Review and Finalize the Safety Plan**:\n Ensure that the safety plan is comprehensive and addresses all potential risks and contingencies. Make any necessary adjustments to ensure that the plan is practical and effective.\n\n5. **Output the Safety Plan**:\n Provide the detailed safety plan as your final answer. The plan should be clear, concise, and easy to follow, ensuring that all safety measures are in place for a successful event.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING" - ] - }, - { - "subtask": "15. Create a vendor management strategy with selection criteria, contracts, payment schedules, and evaluation forms. -", - "tag": "VENDOR_MANAGEMENT", - "constraints": [ - { - "constraint": "The vendor management strategy must include selection criteria, contracts, payment schedules, and evaluation forms", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to create a comprehensive vendor management strategy for the corporate team-building event. This strategy should include selection criteria, contracts, payment schedules, and evaluation forms. Follow these steps to accomplish your task:\n\n1. **Understand the Requirements**:\n Review the gathered information about the company, event requirements, and constraints from the previous step:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **Define Selection Criteria**:\n Develop a set of selection criteria for vendors. Consider factors such as:\n - Experience and reputation\n - Cost-effectiveness\n - Availability and capacity\n - Quality of services or products\n - Compatibility with event goals and values\n - Sustainability practices\n - Customer reviews and references\n\n3. **Create Contract Templates**:\n Design standard contract templates that outline:\n - Scope of work\n - Deliverables\n - Timeline and milestones\n - Payment terms\n - Cancellation and refund policies\n - Liability and insurance requirements\n - Confidentiality and data protection clauses\n\n4. **Develop Payment Schedules**:\n Establish payment schedules for each vendor category (e.g., venue rental, catering, entertainment, transportation, technology). Consider:\n - Deposit amounts and due dates\n - Progress payments tied to milestones\n - Final payments upon completion\n - Payment methods and invoicing procedures\n\n5. **Design Evaluation Forms**:\n Create evaluation forms to assess vendor performance. Include sections for:\n - Quality of services or products\n - Timeliness and reliability\n - Professionalism and communication\n - Adherence to budget and contract terms\n - Customer feedback and satisfaction\n - Recommendations for future events\n\n6. **Compile the Vendor Management Strategy**:\n Combine all the above elements into a cohesive vendor management strategy document. Ensure it is clear, detailed, and aligned with the event's goals and constraints.\n\nYour final answer should be a comprehensive vendor management strategy document that includes selection criteria, contract templates, payment schedules, and evaluation forms.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING" - ] - }, - { - "subtask": "16. Design a technology plan with event app, AV equipment, WiFi, photography services, live streaming, and tech support. -", - "tag": "TECHNOLOGY_PLAN", - "constraints": [ - { - "constraint": "The technology plan must include event app for scheduling and messaging, AV equipment, WiFi for 300+ connections, photography services, live streaming, and tech support", - "validation_strategy": "llm" - }, - { - "constraint": "All planning must follow best practices, create memorable experiences, accommodate diverse needs, stay within budget, prioritize safety, incorporate sustainable practices, leverage technology, build excitement, and measure success", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to design a comprehensive technology plan for the corporate team-building event. This plan should ensure seamless integration of technology to enhance the event experience, facilitate smooth operations, and support all planned activities.\n\nTo accomplish this, follow these steps:\n\n1. **Event App**:\n - Design an event app that will serve as a central hub for scheduling, messaging, and real-time updates.\n - Include features such as personalized schedules, team assignments, interactive maps, and push notifications.\n - Ensure the app is user-friendly and accessible on both iOS and Android platforms.\n\n2. **AV Equipment**:\n - Plan for all necessary audio-visual equipment, including microphones, speakers, projectors, and screens.\n - Ensure that the AV setup is compatible with the venue's infrastructure and meets the requirements for presentations, workshops, and the opening ceremony.\n\n3. **WiFi**:\n - Arrange for robust WiFi coverage capable of supporting 300+ devices simultaneously.\n - Work with the venue and internet service providers to ensure reliable connectivity throughout the event.\n\n4. **Photography Services**:\n - Hire professional photographers to capture key moments during the event.\n - Plan for photo backdrops, designated photo areas, and a system for sharing photos with participants post-event.\n\n5. **Live Streaming**:\n - Set up live streaming capabilities for any sessions that need to be broadcast to remote participants or recorded for future reference.\n - Ensure high-quality video and audio streaming with minimal latency.\n\n6. **Tech Support**:\n - Assign a dedicated tech support team to troubleshoot any issues that arise during the event.\n - Provide clear contact information and a quick response protocol for technical difficulties.\n\n7. **Integration with Other Plans**:\n - Coordinate with the marketing and communication strategy to ensure the event app and other technology tools are promoted effectively.\n - Align with the registration process to integrate the event app with the online portal and on-site check-in.\n\n8. **Safety and Contingency**:\n - Include backup plans for technology failures, such as alternative AV setups and backup internet connections.\n - Ensure that all technology plans comply with the safety plan and contingency planning.\n\n9. **Budget Considerations**:\n - Estimate the costs for each technology component and ensure they fit within the overall budget.\n - Prioritize cost-effective solutions that meet the event's requirements without compromising quality.\n\n10. **Documentation**:\n - Create detailed documentation for each technology component, including setup instructions, user guides, and troubleshooting tips.\n - Share this documentation with relevant stakeholders, including event staff, vendors, and participants.\n\nUse the gathered information and previous steps to inform your technology plan. Ensure that all technology solutions are scalable, reliable, and enhance the overall event experience.\n\nFinally, compile your technology plan into a clear and concise document that can be integrated into the comprehensive event strategy document.", - "input_vars_required": [], - "depends_on": [] - }, - { - "subtask": "17. Develop a decoration strategy with signage, team colors, photo backdrops, and sustainable options. -", - "tag": "DECORATION_STRATEGY", - "constraints": [ - { - "constraint": "The decoration strategy must include signage, team colors, photo backdrops, and sustainable options", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to develop a comprehensive decoration strategy for the corporate team-building event. This strategy should focus on creating an engaging and visually appealing environment that aligns with the event's goals and themes. Follow these steps to accomplish your task:\n\n1. **Understand the Event Requirements**:\n Review the gathered information about the company, event requirements, and constraints from the previous step:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **Review the Event Schedule and Theme**:\n Ensure that the decoration strategy aligns with the event schedule and overall theme. Refer to the event schedule and other relevant plans:\n \n {{EVENT_SCHEDULE}}\n \n\n3. **Develop Signage Strategy**:\n Create a plan for signage that includes:\n - Welcome signs at the entrance\n - Directional signs for different event areas\n - Informational signs for activities and workshops\n - Team identification signs\n Ensure that all signage is clear, visually appealing, and consistent with the event's branding.\n\n4. **Design Team Colors and Identification**:\n Develop a strategy for using team colors to identify different teams. This can include:\n - Color-coded name tags and lanyards\n - Team-specific decorations and signage\n - Color-coordinated table settings and seating arrangements\n Ensure that the team colors are easily distinguishable and contribute to a cohesive visual theme.\n\n5. **Create Photo Backdrops**:\n Design photo backdrops that are visually appealing and align with the event's theme. Consider:\n - Themed backdrops for different event areas\n - Customizable backdrops that can be personalized with team names or slogans\n - Backdrops that incorporate the company's branding and colors\n Ensure that the photo backdrops are easily accessible and encourage participants to take photos.\n\n6. **Incorporate Sustainable Options**:\n Develop a strategy for incorporating sustainable decoration options. This can include:\n - Using reusable or recyclable materials\n - Choosing eco-friendly signage and backdrops\n - Implementing digital signage where possible\n - Ensuring proper waste management and recycling practices\n Ensure that the sustainable options are practical and do not compromise the visual appeal of the decorations.\n\n7. **Review and Finalize the Strategy**:\n Ensure that the decoration strategy is comprehensive and aligns with the event's goals and requirements. Make any necessary adjustments to ensure that the strategy is practical and effective.\n\nFinally, write the decoration strategy document that includes all the above elements. This document will serve as a guide for implementing the decoration strategy during the event.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING", - "EVENT_SCHEDULE" - ] - }, - { - "subtask": "18. Create an entertainment plan with live band or DJ, emcee, interactive activities, and evening games. -", - "tag": "ENTERTAINMENT_PLAN", - "constraints": [ - { - "constraint": "The entertainment plan must include live band or DJ, emcee, interactive activities, and evening games", - "validation_strategy": "llm" - }, - { - "constraint": "All planning must follow best practices, create memorable experiences, accommodate diverse needs, stay within budget, prioritize safety, incorporate sustainable practices, leverage technology, build excitement, and measure success", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to create an entertainment plan for the corporate team-building event. The plan should include a live band or DJ, an emcee, interactive activities, and evening games. Follow these steps to accomplish your task:\n\n1. **Review the Event Schedule**:\n Ensure that the entertainment plan aligns with the event schedule. You can refer to the event schedule from the previous step:\n \n {{EVENT_SCHEDULE}}\n \n\n2. **Select Entertainment Options**:\n Choose between a live band or a DJ for the event. Consider the preferences of the attendees and the overall theme of the event. Additionally, decide on an emcee who will guide the event and engage the audience.\n\n3. **Plan Interactive Activities**:\n Develop a list of interactive activities that will engage the attendees. These activities should be fun, inclusive, and align with the team-building goals of the event. Examples include trivia games, karaoke, and dance-offs.\n\n4. **Design Evening Games**:\n Create a list of evening games that will keep the attendees entertained and engaged. These games should be suitable for the time of day and the overall atmosphere of the event. Examples include casino night, poker tournaments, and photo booths.\n\n5. **Coordinate with Other Plans**:\n Ensure that the entertainment plan coordinates with other aspects of the event, such as the catering plan, technology plan, and decoration strategy. You can refer to the following plans from the previous steps:\n \n {{CATERING_PLAN}}\n \n \n {{TECHNOLOGY_PLAN}}\n \n \n {{DECORATION_STRATEGY}}\n \n\n6. **Create a Detailed Entertainment Plan**:\n Write a detailed entertainment plan that includes the following information:\n - **Live Band or DJ**: Specify the type of entertainment, the duration, and any specific requirements.\n - **Emcee**: Provide details about the emcee, including their role and responsibilities.\n - **Interactive Activities**: List the interactive activities, their duration, and any necessary equipment or setup.\n - **Evening Games**: Describe the evening games, their duration, and any specific instructions or rules.\n\nEnsure that the entertainment plan is comprehensive and covers all aspects of the event. The plan should be clear, concise, and easy to follow.\n\nFinally, provide the detailed entertainment plan as your answer.", - "input_vars_required": [], - "depends_on": [ - "EVENT_SCHEDULE", - "CATERING_PLAN", - "TECHNOLOGY_PLAN", - "DECORATION_STRATEGY" - ] - }, - { - "subtask": "19. Design a prize strategy with team prizes, individual awards, participation gifts, and raffle prizes. -", - "tag": "PRIZE_STRATEGY", - "constraints": [ - { - "constraint": "The prize strategy must include team prizes at $500, $300, and $200, individual awards, participation gifts, and raffle prizes", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to design a prize strategy for the corporate team-building event. The prize strategy should include team prizes, individual awards, participation gifts, and raffle prizes. Follow these steps to accomplish your task:\n\n1. **Understand the Event Context**:\n Review the gathered information about the company, event requirements, and constraints from the previous step:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **Define Prize Categories**:\n Identify the different categories of prizes needed for the event. These should include:\n - **Team Prizes**: Prizes for the top-performing teams, such as first, second, and third place.\n - **Individual Awards**: Recognition for outstanding individual performances or contributions.\n - **Participation Gifts**: Small gifts or tokens of appreciation for all attendees.\n - **Raffle Prizes**: Prizes to be raffled off during the event, which can be won by any attendee.\n\n3. **Determine Prize Values**:\n Based on the budget breakdown and the overall event budget, determine the appropriate values for each prize category. Ensure that the prize strategy aligns with the total estimated budget:\n \n {{BUDGET_BREAKDOWN}}\n \n\n4. **Plan Team Prizes**:\n Design a tiered prize structure for team prizes. For example:\n - **First Place Team Prize**: $500 value\n - **Second Place Team Prize**: $300 value\n - **Third Place Team Prize**: $200 value\n\n5. **Plan Individual Awards**:\n Identify criteria for individual awards, such as \"Most Innovative Idea,\" \"Best Team Player,\" or \"Outstanding Leadership.\" Determine the type and value of each individual award.\n\n6. **Plan Participation Gifts**:\n Choose small, meaningful gifts that can be given to all attendees. These could include branded merchandise, gift cards, or other tokens of appreciation.\n\n7. **Plan Raffle Prizes**:\n Select a variety of raffle prizes that appeal to a broad range of attendees. Consider including high-value items, experiences, or other exciting prizes.\n\n8. **Integrate with Event Schedule**:\n Ensure that the prize strategy aligns with the event schedule, including when and how prizes will be awarded. Review the event schedule from the previous step:\n \n {{EVENT_SCHEDULE}}\n \n\n9. **Document the Prize Strategy**:\n Compile all the information into a detailed prize strategy document. Include the following sections:\n - **Team Prizes**: Description and value of each team prize.\n - **Individual Awards**: Criteria and description of each individual award.\n - **Participation Gifts**: Description and distribution plan for participation gifts.\n - **Raffle Prizes**: Description and selection process for raffle prizes.\n\n10. **Review and Finalize**:\n Review the prize strategy to ensure it meets all event requirements and aligns with the overall event goals. Make any necessary adjustments to ensure clarity and completeness.\n\nYour final answer should be a detailed prize strategy document that includes all the above information.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING", - "BUDGET_BREAKDOWN", - "EVENT_SCHEDULE" - ] - }, - { - "subtask": "20. Develop a post-event evaluation plan with participant survey, debriefing sessions, budget reconciliation, photo compilation, impact assessment, and thank you communications. -", - "tag": "POST_EVENT_EVALUATION", - "constraints": [ - { - "constraint": "The post-event evaluation must include participant survey within 24 hours, debriefing sessions, budget reconciliation, photo compilation, impact assessment, and thank you communications", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to develop a comprehensive post-event evaluation plan for the corporate team-building event. This plan should include the following components:\n\n1. **Participant Survey**:\n - Design a survey to be sent within 24 hours of the event.\n - Include questions that assess the overall experience, specific activities, workshops, catering, and any areas for improvement.\n - Ensure the survey is concise, easy to complete, and covers all key aspects of the event.\n\n2. **Debriefing Sessions**:\n - Plan debriefing sessions with the event planning team and key stakeholders.\n - Schedule these sessions within a week after the event to discuss what went well, what could be improved, and any lessons learned.\n - Document the outcomes of these sessions for future reference.\n\n3. **Budget Reconciliation**:\n - Compare the actual expenses with the estimated budget.\n - Identify any budget overruns or savings.\n - Provide a detailed report on the financial performance of the event.\n\n4. **Photo Compilation**:\n - Gather all photos taken during the event.\n - Create a digital album or slideshow to share with participants and stakeholders.\n - Ensure the photos are organized and easily accessible.\n\n5. **Impact Assessment**:\n - Evaluate the impact of the event on team cohesion, cross-departmental collaboration, and morale.\n - Use feedback from the participant survey and debriefing sessions to assess the event's success.\n - Provide a summary of the event's overall impact and any measurable outcomes.\n\n6. **Thank You Communications**:\n - Prepare thank-you messages for all participants, vendors, and stakeholders.\n - Include a brief summary of the event's success and express gratitude for their contributions.\n - Send these communications within a week after the event.\n\nTo accomplish this task, follow these steps:\n\n1. **Review Event Details**:\n - Refer to the gathered information about the company, event requirements, and constraints:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **Design the Participant Survey**:\n - Create a survey that covers all key aspects of the event.\n - Ensure the survey is user-friendly and can be completed quickly.\n\n3. **Plan Debriefing Sessions**:\n - Schedule sessions with the event planning team and key stakeholders.\n - Prepare an agenda for each session to ensure productive discussions.\n\n4. **Conduct Budget Reconciliation**:\n - Compare actual expenses with the estimated budget.\n - Identify any discrepancies and document the findings.\n\n5. **Compile Photos**:\n - Gather all photos from the event.\n - Organize them into a digital album or slideshow.\n\n6. **Assess Impact**:\n - Use feedback from the survey and debriefing sessions to evaluate the event's impact.\n - Provide a summary of the event's success and any measurable outcomes.\n\n7. **Prepare Thank You Communications**:\n - Draft thank-you messages for participants, vendors, and stakeholders.\n - Include a brief summary of the event's success and express gratitude.\n\n8. **Compile the Post-Event Evaluation Plan**:\n - Combine all the components into a comprehensive post-event evaluation plan.\n - Ensure the plan is clear, detailed, and ready for implementation.\n\nYour final answer should be the complete post-event evaluation plan, including all the components mentioned above.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING" - ] - }, - { - "subtask": "21. Create an accessibility plan with ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation. -", - "tag": "ACCESSIBILITY_PLAN", - "constraints": [ - { - "constraint": "The accessibility plan must include ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to create an accessibility plan for the corporate team-building event. This plan should ensure that the event is inclusive and accommodates the diverse needs of all attendees. Follow these steps to accomplish your task:\n\n1. **Understand the Requirements**:\n Review the gathered information about the company and event requirements to understand the specific needs and constraints related to accessibility:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **ADA Compliance**:\n Ensure that the event venue and all activities comply with the Americans with Disabilities Act (ADA) standards. This includes:\n - Accessible entry points and pathways\n - Adequate space for mobility devices\n - Accessible restrooms\n - Clear signage and directions\n\n3. **Interpreters and Assistive Technology**:\n Plan for the provision of interpreters for attendees who are deaf or hard of hearing. Additionally, consider any assistive technology that may be required, such as:\n - Hearing assistance devices\n - Visual aids\n - Braille materials\n\n4. **Activity Modifications**:\n Modify activities to ensure they are accessible to all attendees. This may include:\n - Providing alternative activities for those who cannot participate in certain events\n - Adjusting the difficulty level of activities\n - Ensuring that all activities can be performed by individuals with varying abilities\n\n5. **Dietary Accommodation**:\n Accommodate dietary restrictions and preferences by:\n - Offering a variety of food options that cater to different dietary needs (e.g., vegetarian, vegan, gluten-free, allergies)\n - Clearly labeling all food items with allergen information\n - Providing a pre-event survey to gather dietary information from attendees\n\n6. **Inclusive Team Formation**:\n Ensure that teams are formed inclusively by:\n - Mixing departments and seniority levels\n - Considering the abilities and preferences of each attendee\n - Providing clear team assignments and communication channels\n\n7. **Safety and Emergency Procedures**:\n Develop safety and emergency procedures that are accessible to all attendees. This includes:\n - Clear evacuation routes and procedures\n - Accessible first aid stations\n - Emergency contact information\n\n8. **Communication Plan**:\n Create a communication plan that ensures all attendees are informed about accessibility options and how to access them. This may include:\n - Including accessibility information in event materials\n - Providing a dedicated point of contact for accessibility-related questions\n - Using multiple communication channels (e.g., email, event app, Slack)\n\n9. **Review and Finalize**:\n Review the accessibility plan to ensure it meets all requirements and addresses the diverse needs of the attendees. Make any necessary adjustments and finalize the plan.\n\nYour final answer should be a comprehensive accessibility plan that includes all the elements outlined above.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING" - ] - }, - { - "subtask": "22. Create a contingency plan for weather emergencies, vendor cancellations, technology failures, medical emergencies, and budget overruns. -", - "tag": "CONTINGENCY_PLANNING", - "constraints": [ - { - "constraint": "The contingency planning must include weather emergencies, vendor cancellations, technology failures, medical emergencies, and budget overruns", - "validation_strategy": "llm" - }, - { - "constraint": "All planning must follow best practices, create memorable experiences, accommodate diverse needs, stay within budget, prioritize safety, incorporate sustainable practices, leverage technology, build excitement, and measure success", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to create a comprehensive contingency plan for the corporate team-building event. This plan should address potential risks and ensure the event can proceed smoothly despite unforeseen circumstances. Follow these steps to accomplish your task:\n\n1. **Identify Potential Risks**:\n - **Weather Emergencies**: Consider the possibility of extreme weather conditions that could disrupt the event. Think about both indoor and outdoor activities.\n - **Vendor Cancellations**: Identify key vendors and the impact of their cancellation on the event.\n - **Technology Failures**: Consider the technology requirements for the event and potential failures that could occur.\n - **Medical Emergencies**: Plan for any medical emergencies that might arise during the event.\n - **Budget Overruns**: Identify areas where budget overruns might occur and plan for alternative solutions.\n\n2. **Develop Contingency Strategies**:\n - **Weather Emergencies**:\n - **Indoor Activities**: Have a backup plan for moving outdoor activities indoors.\n - **Outdoor Activities**: Consider alternative dates or locations if necessary.\n - **Communication**: Develop a communication plan to inform attendees of any changes due to weather.\n - **Vendor Cancellations**:\n - **Backup Vendors**: Identify and contract backup vendors for critical services.\n - **Alternative Solutions**: Develop alternative solutions for essential services.\n - **Technology Failures**:\n - **Backup Equipment**: Ensure backup AV equipment and tech support are available.\n - **Manual Processes**: Have manual processes in place in case of technology failures.\n - **Medical Emergencies**:\n - **First Aid Stations**: Ensure adequate first aid stations and trained personnel are available.\n - **Emergency Protocols**: Develop clear protocols for handling medical emergencies.\n - **Budget Overruns**:\n - **Cost-Saving Measures**: Identify areas where costs can be reduced without compromising the event.\n - **Contingency Fund**: Allocate a contingency fund to cover unexpected expenses.\n\n3. **Implement and Monitor**:\n - **Implementation**: Ensure all contingency plans are implemented as part of the overall event strategy.\n - **Monitoring**: Continuously monitor the event for any signs of the identified risks and be prepared to activate the contingency plans as needed.\n\n4. **Documentation**:\n - **Contingency Plan Document**: Create a detailed contingency plan document that includes all the strategies developed. This document should be part of the comprehensive event strategy document.\n\n5. **Review and Update**:\n - **Regular Reviews**: Regularly review and update the contingency plan as the event approaches to ensure it remains relevant and effective.\n\nUse the information gathered in the previous steps to inform your contingency planning. Ensure that all aspects of the event are covered and that the contingency plans are practical and feasible.\n\nFinally, compile the contingency plan into a clear and concise document that can be easily referenced during the event planning and execution phases.", - "input_vars_required": [], - "depends_on": [] - }, - { - "subtask": "23. Develop a sustainability plan with eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management. -", - "tag": "SUSTAINABILITY_PLAN", - "constraints": [ - { - "constraint": "The sustainability plan must include eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management", - "validation_strategy": "llm" - }, - { - "constraint": "All planning must follow best practices, create memorable experiences, accommodate diverse needs, stay within budget, prioritize safety, incorporate sustainable practices, leverage technology, build excitement, and measure success", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to develop a comprehensive sustainability plan for the corporate team-building event. This plan should focus on minimizing the environmental impact of the event while ensuring a memorable and enjoyable experience for all participants.\n\nTo accomplish this, follow these steps:\n\n1. **Understand the Event Requirements**:\n Review the gathered information about the company, event requirements, and constraints:\n \n {{INFORMATION_GATHERING}}\n \n\n2. **Identify Key Sustainability Areas**:\n Focus on the following key areas to create a sustainable event:\n - **Eco-friendly Venue**: Select a venue that has eco-friendly practices, such as energy-efficient lighting, waste reduction programs, and sustainable building materials.\n - **Local Catering**: Partner with local caterers who source ingredients locally and use sustainable practices. Ensure they offer diverse menu options that accommodate dietary restrictions.\n - **Reusable Serving Ware**: Use reusable or compostable serving ware to minimize waste. Avoid single-use plastics and encourage the use of reusable cups, plates, and cutlery.\n - **Digital Communications**: Utilize digital communications for invitations, reminders, and event information to reduce paper waste. Create a mobile event app for scheduling and messaging.\n - **Recyclable Decorations**: Choose decorations that are recyclable or made from sustainable materials. Avoid non-biodegradable materials and opt for eco-friendly alternatives.\n - **Waste Management**: Implement a comprehensive waste management plan that includes recycling stations, composting, and proper disposal of waste. Educate participants on the importance of waste reduction and proper disposal methods.\n\n3. **Develop Detailed Strategies**:\n For each key area, develop detailed strategies that outline the steps to be taken, the resources required, and the expected outcomes. Ensure that the strategies align with the overall event goals and constraints.\n\n4. **Create a Sustainability Timeline**:\n Integrate the sustainability plan into the overall event timeline. Ensure that sustainability initiatives are scheduled appropriately and that all necessary actions are taken in a timely manner.\n\n5. **Budget Considerations**:\n Review the budget breakdown to ensure that the sustainability plan is cost-effective and aligns with the total estimated budget:\n \n {{BUDGET_BREAKDOWN}}\n \n\n6. **Communication Plan**:\n Develop a communication plan to inform participants about the sustainability initiatives. Use the marketing and communication strategy to promote the event's eco-friendly practices:\n \n {{MARKETING_STRATEGY}}\n \n\n7. **Vendor Management**:\n Ensure that all vendors adhere to the sustainability plan. Include sustainability criteria in the vendor selection process and monitor their compliance throughout the event:\n \n {{VENDOR_MANAGEMENT}}\n \n\n8. **Post-Event Evaluation**:\n Include sustainability metrics in the post-event evaluation plan. Assess the effectiveness of the sustainability initiatives and identify areas for improvement in future events:\n \n {{POST_EVENT_EVALUATION}}\n \n\n9. **Contingency Planning**:\n Develop contingency plans for potential sustainability challenges, such as waste management issues or vendor non-compliance. Ensure that the contingency planning aligns with the overall event strategy:\n \n {{CONTINGENCY_PLANNING}}\n \n\n10. **Finalize the Sustainability Plan**:\n Compile all the information into a detailed sustainability plan that outlines the strategies, timelines, budget considerations, communication plans, vendor management, post-event evaluation, and contingency planning.\n\nEnsure that the sustainability plan is integrated into the comprehensive event strategy document and that all planning follows best practices, creates memorable experiences, accommodates diverse needs, stays within budget, prioritizes safety, incorporates sustainable practices, leverages technology, builds excitement, and measures success.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING", - "BUDGET_BREAKDOWN", - "MARKETING_STRATEGY", - "VENDOR_MANAGEMENT", - "POST_EVENT_EVALUATION", - "CONTINGENCY_PLANNING" - ] - }, - { - "subtask": "24. Compile all the information into a comprehensive event strategy document. -", - "tag": "EVENT_STRATEGY_DOCUMENT", - "constraints": [ - { - "constraint": "The event strategy document must include detailed planning timelines starting 6 months before the event with weekly milestones", - "validation_strategy": "llm" - }, - { - "constraint": "The budget breakdowns must include venue rental at $15,000-25,000, catering at $75-125 per person, entertainment and activities at $10,000-20,000, transportation at $3,000-8,000, technology at $5,000-10,000, and total estimated budget of $50,000-125,000", - "validation_strategy": "code" - }, - { - "constraint": "The marketing and communication strategy must include save-the-date announcements 4 months in advance, formal invitations 2 months before, weekly reminder emails, internal campaigns, dedicated Slack channel, executive videos, and mobile event app", - "validation_strategy": "llm" - }, - { - "constraint": "The venue selection process must evaluate 10 venues based on capacity for 100-300 people, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi for 300+ devices, catering facilities, accommodations, and cost-effectiveness", - "validation_strategy": "llm" - }, - { - "constraint": "The event schedule must include registration and breakfast at 8:00-9:00 AM, opening ceremony at 9:00-9:30 AM with CEO speech, icebreaker activities at 9:30-10:30 AM including human bingo and speed networking, morning workshops at 10:30 AM-12:30 PM with tracks on leadership, innovation, communication, and wellness, lunch at 12:30-2:00 PM with diverse menu options, afternoon team challenges at 2:00-5:00 PM including scavenger hunt, escape rooms, outdoor adventures, cooking competition, and sports tournaments, awards ceremony at 5:00-5:30 PM, and dinner with entertainment at 5:30-8:00 PM", - "validation_strategy": "llm" - }, - { - "constraint": "The icebreaker plans must include 15 options including human knot, marshmallow tower, obstacle course, pictionary, charades, and trust falls", - "validation_strategy": "llm" - }, - { - "constraint": "The team formation strategy must include diverse mix of departments and seniority in teams of 8-12 people, pre-event survey for dietary restrictions and preferences, and team assignments 2 weeks before with names and colors", - "validation_strategy": "llm" - }, - { - "constraint": "The workshop content must include leadership case studies, innovation brainstorming, communication exercises, and wellness meditation", - "validation_strategy": "llm" - }, - { - "constraint": "The catering plan must include breakfast coffee station and pastries, lunch buffet with salad bar and hot entrees, afternoon snacks, and dinner with three entree choices and full bar", - "validation_strategy": "llm" - }, - { - "constraint": "The activity logistics must include equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules", - "validation_strategy": "llm" - }, - { - "constraint": "The transportation plan must include charter buses, parking management, shuttle service, and contingency plans", - "validation_strategy": "llm" - }, - { - "constraint": "The registration process must include online portal, on-site check-in, name tags, welcome packets with schedule and swag, and staff training", - "validation_strategy": "llm" - }, - { - "constraint": "The safety plan must include insurance, first aid stations, evacuation procedures, weather contingencies, food safety with allergen labeling, security personnel, and incident reporting", - "validation_strategy": "llm" - }, - { - "constraint": "The vendor management strategy must include selection criteria, contracts, payment schedules, and evaluation forms", - "validation_strategy": "llm" - }, - { - "constraint": "The technology plan must include event app for scheduling and messaging, AV equipment, WiFi for 300+ connections, photography services, live streaming, and tech support", - "validation_strategy": "llm" - }, - { - "constraint": "The decoration strategy must include signage, team colors, photo backdrops, and sustainable options", - "validation_strategy": "llm" - }, - { - "constraint": "The entertainment plan must include live band or DJ, emcee, interactive activities, and evening games", - "validation_strategy": "llm" - }, - { - "constraint": "The prize strategy must include team prizes at $500, $300, and $200, individual awards, participation gifts, and raffle prizes", - "validation_strategy": "llm" - }, - { - "constraint": "The post-event evaluation must include participant survey within 24 hours, debriefing sessions, budget reconciliation, photo compilation, impact assessment, and thank you communications", - "validation_strategy": "llm" - }, - { - "constraint": "The accessibility plan must include ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation", - "validation_strategy": "llm" - }, - { - "constraint": "The sustainability plan must include eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management", - "validation_strategy": "llm" - }, - { - "constraint": "The contingency planning must include weather emergencies, vendor cancellations, technology failures, medical emergencies, and budget overruns", - "validation_strategy": "llm" - }, - { - "constraint": "All planning must follow best practices, create memorable experiences, accommodate diverse needs, stay within budget, prioritize safety, incorporate sustainable practices, leverage technology, build excitement, and measure success", - "validation_strategy": "llm" - } - ], - "prompt_template": "Your task is to compile all the information gathered and planned in the previous steps into a comprehensive event strategy document. This document will serve as the blueprint for executing the corporate team-building event.\n\nTo accomplish this, follow these steps:\n\n1. **Review All Previous Steps**:\n Carefully review the information and plans developed in the previous steps. This includes:\n - Information Gathering: {{INFORMATION_GATHERING}}\n - Planning Timeline: {{PLANNING_TIMELINE}}\n - Budget Breakdown: {{BUDGET_BREAKDOWN}}\n - Marketing Strategy: {{MARKETING_STRATEGY}}\n - Venue Selection: {{VENUE_SELECTION}}\n - Event Schedule: {{EVENT_SCHEDULE}}\n - Icebreaker Plans: {{ICEBREAKER_PLANS}}\n - Team Formation: {{TEAM_FORMATION}}\n - Workshop Content: {{WORKSHOP_CONTENT}}\n - Catering Plan: {{CATERING_PLAN}}\n - Activity Logistics: {{ACTIVITY_LOGISTICS}}\n - Transportation Plan: {{TRANSPORTATION_PLAN}}\n - Registration Process: {{REGISTRATION_PROCESS}}\n - Safety Plan: {{SAFETY_PLAN}}\n - Vendor Management: {{VENDOR_MANAGEMENT}}\n - Technology Plan: {{TECHNOLOGY_PLAN}}\n - Decoration Strategy: {{DECORATION_STRATEGY}}\n - Entertainment Plan: {{ENTERTAINMENT_PLAN}}\n - Prize Strategy: {{PRIZE_STRATEGY}}\n - Post-Event Evaluation: {{POST_EVENT_EVALUATION}}\n - Accessibility Plan: {{ACCESSIBILITY_PLAN}}\n - Sustainability Plan: {{SUSTAINABILITY_PLAN}}\n - Contingency Planning: {{CONTINGENCY_PLANNING}}\n\n2. **Organize the Information**:\n Structure the event strategy document in a logical and coherent manner. Use clear headings and subheadings to organize the content. Here is a suggested structure:\n - **Executive Summary**: A brief overview of the event's objectives, key highlights, and expected outcomes.\n - **Event Overview**: Detailed description of the event, including its purpose, goals, and target audience.\n - **Planning Timeline**: The detailed planning timeline starting 6 months before the event with weekly milestones.\n - **Budget Breakdown**: Comprehensive breakdown of the budget for venue rental, catering, entertainment, transportation, technology, and total estimated budget.\n - **Marketing and Communication Strategy**: Detailed strategy for save-the-date announcements, formal invitations, reminder emails, internal campaigns, and other communication methods.\n - **Venue Selection**: Process for evaluating and selecting the best venue based on capacity, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi, catering facilities, accommodations, and cost-effectiveness.\n - **Event Schedule**: Detailed event schedule from 8:00 AM to 8:00 PM including registration, breakfast, opening ceremony, icebreaker activities, workshops, lunch, team challenges, awards ceremony, and dinner with entertainment.\n - **Icebreaker Activities**: List of 15 icebreaker activities with detailed plans.\n - **Team Formation Strategy**: Strategy for forming diverse teams with a mix of departments and seniority, pre-event survey for dietary restrictions, and team assignments 2 weeks before the event.\n - **Workshop Content**: Content for leadership, innovation, communication, and wellness workshops.\n - **Catering Plan**: Detailed catering plan with breakfast, lunch, afternoon snacks, and dinner options.\n - **Activity Logistics**: Logistics for all planned activities including equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules.\n - **Transportation Plan**: Plan for charter buses, parking management, shuttle service, and contingency plans.\n - **Registration Process**: Process for online portal, on-site check-in, name tags, welcome packets, and staff training.\n - **Safety Plan**: Comprehensive safety plan including insurance, first aid stations, evacuation procedures, weather contingencies, food safety, security personnel, and incident reporting.\n - **Vendor Management**: Strategy for vendor selection, contracts, payment schedules, and evaluation forms.\n - **Technology Plan**: Plan for event app, AV equipment, WiFi, photography services, live streaming, and tech support.\n - **Decoration Strategy**: Strategy for signage, team colors, photo backdrops, and sustainable options.\n - **Entertainment Plan**: Plan for live band or DJ, emcee, interactive activities, and evening games.\n - **Prize Strategy**: Strategy for team prizes, individual awards, participation gifts, and raffle prizes.\n - **Post-Event Evaluation**: Plan for participant survey, debriefing sessions, budget reconciliation, photo compilation, impact assessment, and thank you communications.\n - **Accessibility Plan**: Plan for ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation.\n - **Sustainability Plan**: Plan for eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management.\n - **Contingency Planning**: Plan for weather emergencies, vendor cancellations, technology failures, medical emergencies, and budget overruns.\n\n3. **Compile the Document**:\n Combine all the organized information into a single, cohesive document. Ensure that the document is well-structured, easy to read, and includes all necessary details for executing the event.\n\n4. **Review and Finalize**:\n Review the compiled document to ensure accuracy, completeness, and clarity. Make any necessary adjustments to ensure that the document meets all requirements and standards.\n\n5. **Output the Event Strategy Document**:\n Provide the final event strategy document as your answer. Ensure that the document is well-formatted and ready for use.", - "input_vars_required": [], - "depends_on": [ - "INFORMATION_GATHERING", - "PLANNING_TIMELINE", - "BUDGET_BREAKDOWN", - "MARKETING_STRATEGY", - "VENUE_SELECTION", - "EVENT_SCHEDULE", - "ICEBREAKER_PLANS", - "TEAM_FORMATION", - "WORKSHOP_CONTENT", - "CATERING_PLAN", - "ACTIVITY_LOGISTICS", - "TRANSPORTATION_PLAN", - "REGISTRATION_PROCESS", - "SAFETY_PLAN", - "VENDOR_MANAGEMENT", - "TECHNOLOGY_PLAN", - "DECORATION_STRATEGY", - "ENTERTAINMENT_PLAN", - "PRIZE_STRATEGY", - "POST_EVENT_EVALUATION", - "ACCESSIBILITY_PLAN", - "SUSTAINABILITY_PLAN", - "CONTINGENCY_PLANNING" - ] - } - ] -} \ No newline at end of file diff --git a/docs/examples/m_decompose/m_decomp_result.py b/docs/examples/m_decompose/m_decomp_result.py deleted file mode 100644 index 0c845ab9f..000000000 --- a/docs/examples/m_decompose/m_decomp_result.py +++ /dev/null @@ -1,1785 +0,0 @@ -# pytest: skip_always -# Note: This is an example of an intermediary result from using decompose, not an example of how to use decompose. - -import textwrap - -import mellea - -if __name__ == "__main__": - m = mellea.start_session() - - # 1. Gather all necessary information about the company, event requirements, and constraints. - - INFORMATION_GATHERING - information_gathering = m.instruct( - textwrap.dedent( - R""" - To gather all necessary information about the company, event requirements, and constraints, follow these steps: - - 1. **Company Information**: - - **Company Size**: Determine the number of employees (100-300). - - **Departments**: Identify the different departments within the company. - - **Employee Demographics**: Gather information about the diversity of employees, including age, seniority, and roles. - - **Company Culture**: Understand the company's values, mission, and current team dynamics. - - 2. **Event Requirements**: - - **Objectives**: Clearly define the goals of the event, such as strengthening team cohesion, improving cross-departmental collaboration, boosting morale, and creating lasting memories. - - **Event Type**: Specify the type of event (e.g., corporate team-building event). - - **Duration**: Determine the start and end times of the event (8:00 AM to 8:00 PM). - - **Key Activities**: List the key activities planned for the event, such as registration, breakfast, opening ceremony, icebreaker activities, workshops, lunch, team challenges, awards ceremony, and dinner with entertainment. - - 3. **Event Constraints**: - - **Budget**: Identify the budget constraints for different aspects of the event, including venue rental ($15,000-25,000), catering ($75-125 per person), entertainment and activities ($10,000-20,000), transportation ($3,000-8,000), technology ($5,000-10,000), and total estimated budget ($50,000-125,000). - - **Venue Requirements**: Specify the venue requirements, such as capacity for 100-300 people, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi for 300+ devices, catering facilities, accommodations, and cost-effectiveness. - - **Safety and Accessibility**: Ensure the event follows best practices for safety, accessibility, and sustainability. - - **Technology**: Identify the technology requirements, such as event app for scheduling and messaging, AV equipment, WiFi for 300+ connections, photography services, live streaming, and tech support. - - 4. **Additional Information**: - - **Marketing and Communication**: Gather information about the marketing and communication strategy, including save-the-date announcements, formal invitations, reminder emails, internal campaigns, dedicated Slack channel, executive videos, and mobile event app. - - **Team Formation**: Understand the team formation strategy, including diverse mix of departments and seniority, pre-event survey for dietary restrictions and preferences, and team assignments 2 weeks before the event. - - **Workshop Content**: Identify the content for leadership, innovation, communication, and wellness workshops. - - **Catering Plan**: Gather information about the catering plan, including breakfast, lunch, afternoon snacks, and dinner options. - - **Activity Logistics**: Understand the logistics for all planned activities, including equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules. - - **Transportation Plan**: Gather information about the transportation plan, including charter buses, parking management, shuttle service, and contingency plans. - - **Registration Process**: Understand the registration process, including online portal, on-site check-in, name tags, welcome packets, and staff training. - - **Safety Plan**: Gather information about the safety plan, including insurance, first aid stations, evacuation procedures, weather contingencies, food safety, security personnel, and incident reporting. - - **Vendor Management**: Understand the vendor management strategy, including selection criteria, contracts, payment schedules, and evaluation forms. - - **Technology Plan**: Gather information about the technology plan, including event app, AV equipment, WiFi, photography services, live streaming, and tech support. - - **Decoration Strategy**: Understand the decoration strategy, including signage, team colors, photo backdrops, and sustainable options. - - **Entertainment Plan**: Gather information about the entertainment plan, including live band or DJ, emcee, interactive activities, and evening games. - - **Prize Strategy**: Understand the prize strategy, including team prizes, individual awards, participation gifts, and raffle prizes. - - **Post-Event Evaluation**: Gather information about the post-event evaluation plan, including participant survey, debriefing sessions, budget reconciliation, photo compilation, impact assessment, and thank you communications. - - **Accessibility Plan**: Understand the accessibility plan, including ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation. - - **Sustainability Plan**: Gather information about the sustainability plan, including eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management. - - **Contingency Planning**: Understand the contingency planning for weather emergencies, vendor cancellations, technology failures, medical emergencies, and budget overruns. - - 5. **Documentation**: - - Compile all the gathered information into a comprehensive document that will serve as the basis for the event strategy document. - - By following these steps, you will gather all necessary information about the company, event requirements, and constraints to ensure a successful and well-organized corporate team-building event. - """.strip() - ), - requirements=[ - "The budget breakdowns must include venue rental at $15,000-25,000, catering at $75-125 per person, entertainment and activities at $10,000-20,000, transportation at $3,000-8,000, technology at $5,000-10,000, and total estimated budget of $50,000-125,000", - "The venue selection process must evaluate 10 venues based on capacity for 100-300 people, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi for 300+ devices, catering facilities, accommodations, and cost-effectiveness", - "The safety plan must include insurance, first aid stations, evacuation procedures, weather contingencies, food safety with allergen labeling, security personnel, and incident reporting", - "The accessibility plan must include ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation", - "The sustainability plan must include eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management", - "All planning must follow best practices, create memorable experiences, accommodate diverse needs, stay within budget, prioritize safety, incorporate sustainable practices, leverage technology, build excitement, and measure success", - ], - ) - assert information_gathering.value is not None, ( - 'ERROR: task "information_gathering" execution failed' - ) - - # 2. Create a detailed planning timeline starting 6 months before the event with weekly milestones. - - PLANNING_TIMELINE - planning_timeline = m.instruct( - textwrap.dedent( - R""" - Your task is to create a detailed planning timeline starting 6 months before the event with weekly milestones. Follow these steps to accomplish your task: - - First, review the gathered information about the company, event requirements, and constraints from the previous step: - - {{INFORMATION_GATHERING}} - - - Next, consider the key components of the event that need to be planned, such as venue selection, marketing and communication, team formation, workshops, catering, activities, transportation, registration, safety, vendor management, technology, decorations, entertainment, prizes, post-event evaluation, accessibility, sustainability, and contingency planning. - - Break down the planning process into weekly milestones starting 6 months before the event. Ensure that each milestone is specific, measurable, achievable, relevant, and time-bound (SMART). - - Here is a suggested structure for the planning timeline: - - **6 Months Before the Event:** - - Finalize event objectives and key performance indicators (KPIs). - - Establish the event budget and allocate funds to different categories. - - Develop a high-level event plan and timeline. - - Identify and assemble the event planning team. - - Begin researching and evaluating potential venues. - - **5 Months Before the Event:** - - Select and book the venue. - - Develop a detailed event schedule and share it with key stakeholders. - - Create a marketing and communication strategy. - - Begin designing the event branding and promotional materials. - - Start planning the team formation strategy. - - **4 Months Before the Event:** - - Send save-the-date announcements to employees. - - Finalize the event schedule and share it with vendors and participants. - - Develop the workshop content and identify facilitators. - - Create a catering plan and send out a pre-event survey for dietary restrictions. - - Begin planning the icebreaker activities. - - **3 Months Before the Event:** - - Send formal invitations to employees. - - Finalize the team formation strategy and assign teams. - - Develop the activity logistics and equipment lists. - - Create a transportation plan and arrange charter buses if necessary. - - Design the registration process and set up the online portal. - - **2 Months Before the Event:** - - Send weekly reminder emails to employees. - - Finalize the catering plan and confirm menu options. - - Develop the safety plan and evacuation procedures. - - Create a vendor management strategy and finalize contracts. - - Design the technology plan and arrange AV equipment. - - **1 Month Before the Event:** - - Send team assignments and welcome packets to employees. - - Finalize the decoration strategy and order necessary materials. - - Develop the entertainment plan and book a live band or DJ. - - Create a prize strategy and order prizes. - - Finalize the post-event evaluation plan. - - **2 Weeks Before the Event:** - - Conduct a final walkthrough of the venue. - - Train staff on the registration process and safety protocols. - - Finalize the accessibility plan and make necessary accommodations. - - Develop a sustainability plan and implement eco-friendly practices. - - Create a contingency plan for potential emergencies. - - **1 Week Before the Event:** - - Send a final reminder email to employees. - - Confirm all vendor arrangements and payment schedules. - - Finalize the event schedule and share it with participants. - - Prepare the welcome packets and name tags. - - Conduct a final review of the event strategy document. - - Ensure that the planning timeline is comprehensive and covers all aspects of the event. The timeline should be flexible and allow for adjustments as needed. - - Finally, write the detailed planning timeline starting 6 months before the event with weekly milestones. Your answer will serve as basis for the next steps. - """.strip() - ), - requirements=[ - "The event strategy document must include detailed planning timelines starting 6 months before the event with weekly milestones" - ], - user_variables={"INFORMATION_GATHERING": information_gathering.value}, - ) - assert planning_timeline.value is not None, ( - 'ERROR: task "planning_timeline" execution failed' - ) - - # 3. Develop a budget breakdown for venue rental, catering, entertainment, transportation, technology, and total estimated budget. - - BUDGET_BREAKDOWN - budget_breakdown = m.instruct( - textwrap.dedent( - R""" - Your task is to develop a detailed budget breakdown for the corporate team-building event. This budget should include estimates for venue rental, catering, entertainment, transportation, technology, and the total estimated budget. - - To accomplish this, follow these steps: - - 1. **Review Gathered Information**: - First, review the information gathered about the company, event requirements, and constraints. This information will help you understand the scope and specific needs of the event: - - {{INFORMATION_GATHERING}} - - - 2. **Understand Budget Constraints**: - The event has specific budget constraints for each category: - - **Venue Rental**: $15,000 - $25,000 - - **Catering**: $75 - $125 per person - - **Entertainment and Activities**: $10,000 - $20,000 - - **Transportation**: $3,000 - $8,000 - - **Technology**: $5,000 - $10,000 - - **Total Estimated Budget**: $50,000 - $125,000 - - 3. **Calculate Catering Costs**: - The catering cost is per person. The event will have 100-300 employees attending. Calculate the total catering cost based on the number of attendees and the per-person cost. - - 4. **Estimate Other Costs**: - Provide a detailed estimate for each of the remaining categories (venue rental, entertainment, transportation, and technology) within the specified budget ranges. - - 5. **Summarize Total Estimated Budget**: - Add up the estimated costs for each category to provide a total estimated budget for the event. Ensure that the total estimated budget falls within the specified range of $50,000 - $125,000. - - 6. **Provide Detailed Breakdown**: - Present the budget breakdown in a clear and organized manner. Include the following information for each category: - - **Category**: Name of the budget category (e.g., Venue Rental) - - **Estimated Cost**: The estimated cost for that category - - **Notes**: Any additional notes or considerations for that category - - 7. **Review and Adjust**: - Review your budget breakdown to ensure it is accurate and aligns with the event's requirements and constraints. Make any necessary adjustments to ensure the total estimated budget is within the specified range. - - 8. **Final Answer**: - Provide the detailed budget breakdown as your final answer. Ensure it is clear, concise, and adheres to the specified budget constraints. - - Example Format: - - **Venue Rental**: $20,000 - - Notes: Includes rental fee for the venue and basic setup. - - **Catering**: $25,000 - - Notes: Based on 200 attendees at $125 per person. - - **Entertainment and Activities**: $15,000 - - Notes: Includes costs for activities and entertainment. - - **Transportation**: $5,000 - - Notes: Includes charter buses and shuttle service. - - **Technology**: $7,000 - - Notes: Includes AV equipment, WiFi, and tech support. - - **Total Estimated Budget**: $72,000 - """.strip() - ), - requirements=[ - "The budget breakdowns must include venue rental at $15,000-25,000, catering at $75-125 per person, entertainment and activities at $10,000-20,000, transportation at $3,000-8,000, technology at $5,000-10,000, and total estimated budget of $50,000-125,000" - ], - user_variables={"INFORMATION_GATHERING": information_gathering.value}, - ) - assert budget_breakdown.value is not None, ( - 'ERROR: task "budget_breakdown" execution failed' - ) - - # 4. Design a marketing and communication strategy including save-the-date announcements, formal invitations, reminder emails, internal campaigns, and other communication methods. - - MARKETING_STRATEGY - marketing_strategy = m.instruct( - textwrap.dedent( - R""" - Your task is to design a comprehensive marketing and communication strategy for a corporate team-building event. This strategy should ensure effective engagement and participation from all employees. Follow these steps to accomplish your task: - - 1. **Review Gathered Information**: - Begin by reviewing the information gathered about the company, event requirements, and constraints. This will help you tailor the marketing and communication strategy to the specific needs and preferences of the employees: - - {{INFORMATION_GATHERING}} - - - 2. **Understand the Planning Timeline**: - Familiarize yourself with the planning timeline to ensure that all marketing and communication activities are scheduled appropriately. This will help you create a timeline for save-the-date announcements, formal invitations, reminder emails, and internal campaigns: - - {{PLANNING_TIMELINE}} - - - 3. **Budget Considerations**: - Consider the budget breakdown to ensure that the marketing and communication strategy is cost-effective and aligns with the overall budget for the event: - - {{BUDGET_BREAKDOWN}} - - - 4. **Develop the Marketing and Communication Strategy**: - Create a detailed marketing and communication strategy that includes the following components: - - - **Save-the-Date Announcements**: - Plan to send save-the-date announcements 4 months in advance. These announcements should be sent via email and should include the event date, purpose, and a brief overview of what to expect. - - - **Formal Invitations**: - Design formal invitations to be sent 2 months before the event. These invitations should include detailed information about the event schedule, dress code, and any specific instructions or requirements. - - - **Weekly Reminder Emails**: - Schedule weekly reminder emails leading up to the event. These emails should provide updates, reminders, and any additional information that may be relevant to the participants. - - - **Internal Campaigns**: - Develop internal campaigns to build excitement and engagement. These campaigns can include posters, flyers, and announcements on internal communication platforms. - - - **Dedicated Slack Channel**: - Create a dedicated Slack channel for event-related discussions, updates, and announcements. This channel will serve as a central hub for all event-related communication. - - - **Executive Videos**: - Plan to create and share videos featuring executive messages about the event. These videos can be shared via email, internal communication platforms, and the dedicated Slack channel. - - - **Mobile Event App**: - Develop a mobile event app that provides participants with access to the event schedule, maps, speaker information, and other relevant details. The app should also include features for messaging and networking. - - 5. **Ensure Consistency and Clarity**: - Ensure that all marketing and communication materials are consistent in tone, style, and branding. This will help create a cohesive and professional image for the event. - - 6. **Review and Finalize**: - Review the marketing and communication strategy to ensure that it meets all the requirements and aligns with the overall event goals. Make any necessary adjustments and finalize the strategy. - - Your final answer should be a detailed marketing and communication strategy document that includes all the components mentioned above. - """.strip() - ), - requirements=[ - "The marketing and communication strategy must include save-the-date announcements 4 months in advance, formal invitations 2 months before, weekly reminder emails, internal campaigns, dedicated Slack channel, executive videos, and mobile event app" - ], - user_variables={ - "INFORMATION_GATHERING": information_gathering.value, - "PLANNING_TIMELINE": planning_timeline.value, - "BUDGET_BREAKDOWN": budget_breakdown.value, - }, - ) - assert marketing_strategy.value is not None, ( - 'ERROR: task "marketing_strategy" execution failed' - ) - - # 5. Develop a venue selection process to evaluate and select the best venue based on capacity, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi, catering facilities, accommodations, and cost-effectiveness. - - VENUE_SELECTION - venue_selection = m.instruct( - textwrap.dedent( - R""" - Your task is to develop a comprehensive venue selection process to evaluate and select the best venue for the corporate team-building event. Follow these steps to accomplish your task: - - 1. **Understand the Requirements**: - Review the gathered information about the company and event requirements, including the need to accommodate 100-300 employees. Ensure the venue selection process aligns with the overall event goals of strengthening team cohesion, improving cross-departmental collaboration, boosting morale, and creating lasting memories. - - 2. **Define Evaluation Criteria**: - Based on the event requirements, define the key criteria for evaluating potential venues. The criteria should include: - - **Capacity**: Ability to accommodate 100-300 people. - - **Accessibility**: Ease of access for all attendees, including those with disabilities. - - **Parking**: Adequate parking facilities for attendees and staff. - - **Indoor/Outdoor Space**: Availability of both indoor and outdoor spaces for various activities. - - **AV Capabilities**: Sufficient audio-visual equipment and support. - - **WiFi**: Reliable WiFi for 300+ devices. - - **Catering Facilities**: Ability to support breakfast, lunch, afternoon snacks, and dinner. - - **Accommodations**: Proximity to accommodations for out-of-town attendees, if necessary. - - **Cost-Effectiveness**: Budget-friendly options within the estimated budget of $15,000-25,000. - - 3. **Research Potential Venues**: - Identify at least 10 potential venues that meet the initial criteria. Gather detailed information about each venue, including: - - Location and contact information. - - Capacity and layout. - - Availability of required facilities and services. - - Cost estimates for rental and additional services. - - 4. **Create Evaluation Forms**: - Develop evaluation forms to systematically assess each venue against the defined criteria. The forms should include: - - Checklists for each criterion. - - Rating scales for subjective assessments. - - Space for notes and additional comments. - - 5. **Conduct Venue Visits or Virtual Tours**: - Schedule visits or virtual tours of the shortlisted venues. During the visits, evaluate: - - The overall ambiance and suitability for the event. - - The condition and functionality of facilities. - - The responsiveness and professionalism of the venue staff. - - 6. **Compare and Contrast Venues**: - Use the evaluation forms to compare and contrast the venues. Create a summary table or matrix that highlights the strengths and weaknesses of each venue based on the defined criteria. - - 7. **Select the Best Venue**: - Based on the evaluations, select the venue that best meets the event requirements and aligns with the budget. Consider factors such as overall value, flexibility, and the ability to create a memorable experience for attendees. - - 8. **Document the Selection Process**: - Prepare a detailed report documenting the venue selection process. The report should include: - - The defined evaluation criteria. - - The list of potential venues and their evaluations. - - The comparison and contrast of venues. - - The rationale for selecting the final venue. - - 9. **Finalize Venue Contract**: - Work with the selected venue to finalize the contract, ensuring all agreed-upon terms and conditions are clearly outlined. Include details such as: - - Rental costs and payment schedules. - - Cancellation policies. - - Additional services and their costs. - - 10. **Integrate with Overall Event Plan**: - Ensure the selected venue aligns with the overall event strategy document. Coordinate with other event planning components, such as catering, transportation, and technology, to ensure seamless integration. - - By following these steps, you will develop a thorough and effective venue selection process that meets the event's requirements and contributes to its success. - """.strip() - ), - requirements=[ - "The venue selection process must evaluate 10 venues based on capacity for 100-300 people, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi for 300+ devices, catering facilities, accommodations, and cost-effectiveness" - ], - user_variables={}, - ) - assert venue_selection.value is not None, ( - 'ERROR: task "venue_selection" execution failed' - ) - - # 6. Design a detailed event schedule from 8:00 AM to 8:00 PM including registration, breakfast, opening ceremony, icebreaker activities, workshops, lunch, team challenges, awards ceremony, and dinner with entertainment. - - EVENT_SCHEDULE - event_schedule = m.instruct( - textwrap.dedent( - R""" - Your task is to design a detailed event schedule from 8:00 AM to 8:00 PM for a corporate team-building event. The schedule should include the following key components: - - 1. **Registration and Breakfast (8:00 - 9:00 AM)** - - Plan for registration process and breakfast setup. - - Include details on coffee stations, pastries, and any other breakfast items. - - 2. **Opening Ceremony (9:00 - 9:30 AM)** - - Outline the opening ceremony, including the CEO's speech. - - Include any additional opening activities or announcements. - - 3. **Icebreaker Activities (9:30 - 10:30 AM)** - - Plan for icebreaker activities such as human bingo and speed networking. - - Include any necessary setup or facilitation details. - - 4. **Morning Workshops (10:30 AM - 12:30 PM)** - - Design tracks on leadership, innovation, communication, and wellness. - - Include details on workshop content, facilitators, and any required materials. - - 5. **Lunch (12:30 - 2:00 PM)** - - Plan for lunch with diverse menu options. - - Include details on catering setup, dietary restrictions, and any special considerations. - - 6. **Afternoon Team Challenges (2:00 - 5:00 PM)** - - Plan for team challenges such as scavenger hunt, escape rooms, outdoor adventures, cooking competition, and sports tournaments. - - Include details on equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules. - - 7. **Awards Ceremony (5:00 - 5:30 PM)** - - Plan for the awards ceremony, including any necessary setup or facilitation details. - - Include details on award categories, presentation, and any additional activities. - - 8. **Dinner with Entertainment (5:30 - 8:00 PM)** - - Plan for dinner with three entree choices and a full bar. - - Include details on entertainment such as live band or DJ, emcee, interactive activities, and evening games. - - To accomplish this task, follow these steps: - - 1. **Review Gathered Information**: - - Carefully review the gathered information about the company, event requirements, and constraints from the previous step: - - {{INFORMATION_GATHERING}} - - - 2. **Review Planning Timeline**: - - Review the planning timeline starting 6 months before the event with weekly milestones from the previous step: - - {{PLANNING_TIMELINE}} - - - 3. **Review Budget Breakdown**: - - Review the budget breakdown for venue rental, catering, entertainment, transportation, technology, and total estimated budget from the previous step: - - {{BUDGET_BREAKDOWN}} - - - 4. **Review Marketing Strategy**: - - Review the marketing and communication strategy including save-the-date announcements, formal invitations, reminder emails, internal campaigns, and other communication methods from the previous step: - - {{MARKETING_STRATEGY}} - - - 5. **Review Venue Selection**: - - Review the venue selection process to evaluate and select the best venue based on capacity, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi, catering facilities, accommodations, and cost-effectiveness from the previous step: - - {{VENUE_SELECTION}} - - - 6. **Design the Event Schedule**: - - Use the information gathered in the previous steps to design a detailed event schedule from 8:00 AM to 8:00 PM. - - Ensure the schedule includes all the key components mentioned above. - - Make sure the schedule is realistic, feasible, and aligns with the event's goals and constraints. - - 7. **Finalize the Schedule**: - - Review the designed event schedule to ensure it meets all the requirements and constraints. - - Make any necessary adjustments to ensure the schedule is comprehensive and detailed. - - 8. **Output the Event Schedule**: - - Provide the detailed event schedule as your final answer. Ensure the output is clear, concise, and well-organized. - - Remember to adhere to the event's goals of strengthening team cohesion, improving cross-departmental collaboration, boosting morale, and creating lasting memories. Ensure the schedule is inclusive, accessible, and sustainable, following best practices and leveraging technology where appropriate. - """.strip() - ), - requirements=[ - "The event schedule must include registration and breakfast at 8:00-9:00 AM, opening ceremony at 9:00-9:30 AM with CEO speech, icebreaker activities at 9:30-10:30 AM including human bingo and speed networking, morning workshops at 10:30 AM-12:30 PM with tracks on leadership, innovation, communication, and wellness, lunch at 12:30-2:00 PM with diverse menu options, afternoon team challenges at 2:00-5:00 PM including scavenger hunt, escape rooms, outdoor adventures, cooking competition, and sports tournaments, awards ceremony at 5:00-5:30 PM, and dinner with entertainment at 5:30-8:00 PM" - ], - user_variables={ - "INFORMATION_GATHERING": information_gathering.value, - "PLANNING_TIMELINE": planning_timeline.value, - "BUDGET_BREAKDOWN": budget_breakdown.value, - "MARKETING_STRATEGY": marketing_strategy.value, - "VENUE_SELECTION": venue_selection.value, - }, - ) - assert event_schedule.value is not None, ( - 'ERROR: task "event_schedule" execution failed' - ) - - # 7. Create a list of 15 icebreaker activities with detailed plans. - - ICEBREAKER_PLANS - icebreaker_plans = m.instruct( - textwrap.dedent( - R""" - Your task is to create a list of 15 icebreaker activities with detailed plans for a corporate team-building event. These activities should be engaging, inclusive, and designed to foster team cohesion and collaboration among 100-300 employees. - - To approach this task, follow these steps: - - 1. **Understand the Event Context**: - Review the gathered information about the company, event requirements, and constraints from the previous step: - - {{INFORMATION_GATHERING}} - - - 2. **Review the Event Schedule**: - Ensure that the icebreaker activities align with the event schedule, particularly the time slot allocated for icebreaker activities from 9:30 AM to 10:30 AM: - - {{EVENT_SCHEDULE}} - - - 3. **List of Icebreaker Activities**: - Create a list of 15 icebreaker activities. Each activity should include the following details: - - **Activity Name**: A clear and descriptive title. - - **Objective**: The purpose of the activity and how it contributes to team-building. - - **Materials Needed**: A list of any equipment or materials required. - - **Setup Instructions**: Step-by-step instructions for setting up the activity. - - **Instructions for Participants**: Clear guidelines on how to participate. - - **Duration**: The estimated time required for the activity. - - **Facilitator Notes**: Any special instructions or tips for the facilitator. - - **Safety Protocols**: Any safety considerations or guidelines. - - **Scoring System (if applicable)**: How the activity will be scored or evaluated. - - **Rotation Schedule (if applicable)**: How the activity will be rotated among teams. - - 4. **Diverse and Inclusive Activities**: - Ensure that the activities are diverse and inclusive, catering to different personalities, abilities, and preferences. Consider activities that can be adapted for various team sizes and dynamics. - - 5. **Engaging and Fun**: - The activities should be engaging and fun, designed to create a positive and memorable experience for all participants. - - 6. **Alignment with Event Goals**: - Ensure that the activities align with the overall goals of the event, which include strengthening team cohesion, improving cross-departmental collaboration, boosting morale, and creating lasting memories. - - Here is an example structure to guide your writing: - - **Activity 1: Human Knot** - - **Objective**: Promote teamwork and problem-solving. - - **Materials Needed**: None. - - **Setup Instructions**: Have participants stand in a circle. - - **Instructions for Participants**: Each person must hold hands with two people across from them to form a "human knot." - - **Duration**: 15-20 minutes. - - **Facilitator Notes**: Encourage communication and teamwork. - - **Safety Protocols**: Ensure participants are careful not to pull too hard. - - **Scoring System**: Not applicable. - - **Rotation Schedule**: Not applicable. - - Repeat the above structure for all 15 icebreaker activities. - - Ensure that each activity is clearly described and includes all the necessary details for successful execution. - - Finally, compile the list of 15 icebreaker activities with detailed plans into a comprehensive document. - """.strip() - ), - requirements=[ - "The icebreaker plans must include 15 options including human knot, marshmallow tower, obstacle course, pictionary, charades, and trust falls", - "The event schedule must include registration and breakfast at 8:00-9:00 AM, opening ceremony at 9:00-9:30 AM with CEO speech, icebreaker activities at 9:30-10:30 AM including human bingo and speed networking, morning workshops at 10:30 AM-12:30 PM with tracks on leadership, innovation, communication, and wellness, lunch at 12:30-2:00 PM with diverse menu options, afternoon team challenges at 2:00-5:00 PM including scavenger hunt, escape rooms, outdoor adventures, cooking competition, and sports tournaments, awards ceremony at 5:00-5:30 PM, and dinner with entertainment at 5:30-8:00 PM", - "The activity logistics must include equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules", - "The safety plan must include insurance, first aid stations, evacuation procedures, weather contingencies, food safety with allergen labeling, security personnel, and incident reporting", - "The accessibility plan must include ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation", - ], - user_variables={ - "INFORMATION_GATHERING": information_gathering.value, - "EVENT_SCHEDULE": event_schedule.value, - }, - ) - assert icebreaker_plans.value is not None, ( - 'ERROR: task "icebreaker_plans" execution failed' - ) - - # 8. Develop a team formation strategy with diverse mix of departments and seniority, pre-event survey for dietary restrictions, and team assignments 2 weeks before the event. - - TEAM_FORMATION - team_formation = m.instruct( - textwrap.dedent( - R""" - Your task is to develop a team formation strategy for a corporate team-building event. This strategy should ensure a diverse mix of departments and seniority levels, accommodate dietary restrictions, and assign teams two weeks before the event. - - To accomplish this, follow these steps: - - 1. **Understand the Event Requirements**: - Review the gathered information about the company, event requirements, and constraints from the previous step: - - {{INFORMATION_GATHERING}} - - - 2. **Diverse Team Formation**: - Create a strategy to form teams with a diverse mix of departments and seniority levels. Each team should consist of 8-12 people. Ensure that the teams are balanced in terms of experience, roles, and departments to foster collaboration and learning. - - 3. **Pre-Event Survey**: - Design a pre-event survey to collect information about dietary restrictions and preferences from all participants. This survey should be distributed at least one month before the event to allow sufficient time for planning. - - 4. **Team Assignments**: - Develop a process for assigning participants to teams. This process should consider the survey responses regarding dietary restrictions and ensure that teams are formed in a way that accommodates these needs. Team assignments should be communicated to participants two weeks before the event. - - 5. **Team Identification**: - Assign unique names and colors to each team to facilitate easy identification and foster team spirit. Ensure that the names and colors are inclusive and appropriate for all participants. - - 6. **Communication Plan**: - Outline a communication plan for informing participants about their team assignments, including the team name, color, and any other relevant information. This plan should include the distribution of team assignments and any follow-up communications. - - 7. **Documentation**: - Document the team formation strategy, including the criteria used for team formation, the survey questions, the process for assigning teams, and the communication plan. This documentation will be included in the comprehensive event strategy document. - - Ensure that your strategy aligns with the overall event goals of strengthening team cohesion, improving cross-departmental collaboration, boosting morale, and creating lasting memories. - """.strip() - ), - requirements=[ - "The team formation strategy must include diverse mix of departments and seniority in teams of 8-12 people, pre-event survey for dietary restrictions and preferences, and team assignments 2 weeks before with names and colors" - ], - user_variables={"INFORMATION_GATHERING": information_gathering.value}, - ) - assert team_formation.value is not None, ( - 'ERROR: task "team_formation" execution failed' - ) - - # 9. Design content for leadership, innovation, communication, and wellness workshops. - - WORKSHOP_CONTENT - workshop_content = m.instruct( - textwrap.dedent( - R""" - Your task is to design content for leadership, innovation, communication, and wellness workshops as part of the corporate team-building event. Follow these steps to accomplish your task: - - 1. **Understand the Workshop Requirements**: - - The workshops should focus on four key areas: leadership, innovation, communication, and wellness. - - Each workshop should be engaging, informative, and relevant to the attendees, who are employees from various departments and seniority levels. - - The workshops should align with the overall goals of strengthening team cohesion, improving cross-departmental collaboration, boosting morale, and creating lasting memories. - - 2. **Review Gathered Information**: - - Use the information gathered in the previous steps to understand the company's needs, event requirements, and constraints: - - {{INFORMATION_GATHERING}} - - - 3. **Design Leadership Workshop Content**: - - Create a workshop that focuses on leadership case studies, practical exercises, and group discussions. - - Include real-world examples and interactive activities that encourage participants to apply leadership principles. - - Ensure the content is relevant to both current leaders and those aspiring to leadership roles. - - 4. **Design Innovation Workshop Content**: - - Develop a workshop that emphasizes innovation brainstorming, creative problem-solving, and idea generation. - - Incorporate activities that encourage out-of-the-box thinking and collaboration. - - Provide tools and techniques that participants can use to foster innovation within their teams. - - 5. **Design Communication Workshop Content**: - - Create a workshop that covers effective communication strategies, active listening, and conflict resolution. - - Include exercises that help participants practice clear and concise communication. - - Address both verbal and non-verbal communication skills. - - 6. **Design Wellness Workshop Content**: - - Develop a workshop that focuses on wellness meditation, stress management, and work-life balance. - - Incorporate activities that promote physical and mental well-being. - - Provide practical tips and techniques that participants can integrate into their daily routines. - - 7. **Ensure Alignment with Event Schedule**: - - Refer to the detailed event schedule to ensure the workshops fit within the allocated time slots: - - {{EVENT_SCHEDULE}} - - - 8. **Consider Team Formation Strategy**: - - Take into account the team formation strategy to ensure the workshops cater to diverse groups: - - {{TEAM_FORMATION}} - - - 9. **Create Detailed Workshop Plans**: - - For each workshop, provide a detailed plan that includes: - - Objectives and learning outcomes - - Agenda and timeline - - Materials and resources needed - - Facilitator guidelines - - Participant activities and exercises - - Evaluation methods - - 10. **Review and Finalize**: - - Ensure the workshop content aligns with the overall event goals and constraints. - - Make any necessary adjustments to ensure the workshops are engaging, informative, and relevant to the attendees. - - Your final answer should be a detailed plan for each of the four workshops, including all the elements listed above. - """.strip() - ), - requirements=[ - "The workshop content must include leadership case studies, innovation brainstorming, communication exercises, and wellness meditation" - ], - user_variables={ - "INFORMATION_GATHERING": information_gathering.value, - "EVENT_SCHEDULE": event_schedule.value, - "TEAM_FORMATION": team_formation.value, - }, - ) - assert workshop_content.value is not None, ( - 'ERROR: task "workshop_content" execution failed' - ) - - # 10. Create a detailed catering plan with breakfast, lunch, afternoon snacks, and dinner options. - - CATERING_PLAN - catering_plan = m.instruct( - textwrap.dedent( - R""" - Your task is to create a detailed catering plan for the corporate team-building event. The catering plan should include options for breakfast, lunch, afternoon snacks, and dinner, ensuring a diverse menu that accommodates various dietary restrictions and preferences. - - To approach this task, follow these steps: - - 1. **Review Gathered Information**: - Begin by reviewing the information gathered about the company and event requirements: - - {{INFORMATION_GATHERING}} - - - 2. **Understand the Event Schedule**: - Familiarize yourself with the event schedule to ensure the catering plan aligns with the timing of meals and breaks: - - {{EVENT_SCHEDULE}} - - - 3. **Consider Dietary Restrictions**: - Use the team formation strategy, which includes a pre-event survey for dietary restrictions and preferences, to ensure the catering plan accommodates all attendees: - - {{TEAM_FORMATION}} - - - 4. **Breakfast Options**: - Plan a breakfast menu that includes a coffee station and pastries. Ensure there are options for different dietary needs, such as gluten-free, vegan, and lactose-free choices. - - 5. **Lunch Options**: - Design a lunch buffet with a variety of options, including a salad bar and hot entrees. Provide diverse menu choices to cater to different tastes and dietary restrictions. - - 6. **Afternoon Snacks**: - Plan for afternoon snacks that are light and refreshing. Consider options like fruits, vegetables, and healthy snacks to keep energy levels up during the event. - - 7. **Dinner Options**: - Create a dinner menu with three entree choices and a full bar. Ensure there are options for different dietary needs and preferences, such as vegetarian, vegan, and gluten-free choices. - - 8. **Allergen Labeling**: - Include allergen labeling for all food items to ensure the safety and well-being of all attendees. - - 9. **Sustainability Considerations**: - Incorporate sustainable practices into the catering plan, such as using reusable serving ware and minimizing food waste. - - 10. **Budget Constraints**: - Ensure the catering plan stays within the budget constraints outlined in the budget breakdown: - - {{BUDGET_BREAKDOWN}} - - - 11. **Finalize the Catering Plan**: - Compile all the information into a detailed catering plan that includes timings, menu options, and any special considerations. - - Your final answer should be a comprehensive catering plan that meets all the requirements and constraints of the event. - """.strip() - ), - requirements=[ - "The catering plan must include breakfast coffee station and pastries, lunch buffet with salad bar and hot entrees, afternoon snacks, and dinner with three entree choices and full bar", - "The safety plan must include insurance, first aid stations, evacuation procedures, weather contingencies, food safety with allergen labeling, security personnel, and incident reporting", - "The sustainability plan must include eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management", - "The team formation strategy must include diverse mix of departments and seniority in teams of 8-12 people, pre-event survey for dietary restrictions and preferences, and team assignments 2 weeks before with names and colors", - "The budget breakdowns must include venue rental at $15,000-25,000, catering at $75-125 per person, entertainment and activities at $10,000-20,000, transportation at $3,000-8,000, technology at $5,000-10,000, and total estimated budget of $50,000-125,000", - ], - user_variables={ - "INFORMATION_GATHERING": information_gathering.value, - "EVENT_SCHEDULE": event_schedule.value, - "TEAM_FORMATION": team_formation.value, - "BUDGET_BREAKDOWN": budget_breakdown.value, - }, - ) - assert catering_plan.value is not None, ( - 'ERROR: task "catering_plan" execution failed' - ) - - # 11. Develop logistics for all planned activities including equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules. - - ACTIVITY_LOGISTICS - activity_logistics = m.instruct( - textwrap.dedent( - R""" - Your task is to develop detailed logistics for all planned activities for the corporate team-building event. This includes creating equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules. - - To approach this task, follow these steps: - - 1. **Review the Event Schedule and Activity Plans**: - - Carefully review the event schedule and the list of planned activities from the previous steps. These include icebreaker activities, workshops, team challenges, and other events. - - Ensure you have a clear understanding of the timeline and the sequence of activities. - - 2. **Create Equipment Lists**: - - For each activity, identify the necessary equipment and materials required. - - Ensure that the equipment lists are comprehensive and include all items needed for smooth execution. - - 3. **Develop Setup Instructions**: - - Provide detailed setup instructions for each activity. - - Include information on how to arrange the space, set up equipment, and prepare the area for participants. - - 4. **Establish Safety Protocols**: - - Develop safety protocols for each activity to ensure the well-being of all participants. - - Include guidelines for emergency procedures, first aid, and any specific safety measures related to the activity. - - 5. **Prepare Facilitator Guides**: - - Create facilitator guides that outline the roles and responsibilities of the activity facilitators. - - Include step-by-step instructions, tips for engaging participants, and any other relevant information. - - 6. **Design Scoring Systems**: - - For competitive activities, design scoring systems that are fair and transparent. - - Ensure that the scoring criteria are clearly communicated to all participants. - - 7. **Plan Rotation Schedules**: - - Develop rotation schedules for activities that involve multiple groups or teams. - - Ensure that the schedules are efficient and allow for smooth transitions between activities. - - 8. **Integrate with Other Plans**: - - Ensure that the activity logistics align with the catering plan, transportation plan, and other relevant aspects of the event. - - Coordinate with the technology plan to ensure that any necessary AV equipment or WiFi access is available. - - 9. **Review and Finalize**: - - Review all the logistics plans to ensure they are comprehensive and practical. - - Make any necessary adjustments to ensure that the activities run smoothly and safely. - - Here is an example structure to guide your writing: - - **Activity Name**: [Name of the activity] - - **Equipment List**: [List of required equipment] - - **Setup Instructions**: [Detailed setup instructions] - - **Safety Protocols**: [Safety guidelines and emergency procedures] - - **Facilitator Guide**: [Roles and responsibilities, step-by-step instructions] - - **Scoring System**: [Scoring criteria and guidelines] - - **Rotation Schedule**: [Schedule for team rotations] - - Ensure that each section is clearly outlined and provides all necessary information for the successful execution of the activity. - - Finally, compile all the logistics plans into a detailed document that can be easily referenced during the event planning and execution phases. - """.strip() - ), - requirements=[ - "The activity logistics must include equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules" - ], - user_variables={}, - ) - assert activity_logistics.value is not None, ( - 'ERROR: task "activity_logistics" execution failed' - ) - - # 12. Create a transportation plan with charter buses, parking management, shuttle service, and contingency plans. - - TRANSPORTATION_PLAN - transportation_plan = m.instruct( - textwrap.dedent( - R""" - Your task is to create a comprehensive transportation plan for the corporate team-building event. This plan should include charter buses, parking management, shuttle service, and contingency plans. Follow these steps to accomplish your task: - - 1. **Review Gathered Information**: - Start by reviewing the information gathered about the company, event requirements, and constraints. This will help you understand the specific needs and logistics of the event: - - {{INFORMATION_GATHERING}} - - - 2. **Understand the Event Schedule**: - Familiarize yourself with the detailed event schedule to ensure that the transportation plan aligns with the timing and logistics of the event: - - {{EVENT_SCHEDULE}} - - - 3. **Develop Charter Bus Plan**: - Create a plan for charter buses that includes: - - Number of buses required based on the number of attendees. - - Pick-up and drop-off locations. - - Schedule for bus arrivals and departures. - - Cost estimates and budget considerations. - - 4. **Design Parking Management Plan**: - Develop a parking management plan that includes: - - Availability of parking spaces at the venue. - - Designated parking areas for attendees, staff, and vendors. - - Parking fees and payment methods. - - Accessibility considerations for attendees with disabilities. - - 5. **Create Shuttle Service Plan**: - Outline a shuttle service plan that includes: - - Routes and schedules for shuttles. - - Pick-up and drop-off points. - - Frequency of shuttle services. - - Cost estimates and budget considerations. - - 6. **Develop Contingency Plans**: - Prepare contingency plans for potential issues such as: - - Weather-related delays or cancellations. - - Mechanical failures of buses or shuttles. - - Unexpected changes in attendee numbers. - - Alternative transportation options in case of emergencies. - - 7. **Integrate with Other Logistics**: - Ensure that the transportation plan is integrated with other event logistics, such as registration, catering, and activities. This will help ensure a smooth and coordinated event experience. - - 8. **Finalize the Transportation Plan**: - Compile all the information into a detailed transportation plan that includes all the elements mentioned above. Ensure that the plan is clear, organized, and easy to follow. - - Your final answer should be a comprehensive transportation plan that addresses all the requirements and considerations mentioned above. - """.strip() - ), - requirements=[ - "The transportation plan must include charter buses, parking management, shuttle service, and contingency plans" - ], - user_variables={ - "INFORMATION_GATHERING": information_gathering.value, - "EVENT_SCHEDULE": event_schedule.value, - }, - ) - assert transportation_plan.value is not None, ( - 'ERROR: task "transportation_plan" execution failed' - ) - - # 13. Design a registration process with online portal, on-site check-in, name tags, welcome packets, and staff training. - - REGISTRATION_PROCESS - registration_process = m.instruct( - textwrap.dedent( - R""" - Your task is to design a comprehensive registration process for the corporate team-building event. This process should include an online portal, on-site check-in, name tags, welcome packets, and staff training. Follow these steps to accomplish your task: - - 1. **Online Portal**: - - Design an online registration portal that allows employees to register for the event. - - Ensure the portal collects necessary information such as name, department, dietary restrictions, and any special needs. - - Include a confirmation email feature that sends registration details and event information to participants. - - 2. **On-Site Check-In**: - - Develop a streamlined on-site check-in process to ensure smooth and efficient entry for all attendees. - - Plan for check-in stations with clear signage and trained staff to assist participants. - - Consider using technology such as QR codes or barcode scanners to expedite the check-in process. - - 3. **Name Tags**: - - Design and prepare name tags for all attendees. - - Include the participant's name, department, and any additional information that may be relevant (e.g., dietary restrictions, accessibility needs). - - Ensure name tags are durable, easy to read, and can be worn comfortably throughout the event. - - 4. **Welcome Packets**: - - Create welcome packets that include essential event information such as the schedule, map of the venue, and any necessary forms or documents. - - Include a welcome letter from the event organizers or company executives. - - Add promotional items or swag to the packets to enhance the participant experience. - - 5. **Staff Training**: - - Develop a training program for event staff to ensure they are prepared to handle registration, check-in, and any issues that may arise. - - Train staff on the use of the online portal, check-in technology, and how to assist participants with special needs. - - Conduct mock drills to simulate the registration process and identify any potential issues or areas for improvement. - - 6. **Integration with Other Plans**: - - Ensure the registration process aligns with the overall event schedule, transportation plan, and safety plan. - - Coordinate with the technology plan to integrate any necessary tech solutions for registration and check-in. - - Consider the accessibility plan to ensure the registration process is inclusive and accommodates all participants. - - 7. **Contingency Planning**: - - Develop a contingency plan for potential issues such as technical difficulties with the online portal, high check-in volumes, or last-minute registrations. - - Ensure staff are trained to handle these scenarios and have backup plans in place. - - 8. **Review and Finalize**: - - Review the registration process to ensure it meets all requirements and aligns with the event's goals. - - Make any necessary adjustments and finalize the registration process. - - Use the information gathered in the previous steps to guide your design. Ensure the registration process is user-friendly, efficient, and aligns with the overall event strategy. - - - {{INFORMATION_GATHERING}} - - - - {{PLANNING_TIMELINE}} - - - - {{BUDGET_BREAKDOWN}} - - - - {{MARKETING_STRATEGY}} - - - - {{VENUE_SELECTION}} - - - - {{EVENT_SCHEDULE}} - - - - {{ICEBREAKER_PLANS}} - - - - {{TEAM_FORMATION}} - - - - {{WORKSHOP_CONTENT}} - - - - {{CATERING_PLAN}} - - - - {{ACTIVITY_LOGISTICS}} - - - - {{TRANSPORTATION_PLAN}} - - """.strip() - ), - requirements=[ - "The registration process must include online portal, on-site check-in, name tags, welcome packets with schedule and swag, and staff training" - ], - user_variables={ - "INFORMATION_GATHERING": information_gathering.value, - "PLANNING_TIMELINE": planning_timeline.value, - "BUDGET_BREAKDOWN": budget_breakdown.value, - "MARKETING_STRATEGY": marketing_strategy.value, - "VENUE_SELECTION": venue_selection.value, - "EVENT_SCHEDULE": event_schedule.value, - "ICEBREAKER_PLANS": icebreaker_plans.value, - "TEAM_FORMATION": team_formation.value, - "WORKSHOP_CONTENT": workshop_content.value, - "CATERING_PLAN": catering_plan.value, - "ACTIVITY_LOGISTICS": activity_logistics.value, - "TRANSPORTATION_PLAN": transportation_plan.value, - }, - ) - assert registration_process.value is not None, ( - 'ERROR: task "registration_process" execution failed' - ) - - # 14. Develop a comprehensive safety plan including insurance, first aid stations, evacuation procedures, weather contingencies, food safety, security personnel, and incident reporting. - - SAFETY_PLAN - safety_plan = m.instruct( - textwrap.dedent( - R""" - Your task is to develop a comprehensive safety plan for the corporate team-building event. This plan should ensure the safety and well-being of all participants and staff. Follow these steps to accomplish your task: - - 1. **Understand the Event Details**: - Review the gathered information about the company, event requirements, and constraints from the previous step: - - {{INFORMATION_GATHERING}} - - - 2. **Identify Key Safety Components**: - The safety plan should include the following components: - - **Insurance**: Ensure that the event has adequate insurance coverage for all activities and participants. - - **First Aid Stations**: Plan for the setup of first aid stations at strategic locations within the venue. - - **Evacuation Procedures**: Develop clear evacuation procedures in case of emergencies. - - **Weather Contingencies**: Prepare contingency plans for adverse weather conditions. - - **Food Safety**: Implement food safety measures, including allergen labeling and proper handling procedures. - - **Security Personnel**: Arrange for security personnel to be present throughout the event. - - **Incident Reporting**: Establish a system for reporting and managing incidents during the event. - - 3. **Create Detailed Plans for Each Component**: - - **Insurance**: Specify the type and amount of insurance required, and ensure that all vendors and participants are covered. - - **First Aid Stations**: Determine the number and location of first aid stations, and ensure that they are staffed by qualified medical personnel. - - **Evacuation Procedures**: Develop a clear and concise evacuation plan, including designated assembly points and communication protocols. - - **Weather Contingencies**: Prepare alternative plans for outdoor activities in case of bad weather, including indoor alternatives and rescheduling options. - - **Food Safety**: Work with caterers to ensure that all food is prepared and served safely, with clear labeling of allergens. - - **Security Personnel**: Hire and brief security personnel on their roles and responsibilities, including crowd control and emergency response. - - **Incident Reporting**: Create a system for reporting incidents, including forms and protocols for documenting and addressing issues. - - 4. **Review and Finalize the Safety Plan**: - Ensure that the safety plan is comprehensive and addresses all potential risks and contingencies. Make any necessary adjustments to ensure that the plan is practical and effective. - - 5. **Output the Safety Plan**: - Provide the detailed safety plan as your final answer. The plan should be clear, concise, and easy to follow, ensuring that all safety measures are in place for a successful event. - """.strip() - ), - requirements=[ - "The safety plan must include insurance, first aid stations, evacuation procedures, weather contingencies, food safety with allergen labeling, security personnel, and incident reporting" - ], - user_variables={"INFORMATION_GATHERING": information_gathering.value}, - ) - assert safety_plan.value is not None, 'ERROR: task "safety_plan" execution failed' - - # 15. Create a vendor management strategy with selection criteria, contracts, payment schedules, and evaluation forms. - - VENDOR_MANAGEMENT - vendor_management = m.instruct( - textwrap.dedent( - R""" - Your task is to create a comprehensive vendor management strategy for the corporate team-building event. This strategy should include selection criteria, contracts, payment schedules, and evaluation forms. Follow these steps to accomplish your task: - - 1. **Understand the Requirements**: - Review the gathered information about the company, event requirements, and constraints from the previous step: - - {{INFORMATION_GATHERING}} - - - 2. **Define Selection Criteria**: - Develop a set of selection criteria for vendors. Consider factors such as: - - Experience and reputation - - Cost-effectiveness - - Availability and capacity - - Quality of services or products - - Compatibility with event goals and values - - Sustainability practices - - Customer reviews and references - - 3. **Create Contract Templates**: - Design standard contract templates that outline: - - Scope of work - - Deliverables - - Timeline and milestones - - Payment terms - - Cancellation and refund policies - - Liability and insurance requirements - - Confidentiality and data protection clauses - - 4. **Develop Payment Schedules**: - Establish payment schedules for each vendor category (e.g., venue rental, catering, entertainment, transportation, technology). Consider: - - Deposit amounts and due dates - - Progress payments tied to milestones - - Final payments upon completion - - Payment methods and invoicing procedures - - 5. **Design Evaluation Forms**: - Create evaluation forms to assess vendor performance. Include sections for: - - Quality of services or products - - Timeliness and reliability - - Professionalism and communication - - Adherence to budget and contract terms - - Customer feedback and satisfaction - - Recommendations for future events - - 6. **Compile the Vendor Management Strategy**: - Combine all the above elements into a cohesive vendor management strategy document. Ensure it is clear, detailed, and aligned with the event's goals and constraints. - - Your final answer should be a comprehensive vendor management strategy document that includes selection criteria, contract templates, payment schedules, and evaluation forms. - """.strip() - ), - requirements=[ - "The vendor management strategy must include selection criteria, contracts, payment schedules, and evaluation forms" - ], - user_variables={"INFORMATION_GATHERING": information_gathering.value}, - ) - assert vendor_management.value is not None, ( - 'ERROR: task "vendor_management" execution failed' - ) - - # 16. Design a technology plan with event app, AV equipment, WiFi, photography services, live streaming, and tech support. - - TECHNOLOGY_PLAN - technology_plan = m.instruct( - textwrap.dedent( - R""" - Your task is to design a comprehensive technology plan for the corporate team-building event. This plan should ensure seamless integration of technology to enhance the event experience, facilitate smooth operations, and support all planned activities. - - To accomplish this, follow these steps: - - 1. **Event App**: - - Design an event app that will serve as a central hub for scheduling, messaging, and real-time updates. - - Include features such as personalized schedules, team assignments, interactive maps, and push notifications. - - Ensure the app is user-friendly and accessible on both iOS and Android platforms. - - 2. **AV Equipment**: - - Plan for all necessary audio-visual equipment, including microphones, speakers, projectors, and screens. - - Ensure that the AV setup is compatible with the venue's infrastructure and meets the requirements for presentations, workshops, and the opening ceremony. - - 3. **WiFi**: - - Arrange for robust WiFi coverage capable of supporting 300+ devices simultaneously. - - Work with the venue and internet service providers to ensure reliable connectivity throughout the event. - - 4. **Photography Services**: - - Hire professional photographers to capture key moments during the event. - - Plan for photo backdrops, designated photo areas, and a system for sharing photos with participants post-event. - - 5. **Live Streaming**: - - Set up live streaming capabilities for any sessions that need to be broadcast to remote participants or recorded for future reference. - - Ensure high-quality video and audio streaming with minimal latency. - - 6. **Tech Support**: - - Assign a dedicated tech support team to troubleshoot any issues that arise during the event. - - Provide clear contact information and a quick response protocol for technical difficulties. - - 7. **Integration with Other Plans**: - - Coordinate with the marketing and communication strategy to ensure the event app and other technology tools are promoted effectively. - - Align with the registration process to integrate the event app with the online portal and on-site check-in. - - 8. **Safety and Contingency**: - - Include backup plans for technology failures, such as alternative AV setups and backup internet connections. - - Ensure that all technology plans comply with the safety plan and contingency planning. - - 9. **Budget Considerations**: - - Estimate the costs for each technology component and ensure they fit within the overall budget. - - Prioritize cost-effective solutions that meet the event's requirements without compromising quality. - - 10. **Documentation**: - - Create detailed documentation for each technology component, including setup instructions, user guides, and troubleshooting tips. - - Share this documentation with relevant stakeholders, including event staff, vendors, and participants. - - Use the gathered information and previous steps to inform your technology plan. Ensure that all technology solutions are scalable, reliable, and enhance the overall event experience. - - Finally, compile your technology plan into a clear and concise document that can be integrated into the comprehensive event strategy document. - """.strip() - ), - requirements=[ - "The technology plan must include event app for scheduling and messaging, AV equipment, WiFi for 300+ connections, photography services, live streaming, and tech support", - "All planning must follow best practices, create memorable experiences, accommodate diverse needs, stay within budget, prioritize safety, incorporate sustainable practices, leverage technology, build excitement, and measure success", - ], - user_variables={}, - ) - assert technology_plan.value is not None, ( - 'ERROR: task "technology_plan" execution failed' - ) - - # 17. Develop a decoration strategy with signage, team colors, photo backdrops, and sustainable options. - - DECORATION_STRATEGY - decoration_strategy = m.instruct( - textwrap.dedent( - R""" - Your task is to develop a comprehensive decoration strategy for the corporate team-building event. This strategy should focus on creating an engaging and visually appealing environment that aligns with the event's goals and themes. Follow these steps to accomplish your task: - - 1. **Understand the Event Requirements**: - Review the gathered information about the company, event requirements, and constraints from the previous step: - - {{INFORMATION_GATHERING}} - - - 2. **Review the Event Schedule and Theme**: - Ensure that the decoration strategy aligns with the event schedule and overall theme. Refer to the event schedule and other relevant plans: - - {{EVENT_SCHEDULE}} - - - 3. **Develop Signage Strategy**: - Create a plan for signage that includes: - - Welcome signs at the entrance - - Directional signs for different event areas - - Informational signs for activities and workshops - - Team identification signs - Ensure that all signage is clear, visually appealing, and consistent with the event's branding. - - 4. **Design Team Colors and Identification**: - Develop a strategy for using team colors to identify different teams. This can include: - - Color-coded name tags and lanyards - - Team-specific decorations and signage - - Color-coordinated table settings and seating arrangements - Ensure that the team colors are easily distinguishable and contribute to a cohesive visual theme. - - 5. **Create Photo Backdrops**: - Design photo backdrops that are visually appealing and align with the event's theme. Consider: - - Themed backdrops for different event areas - - Customizable backdrops that can be personalized with team names or slogans - - Backdrops that incorporate the company's branding and colors - Ensure that the photo backdrops are easily accessible and encourage participants to take photos. - - 6. **Incorporate Sustainable Options**: - Develop a strategy for incorporating sustainable decoration options. This can include: - - Using reusable or recyclable materials - - Choosing eco-friendly signage and backdrops - - Implementing digital signage where possible - - Ensuring proper waste management and recycling practices - Ensure that the sustainable options are practical and do not compromise the visual appeal of the decorations. - - 7. **Review and Finalize the Strategy**: - Ensure that the decoration strategy is comprehensive and aligns with the event's goals and requirements. Make any necessary adjustments to ensure that the strategy is practical and effective. - - Finally, write the decoration strategy document that includes all the above elements. This document will serve as a guide for implementing the decoration strategy during the event. - """.strip() - ), - requirements=[ - "The decoration strategy must include signage, team colors, photo backdrops, and sustainable options" - ], - user_variables={ - "INFORMATION_GATHERING": information_gathering.value, - "EVENT_SCHEDULE": event_schedule.value, - }, - ) - assert decoration_strategy.value is not None, ( - 'ERROR: task "decoration_strategy" execution failed' - ) - - # 18. Create an entertainment plan with live band or DJ, emcee, interactive activities, and evening games. - - ENTERTAINMENT_PLAN - entertainment_plan = m.instruct( - textwrap.dedent( - R""" - Your task is to create an entertainment plan for the corporate team-building event. The plan should include a live band or DJ, an emcee, interactive activities, and evening games. Follow these steps to accomplish your task: - - 1. **Review the Event Schedule**: - Ensure that the entertainment plan aligns with the event schedule. You can refer to the event schedule from the previous step: - - {{EVENT_SCHEDULE}} - - - 2. **Select Entertainment Options**: - Choose between a live band or a DJ for the event. Consider the preferences of the attendees and the overall theme of the event. Additionally, decide on an emcee who will guide the event and engage the audience. - - 3. **Plan Interactive Activities**: - Develop a list of interactive activities that will engage the attendees. These activities should be fun, inclusive, and align with the team-building goals of the event. Examples include trivia games, karaoke, and dance-offs. - - 4. **Design Evening Games**: - Create a list of evening games that will keep the attendees entertained and engaged. These games should be suitable for the time of day and the overall atmosphere of the event. Examples include casino night, poker tournaments, and photo booths. - - 5. **Coordinate with Other Plans**: - Ensure that the entertainment plan coordinates with other aspects of the event, such as the catering plan, technology plan, and decoration strategy. You can refer to the following plans from the previous steps: - - {{CATERING_PLAN}} - - - {{TECHNOLOGY_PLAN}} - - - {{DECORATION_STRATEGY}} - - - 6. **Create a Detailed Entertainment Plan**: - Write a detailed entertainment plan that includes the following information: - - **Live Band or DJ**: Specify the type of entertainment, the duration, and any specific requirements. - - **Emcee**: Provide details about the emcee, including their role and responsibilities. - - **Interactive Activities**: List the interactive activities, their duration, and any necessary equipment or setup. - - **Evening Games**: Describe the evening games, their duration, and any specific instructions or rules. - - Ensure that the entertainment plan is comprehensive and covers all aspects of the event. The plan should be clear, concise, and easy to follow. - - Finally, provide the detailed entertainment plan as your answer. - """.strip() - ), - requirements=[ - "The entertainment plan must include live band or DJ, emcee, interactive activities, and evening games", - "All planning must follow best practices, create memorable experiences, accommodate diverse needs, stay within budget, prioritize safety, incorporate sustainable practices, leverage technology, build excitement, and measure success", - ], - user_variables={ - "EVENT_SCHEDULE": event_schedule.value, - "CATERING_PLAN": catering_plan.value, - "TECHNOLOGY_PLAN": technology_plan.value, - "DECORATION_STRATEGY": decoration_strategy.value, - }, - ) - assert entertainment_plan.value is not None, ( - 'ERROR: task "entertainment_plan" execution failed' - ) - - # 19. Design a prize strategy with team prizes, individual awards, participation gifts, and raffle prizes. - - PRIZE_STRATEGY - prize_strategy = m.instruct( - textwrap.dedent( - R""" - Your task is to design a prize strategy for the corporate team-building event. The prize strategy should include team prizes, individual awards, participation gifts, and raffle prizes. Follow these steps to accomplish your task: - - 1. **Understand the Event Context**: - Review the gathered information about the company, event requirements, and constraints from the previous step: - - {{INFORMATION_GATHERING}} - - - 2. **Define Prize Categories**: - Identify the different categories of prizes needed for the event. These should include: - - **Team Prizes**: Prizes for the top-performing teams, such as first, second, and third place. - - **Individual Awards**: Recognition for outstanding individual performances or contributions. - - **Participation Gifts**: Small gifts or tokens of appreciation for all attendees. - - **Raffle Prizes**: Prizes to be raffled off during the event, which can be won by any attendee. - - 3. **Determine Prize Values**: - Based on the budget breakdown and the overall event budget, determine the appropriate values for each prize category. Ensure that the prize strategy aligns with the total estimated budget: - - {{BUDGET_BREAKDOWN}} - - - 4. **Plan Team Prizes**: - Design a tiered prize structure for team prizes. For example: - - **First Place Team Prize**: $500 value - - **Second Place Team Prize**: $300 value - - **Third Place Team Prize**: $200 value - - 5. **Plan Individual Awards**: - Identify criteria for individual awards, such as "Most Innovative Idea," "Best Team Player," or "Outstanding Leadership." Determine the type and value of each individual award. - - 6. **Plan Participation Gifts**: - Choose small, meaningful gifts that can be given to all attendees. These could include branded merchandise, gift cards, or other tokens of appreciation. - - 7. **Plan Raffle Prizes**: - Select a variety of raffle prizes that appeal to a broad range of attendees. Consider including high-value items, experiences, or other exciting prizes. - - 8. **Integrate with Event Schedule**: - Ensure that the prize strategy aligns with the event schedule, including when and how prizes will be awarded. Review the event schedule from the previous step: - - {{EVENT_SCHEDULE}} - - - 9. **Document the Prize Strategy**: - Compile all the information into a detailed prize strategy document. Include the following sections: - - **Team Prizes**: Description and value of each team prize. - - **Individual Awards**: Criteria and description of each individual award. - - **Participation Gifts**: Description and distribution plan for participation gifts. - - **Raffle Prizes**: Description and selection process for raffle prizes. - - 10. **Review and Finalize**: - Review the prize strategy to ensure it meets all event requirements and aligns with the overall event goals. Make any necessary adjustments to ensure clarity and completeness. - - Your final answer should be a detailed prize strategy document that includes all the above information. - """.strip() - ), - requirements=[ - "The prize strategy must include team prizes at $500, $300, and $200, individual awards, participation gifts, and raffle prizes" - ], - user_variables={ - "INFORMATION_GATHERING": information_gathering.value, - "BUDGET_BREAKDOWN": budget_breakdown.value, - "EVENT_SCHEDULE": event_schedule.value, - }, - ) - assert prize_strategy.value is not None, ( - 'ERROR: task "prize_strategy" execution failed' - ) - - # 20. Develop a post-event evaluation plan with participant survey, debriefing sessions, budget reconciliation, photo compilation, impact assessment, and thank you communications. - - POST_EVENT_EVALUATION - post_event_evaluation = m.instruct( - textwrap.dedent( - R""" - Your task is to develop a comprehensive post-event evaluation plan for the corporate team-building event. This plan should include the following components: - - 1. **Participant Survey**: - - Design a survey to be sent within 24 hours of the event. - - Include questions that assess the overall experience, specific activities, workshops, catering, and any areas for improvement. - - Ensure the survey is concise, easy to complete, and covers all key aspects of the event. - - 2. **Debriefing Sessions**: - - Plan debriefing sessions with the event planning team and key stakeholders. - - Schedule these sessions within a week after the event to discuss what went well, what could be improved, and any lessons learned. - - Document the outcomes of these sessions for future reference. - - 3. **Budget Reconciliation**: - - Compare the actual expenses with the estimated budget. - - Identify any budget overruns or savings. - - Provide a detailed report on the financial performance of the event. - - 4. **Photo Compilation**: - - Gather all photos taken during the event. - - Create a digital album or slideshow to share with participants and stakeholders. - - Ensure the photos are organized and easily accessible. - - 5. **Impact Assessment**: - - Evaluate the impact of the event on team cohesion, cross-departmental collaboration, and morale. - - Use feedback from the participant survey and debriefing sessions to assess the event's success. - - Provide a summary of the event's overall impact and any measurable outcomes. - - 6. **Thank You Communications**: - - Prepare thank-you messages for all participants, vendors, and stakeholders. - - Include a brief summary of the event's success and express gratitude for their contributions. - - Send these communications within a week after the event. - - To accomplish this task, follow these steps: - - 1. **Review Event Details**: - - Refer to the gathered information about the company, event requirements, and constraints: - - {{INFORMATION_GATHERING}} - - - 2. **Design the Participant Survey**: - - Create a survey that covers all key aspects of the event. - - Ensure the survey is user-friendly and can be completed quickly. - - 3. **Plan Debriefing Sessions**: - - Schedule sessions with the event planning team and key stakeholders. - - Prepare an agenda for each session to ensure productive discussions. - - 4. **Conduct Budget Reconciliation**: - - Compare actual expenses with the estimated budget. - - Identify any discrepancies and document the findings. - - 5. **Compile Photos**: - - Gather all photos from the event. - - Organize them into a digital album or slideshow. - - 6. **Assess Impact**: - - Use feedback from the survey and debriefing sessions to evaluate the event's impact. - - Provide a summary of the event's success and any measurable outcomes. - - 7. **Prepare Thank You Communications**: - - Draft thank-you messages for participants, vendors, and stakeholders. - - Include a brief summary of the event's success and express gratitude. - - 8. **Compile the Post-Event Evaluation Plan**: - - Combine all the components into a comprehensive post-event evaluation plan. - - Ensure the plan is clear, detailed, and ready for implementation. - - Your final answer should be the complete post-event evaluation plan, including all the components mentioned above. - """.strip() - ), - requirements=[ - "The post-event evaluation must include participant survey within 24 hours, debriefing sessions, budget reconciliation, photo compilation, impact assessment, and thank you communications" - ], - user_variables={"INFORMATION_GATHERING": information_gathering.value}, - ) - assert post_event_evaluation.value is not None, ( - 'ERROR: task "post_event_evaluation" execution failed' - ) - - # 21. Create an accessibility plan with ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation. - - ACCESSIBILITY_PLAN - accessibility_plan = m.instruct( - textwrap.dedent( - R""" - Your task is to create an accessibility plan for the corporate team-building event. This plan should ensure that the event is inclusive and accommodates the diverse needs of all attendees. Follow these steps to accomplish your task: - - 1. **Understand the Requirements**: - Review the gathered information about the company and event requirements to understand the specific needs and constraints related to accessibility: - - {{INFORMATION_GATHERING}} - - - 2. **ADA Compliance**: - Ensure that the event venue and all activities comply with the Americans with Disabilities Act (ADA) standards. This includes: - - Accessible entry points and pathways - - Adequate space for mobility devices - - Accessible restrooms - - Clear signage and directions - - 3. **Interpreters and Assistive Technology**: - Plan for the provision of interpreters for attendees who are deaf or hard of hearing. Additionally, consider any assistive technology that may be required, such as: - - Hearing assistance devices - - Visual aids - - Braille materials - - 4. **Activity Modifications**: - Modify activities to ensure they are accessible to all attendees. This may include: - - Providing alternative activities for those who cannot participate in certain events - - Adjusting the difficulty level of activities - - Ensuring that all activities can be performed by individuals with varying abilities - - 5. **Dietary Accommodation**: - Accommodate dietary restrictions and preferences by: - - Offering a variety of food options that cater to different dietary needs (e.g., vegetarian, vegan, gluten-free, allergies) - - Clearly labeling all food items with allergen information - - Providing a pre-event survey to gather dietary information from attendees - - 6. **Inclusive Team Formation**: - Ensure that teams are formed inclusively by: - - Mixing departments and seniority levels - - Considering the abilities and preferences of each attendee - - Providing clear team assignments and communication channels - - 7. **Safety and Emergency Procedures**: - Develop safety and emergency procedures that are accessible to all attendees. This includes: - - Clear evacuation routes and procedures - - Accessible first aid stations - - Emergency contact information - - 8. **Communication Plan**: - Create a communication plan that ensures all attendees are informed about accessibility options and how to access them. This may include: - - Including accessibility information in event materials - - Providing a dedicated point of contact for accessibility-related questions - - Using multiple communication channels (e.g., email, event app, Slack) - - 9. **Review and Finalize**: - Review the accessibility plan to ensure it meets all requirements and addresses the diverse needs of the attendees. Make any necessary adjustments and finalize the plan. - - Your final answer should be a comprehensive accessibility plan that includes all the elements outlined above. - """.strip() - ), - requirements=[ - "The accessibility plan must include ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation" - ], - user_variables={"INFORMATION_GATHERING": information_gathering.value}, - ) - assert accessibility_plan.value is not None, ( - 'ERROR: task "accessibility_plan" execution failed' - ) - - # 22. Create a contingency plan for weather emergencies, vendor cancellations, technology failures, medical emergencies, and budget overruns. - - CONTINGENCY_PLANNING - contingency_planning = m.instruct( - textwrap.dedent( - R""" - Your task is to create a comprehensive contingency plan for the corporate team-building event. This plan should address potential risks and ensure the event can proceed smoothly despite unforeseen circumstances. Follow these steps to accomplish your task: - - 1. **Identify Potential Risks**: - - **Weather Emergencies**: Consider the possibility of extreme weather conditions that could disrupt the event. Think about both indoor and outdoor activities. - - **Vendor Cancellations**: Identify key vendors and the impact of their cancellation on the event. - - **Technology Failures**: Consider the technology requirements for the event and potential failures that could occur. - - **Medical Emergencies**: Plan for any medical emergencies that might arise during the event. - - **Budget Overruns**: Identify areas where budget overruns might occur and plan for alternative solutions. - - 2. **Develop Contingency Strategies**: - - **Weather Emergencies**: - - **Indoor Activities**: Have a backup plan for moving outdoor activities indoors. - - **Outdoor Activities**: Consider alternative dates or locations if necessary. - - **Communication**: Develop a communication plan to inform attendees of any changes due to weather. - - **Vendor Cancellations**: - - **Backup Vendors**: Identify and contract backup vendors for critical services. - - **Alternative Solutions**: Develop alternative solutions for essential services. - - **Technology Failures**: - - **Backup Equipment**: Ensure backup AV equipment and tech support are available. - - **Manual Processes**: Have manual processes in place in case of technology failures. - - **Medical Emergencies**: - - **First Aid Stations**: Ensure adequate first aid stations and trained personnel are available. - - **Emergency Protocols**: Develop clear protocols for handling medical emergencies. - - **Budget Overruns**: - - **Cost-Saving Measures**: Identify areas where costs can be reduced without compromising the event. - - **Contingency Fund**: Allocate a contingency fund to cover unexpected expenses. - - 3. **Implement and Monitor**: - - **Implementation**: Ensure all contingency plans are implemented as part of the overall event strategy. - - **Monitoring**: Continuously monitor the event for any signs of the identified risks and be prepared to activate the contingency plans as needed. - - 4. **Documentation**: - - **Contingency Plan Document**: Create a detailed contingency plan document that includes all the strategies developed. This document should be part of the comprehensive event strategy document. - - 5. **Review and Update**: - - **Regular Reviews**: Regularly review and update the contingency plan as the event approaches to ensure it remains relevant and effective. - - Use the information gathered in the previous steps to inform your contingency planning. Ensure that all aspects of the event are covered and that the contingency plans are practical and feasible. - - Finally, compile the contingency plan into a clear and concise document that can be easily referenced during the event planning and execution phases. - """.strip() - ), - requirements=[ - "The contingency planning must include weather emergencies, vendor cancellations, technology failures, medical emergencies, and budget overruns", - "All planning must follow best practices, create memorable experiences, accommodate diverse needs, stay within budget, prioritize safety, incorporate sustainable practices, leverage technology, build excitement, and measure success", - ], - user_variables={}, - ) - assert contingency_planning.value is not None, ( - 'ERROR: task "contingency_planning" execution failed' - ) - - # 23. Develop a sustainability plan with eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management. - - SUSTAINABILITY_PLAN - sustainability_plan = m.instruct( - textwrap.dedent( - R""" - Your task is to develop a comprehensive sustainability plan for the corporate team-building event. This plan should focus on minimizing the environmental impact of the event while ensuring a memorable and enjoyable experience for all participants. - - To accomplish this, follow these steps: - - 1. **Understand the Event Requirements**: - Review the gathered information about the company, event requirements, and constraints: - - {{INFORMATION_GATHERING}} - - - 2. **Identify Key Sustainability Areas**: - Focus on the following key areas to create a sustainable event: - - **Eco-friendly Venue**: Select a venue that has eco-friendly practices, such as energy-efficient lighting, waste reduction programs, and sustainable building materials. - - **Local Catering**: Partner with local caterers who source ingredients locally and use sustainable practices. Ensure they offer diverse menu options that accommodate dietary restrictions. - - **Reusable Serving Ware**: Use reusable or compostable serving ware to minimize waste. Avoid single-use plastics and encourage the use of reusable cups, plates, and cutlery. - - **Digital Communications**: Utilize digital communications for invitations, reminders, and event information to reduce paper waste. Create a mobile event app for scheduling and messaging. - - **Recyclable Decorations**: Choose decorations that are recyclable or made from sustainable materials. Avoid non-biodegradable materials and opt for eco-friendly alternatives. - - **Waste Management**: Implement a comprehensive waste management plan that includes recycling stations, composting, and proper disposal of waste. Educate participants on the importance of waste reduction and proper disposal methods. - - 3. **Develop Detailed Strategies**: - For each key area, develop detailed strategies that outline the steps to be taken, the resources required, and the expected outcomes. Ensure that the strategies align with the overall event goals and constraints. - - 4. **Create a Sustainability Timeline**: - Integrate the sustainability plan into the overall event timeline. Ensure that sustainability initiatives are scheduled appropriately and that all necessary actions are taken in a timely manner. - - 5. **Budget Considerations**: - Review the budget breakdown to ensure that the sustainability plan is cost-effective and aligns with the total estimated budget: - - {{BUDGET_BREAKDOWN}} - - - 6. **Communication Plan**: - Develop a communication plan to inform participants about the sustainability initiatives. Use the marketing and communication strategy to promote the event's eco-friendly practices: - - {{MARKETING_STRATEGY}} - - - 7. **Vendor Management**: - Ensure that all vendors adhere to the sustainability plan. Include sustainability criteria in the vendor selection process and monitor their compliance throughout the event: - - {{VENDOR_MANAGEMENT}} - - - 8. **Post-Event Evaluation**: - Include sustainability metrics in the post-event evaluation plan. Assess the effectiveness of the sustainability initiatives and identify areas for improvement in future events: - - {{POST_EVENT_EVALUATION}} - - - 9. **Contingency Planning**: - Develop contingency plans for potential sustainability challenges, such as waste management issues or vendor non-compliance. Ensure that the contingency planning aligns with the overall event strategy: - - {{CONTINGENCY_PLANNING}} - - - 10. **Finalize the Sustainability Plan**: - Compile all the information into a detailed sustainability plan that outlines the strategies, timelines, budget considerations, communication plans, vendor management, post-event evaluation, and contingency planning. - - Ensure that the sustainability plan is integrated into the comprehensive event strategy document and that all planning follows best practices, creates memorable experiences, accommodates diverse needs, stays within budget, prioritizes safety, incorporates sustainable practices, leverages technology, builds excitement, and measures success. - """.strip() - ), - requirements=[ - "The sustainability plan must include eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management", - "All planning must follow best practices, create memorable experiences, accommodate diverse needs, stay within budget, prioritize safety, incorporate sustainable practices, leverage technology, build excitement, and measure success", - ], - user_variables={ - "INFORMATION_GATHERING": information_gathering.value, - "BUDGET_BREAKDOWN": budget_breakdown.value, - "MARKETING_STRATEGY": marketing_strategy.value, - "VENDOR_MANAGEMENT": vendor_management.value, - "POST_EVENT_EVALUATION": post_event_evaluation.value, - "CONTINGENCY_PLANNING": contingency_planning.value, - }, - ) - assert sustainability_plan.value is not None, ( - 'ERROR: task "sustainability_plan" execution failed' - ) - - # 24. Compile all the information into a comprehensive event strategy document. - - EVENT_STRATEGY_DOCUMENT - event_strategy_document = m.instruct( - textwrap.dedent( - R""" - Your task is to compile all the information gathered and planned in the previous steps into a comprehensive event strategy document. This document will serve as the blueprint for executing the corporate team-building event. - - To accomplish this, follow these steps: - - 1. **Review All Previous Steps**: - Carefully review the information and plans developed in the previous steps. This includes: - - Information Gathering: {{INFORMATION_GATHERING}} - - Planning Timeline: {{PLANNING_TIMELINE}} - - Budget Breakdown: {{BUDGET_BREAKDOWN}} - - Marketing Strategy: {{MARKETING_STRATEGY}} - - Venue Selection: {{VENUE_SELECTION}} - - Event Schedule: {{EVENT_SCHEDULE}} - - Icebreaker Plans: {{ICEBREAKER_PLANS}} - - Team Formation: {{TEAM_FORMATION}} - - Workshop Content: {{WORKSHOP_CONTENT}} - - Catering Plan: {{CATERING_PLAN}} - - Activity Logistics: {{ACTIVITY_LOGISTICS}} - - Transportation Plan: {{TRANSPORTATION_PLAN}} - - Registration Process: {{REGISTRATION_PROCESS}} - - Safety Plan: {{SAFETY_PLAN}} - - Vendor Management: {{VENDOR_MANAGEMENT}} - - Technology Plan: {{TECHNOLOGY_PLAN}} - - Decoration Strategy: {{DECORATION_STRATEGY}} - - Entertainment Plan: {{ENTERTAINMENT_PLAN}} - - Prize Strategy: {{PRIZE_STRATEGY}} - - Post-Event Evaluation: {{POST_EVENT_EVALUATION}} - - Accessibility Plan: {{ACCESSIBILITY_PLAN}} - - Sustainability Plan: {{SUSTAINABILITY_PLAN}} - - Contingency Planning: {{CONTINGENCY_PLANNING}} - - 2. **Organize the Information**: - Structure the event strategy document in a logical and coherent manner. Use clear headings and subheadings to organize the content. Here is a suggested structure: - - **Executive Summary**: A brief overview of the event's objectives, key highlights, and expected outcomes. - - **Event Overview**: Detailed description of the event, including its purpose, goals, and target audience. - - **Planning Timeline**: The detailed planning timeline starting 6 months before the event with weekly milestones. - - **Budget Breakdown**: Comprehensive breakdown of the budget for venue rental, catering, entertainment, transportation, technology, and total estimated budget. - - **Marketing and Communication Strategy**: Detailed strategy for save-the-date announcements, formal invitations, reminder emails, internal campaigns, and other communication methods. - - **Venue Selection**: Process for evaluating and selecting the best venue based on capacity, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi, catering facilities, accommodations, and cost-effectiveness. - - **Event Schedule**: Detailed event schedule from 8:00 AM to 8:00 PM including registration, breakfast, opening ceremony, icebreaker activities, workshops, lunch, team challenges, awards ceremony, and dinner with entertainment. - - **Icebreaker Activities**: List of 15 icebreaker activities with detailed plans. - - **Team Formation Strategy**: Strategy for forming diverse teams with a mix of departments and seniority, pre-event survey for dietary restrictions, and team assignments 2 weeks before the event. - - **Workshop Content**: Content for leadership, innovation, communication, and wellness workshops. - - **Catering Plan**: Detailed catering plan with breakfast, lunch, afternoon snacks, and dinner options. - - **Activity Logistics**: Logistics for all planned activities including equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules. - - **Transportation Plan**: Plan for charter buses, parking management, shuttle service, and contingency plans. - - **Registration Process**: Process for online portal, on-site check-in, name tags, welcome packets, and staff training. - - **Safety Plan**: Comprehensive safety plan including insurance, first aid stations, evacuation procedures, weather contingencies, food safety, security personnel, and incident reporting. - - **Vendor Management**: Strategy for vendor selection, contracts, payment schedules, and evaluation forms. - - **Technology Plan**: Plan for event app, AV equipment, WiFi, photography services, live streaming, and tech support. - - **Decoration Strategy**: Strategy for signage, team colors, photo backdrops, and sustainable options. - - **Entertainment Plan**: Plan for live band or DJ, emcee, interactive activities, and evening games. - - **Prize Strategy**: Strategy for team prizes, individual awards, participation gifts, and raffle prizes. - - **Post-Event Evaluation**: Plan for participant survey, debriefing sessions, budget reconciliation, photo compilation, impact assessment, and thank you communications. - - **Accessibility Plan**: Plan for ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation. - - **Sustainability Plan**: Plan for eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management. - - **Contingency Planning**: Plan for weather emergencies, vendor cancellations, technology failures, medical emergencies, and budget overruns. - - 3. **Compile the Document**: - Combine all the organized information into a single, cohesive document. Ensure that the document is well-structured, easy to read, and includes all necessary details for executing the event. - - 4. **Review and Finalize**: - Review the compiled document to ensure accuracy, completeness, and clarity. Make any necessary adjustments to ensure that the document meets all requirements and standards. - - 5. **Output the Event Strategy Document**: - Provide the final event strategy document as your answer. Ensure that the document is well-formatted and ready for use. - """.strip() - ), - requirements=[ - "The event strategy document must include detailed planning timelines starting 6 months before the event with weekly milestones", - "The budget breakdowns must include venue rental at $15,000-25,000, catering at $75-125 per person, entertainment and activities at $10,000-20,000, transportation at $3,000-8,000, technology at $5,000-10,000, and total estimated budget of $50,000-125,000", - "The marketing and communication strategy must include save-the-date announcements 4 months in advance, formal invitations 2 months before, weekly reminder emails, internal campaigns, dedicated Slack channel, executive videos, and mobile event app", - "The venue selection process must evaluate 10 venues based on capacity for 100-300 people, accessibility, parking, indoor/outdoor space, AV capabilities, WiFi for 300+ devices, catering facilities, accommodations, and cost-effectiveness", - "The event schedule must include registration and breakfast at 8:00-9:00 AM, opening ceremony at 9:00-9:30 AM with CEO speech, icebreaker activities at 9:30-10:30 AM including human bingo and speed networking, morning workshops at 10:30 AM-12:30 PM with tracks on leadership, innovation, communication, and wellness, lunch at 12:30-2:00 PM with diverse menu options, afternoon team challenges at 2:00-5:00 PM including scavenger hunt, escape rooms, outdoor adventures, cooking competition, and sports tournaments, awards ceremony at 5:00-5:30 PM, and dinner with entertainment at 5:30-8:00 PM", - "The icebreaker plans must include 15 options including human knot, marshmallow tower, obstacle course, pictionary, charades, and trust falls", - "The team formation strategy must include diverse mix of departments and seniority in teams of 8-12 people, pre-event survey for dietary restrictions and preferences, and team assignments 2 weeks before with names and colors", - "The workshop content must include leadership case studies, innovation brainstorming, communication exercises, and wellness meditation", - "The catering plan must include breakfast coffee station and pastries, lunch buffet with salad bar and hot entrees, afternoon snacks, and dinner with three entree choices and full bar", - "The activity logistics must include equipment lists, setup instructions, safety protocols, facilitator guides, scoring systems, and rotation schedules", - "The transportation plan must include charter buses, parking management, shuttle service, and contingency plans", - "The registration process must include online portal, on-site check-in, name tags, welcome packets with schedule and swag, and staff training", - "The safety plan must include insurance, first aid stations, evacuation procedures, weather contingencies, food safety with allergen labeling, security personnel, and incident reporting", - "The vendor management strategy must include selection criteria, contracts, payment schedules, and evaluation forms", - "The technology plan must include event app for scheduling and messaging, AV equipment, WiFi for 300+ connections, photography services, live streaming, and tech support", - "The decoration strategy must include signage, team colors, photo backdrops, and sustainable options", - "The entertainment plan must include live band or DJ, emcee, interactive activities, and evening games", - "The prize strategy must include team prizes at $500, $300, and $200, individual awards, participation gifts, and raffle prizes", - "The post-event evaluation must include participant survey within 24 hours, debriefing sessions, budget reconciliation, photo compilation, impact assessment, and thank you communications", - "The accessibility plan must include ADA compliance, interpreters, activity modifications, dietary accommodation, and inclusive team formation", - "The sustainability plan must include eco-friendly venue, local catering, reusable serving ware, digital communications, recyclable decorations, and waste management", - "The contingency planning must include weather emergencies, vendor cancellations, technology failures, medical emergencies, and budget overruns", - "All planning must follow best practices, create memorable experiences, accommodate diverse needs, stay within budget, prioritize safety, incorporate sustainable practices, leverage technology, build excitement, and measure success", - ], - user_variables={ - "INFORMATION_GATHERING": information_gathering.value, - "PLANNING_TIMELINE": planning_timeline.value, - "BUDGET_BREAKDOWN": budget_breakdown.value, - "MARKETING_STRATEGY": marketing_strategy.value, - "VENUE_SELECTION": venue_selection.value, - "EVENT_SCHEDULE": event_schedule.value, - "ICEBREAKER_PLANS": icebreaker_plans.value, - "TEAM_FORMATION": team_formation.value, - "WORKSHOP_CONTENT": workshop_content.value, - "CATERING_PLAN": catering_plan.value, - "ACTIVITY_LOGISTICS": activity_logistics.value, - "TRANSPORTATION_PLAN": transportation_plan.value, - "REGISTRATION_PROCESS": registration_process.value, - "SAFETY_PLAN": safety_plan.value, - "VENDOR_MANAGEMENT": vendor_management.value, - "TECHNOLOGY_PLAN": technology_plan.value, - "DECORATION_STRATEGY": decoration_strategy.value, - "ENTERTAINMENT_PLAN": entertainment_plan.value, - "PRIZE_STRATEGY": prize_strategy.value, - "POST_EVENT_EVALUATION": post_event_evaluation.value, - "ACCESSIBILITY_PLAN": accessibility_plan.value, - "SUSTAINABILITY_PLAN": sustainability_plan.value, - "CONTINGENCY_PLANNING": contingency_planning.value, - }, - ) - assert event_strategy_document.value is not None, ( - 'ERROR: task "event_strategy_document" execution failed' - ) - - final_answer = event_strategy_document.value - - print(final_answer) diff --git a/docs/examples/m_decompose/python/python_decompose_example.py b/docs/examples/m_decompose/python/python_decompose_example.py index 21faf6444..d8d31ad23 100644 --- a/docs/examples/m_decompose/python/python_decompose_example.py +++ b/docs/examples/m_decompose/python/python_decompose_example.py @@ -178,7 +178,7 @@ def display_results(result: DecompPipelineResult): print(f"\n🔍 Constraints Identified ({len(result['identified_constraints'])}):") for i, constraint in enumerate(result["identified_constraints"], 1): print(f" {i}. {constraint['constraint']}") - print(f" Validation: {constraint['validation_strategy']}") + print(f" Validation: {constraint['val_strategy']}") print(f"\n🎯 Detailed Subtasks ({len(result['subtasks'])}):") for i, subtask_detail in enumerate(result["subtasks"], 1): diff --git a/docs/examples/m_decompose/small/m_decomp_result.json b/docs/examples/m_decompose/small/m_decomp_result.json index 50cb497c9..378af18fe 100644 --- a/docs/examples/m_decompose/small/m_decomp_result.json +++ b/docs/examples/m_decompose/small/m_decomp_result.json @@ -11,35 +11,35 @@ "identified_constraints": [ { "constraint": "The shopping list must include decorations, food, drinks, party favors, and a cake that serves at least 20 people", - "validation_strategy": "llm" + "val_strategy": "llm" }, { "constraint": "Suggest 5-7 age-appropriate party games or activities that fit the unicorn theme and can keep the kids entertained for about 3 hours", - "validation_strategy": "llm" + "val_strategy": "llm" }, { "constraint": "Write out a timeline for the party day starting from 2 hours before guests arrive until cleanup is done showing exactly when to do food prep, decoration setup, when each activity should happen, and when to serve food and cake", - "validation_strategy": "llm" + "val_strategy": "llm" }, { "constraint": "Draft a cute invitation text that includes all the important details like date, time, location, RSVP information, and any special instructions about allergies or what kids should bring or wear", - "validation_strategy": "llm" + "val_strategy": "llm" }, { "constraint": "Create a backup plan in case it rains", - "validation_strategy": "llm" + "val_strategy": "llm" }, { "constraint": "Everything must stay within a total budget of about ~$400", - "validation_strategy": "code" + "val_strategy": "code" }, { "constraint": "Follow basic food safety guidelines especially for kids with common allergies like nuts and dairy", - "validation_strategy": "llm" + "val_strategy": "llm" }, { "constraint": "The party theme colors should be pink, purple, and gold to match the unicorn decorations", - "validation_strategy": "llm" + "val_strategy": "llm" } ], "subtasks": [ @@ -49,19 +49,19 @@ "constraints": [ { "constraint": "The shopping list must include decorations, food, drinks, party favors, and a cake that serves at least 20 people", - "validation_strategy": "llm" + "val_strategy": "llm" }, { "constraint": "Everything must stay within a total budget of about ~$400", - "validation_strategy": "code" + "val_strategy": "code" }, { "constraint": "Follow basic food safety guidelines especially for kids with common allergies like nuts and dairy", - "validation_strategy": "llm" + "val_strategy": "llm" }, { "constraint": "The party theme colors should be pink, purple, and gold to match the unicorn decorations", - "validation_strategy": "llm" + "val_strategy": "llm" } ], "prompt_template": "Your task is to create a detailed shopping list with estimated costs for decorations, food, drinks, party favors, and a cake that serves at least 20 people, ensuring the total budget stays within $400. Follow these steps to accomplish your task:\n\n1. **Understand the Requirements**:\n - The party is for an 8-year-old daughter who loves unicorns.\n - The party theme colors are pink, purple, and gold.\n - The party will have 15 kids from her class, but the cake should serve at least 20 people.\n - The total budget should not exceed $400.\n - Follow basic food safety guidelines, especially for kids with common allergies like nuts and dairy.\n\n2. **Categories to Include**:\n - **Decorations**: Unicorn-themed decorations in pink, purple, and gold.\n - **Food**: Finger foods and snacks suitable for kids.\n - **Drinks**: Beverages that are kid-friendly.\n - **Party Favors**: Small gifts or treats for each child.\n - **Cake**: A unicorn-themed cake that serves at least 20 people.\n\n3. **Estimate Costs**:\n - Research and list the estimated costs for each item.\n - Ensure the total cost of all items does not exceed $400.\n\n4. **Create the Shopping List**:\n - Organize the list by categories (decorations, food, drinks, party favors, cake).\n - Include the name of each item, the estimated cost, and the quantity needed.\n - Ensure all items fit within the unicorn theme and the specified colors.\n\n5. **Review the List**:\n - Double-check that all necessary items are included.\n - Verify that the total estimated cost is within the $400 budget.\n\n6. **Output the Shopping List**:\n - Present the shopping list in a clear and organized format.\n - Include the estimated cost for each item and the total estimated cost.\n\nHere is an example structure to guide your writing:\n- **Decorations**:\n - Item 1: [Description], Quantity: [Number], Estimated Cost: [$Amount]\n - Item 2: [Description], Quantity: [Number], Estimated Cost: [$Amount]\n- **Food**:\n - Item 1: [Description], Quantity: [Number], Estimated Cost: [$Amount]\n - Item 2: [Description], Quantity: [Number], Estimated Cost: [$Amount]\n- **Drinks**:\n - Item 1: [Description], Quantity: [Number], Estimated Cost: [$Amount]\n - Item 2: [Description], Quantity: [Number], Estimated Cost: [$Amount]\n- **Party Favors**:\n - Item 1: [Description], Quantity: [Number], Estimated Cost: [$Amount]\n - Item 2: [Description], Quantity: [Number], Estimated Cost: [$Amount]\n- **Cake**:\n - Item 1: [Description], Quantity: [Number], Estimated Cost: [$Amount]\n\nEnsure that the shopping list is comprehensive and meets all the specified requirements.", @@ -74,11 +74,11 @@ "constraints": [ { "constraint": "Suggest 5-7 age-appropriate party games or activities that fit the unicorn theme and can keep the kids entertained for about 3 hours", - "validation_strategy": "llm" + "val_strategy": "llm" }, { "constraint": "The party theme colors should be pink, purple, and gold to match the unicorn decorations", - "validation_strategy": "llm" + "val_strategy": "llm" } ], "prompt_template": "Your task is to suggest 5-7 age-appropriate party games or activities that fit the unicorn theme and can keep the kids entertained for about 3 hours. Follow these steps to accomplish your task:\n\n1. **Understand the Theme and Audience**:\n - The party theme is unicorns, and the target audience is 8-year-old kids.\n - The party should be fun, engaging, and age-appropriate.\n - The theme colors are pink, purple, and gold.\n\n2. **Consider the Duration**:\n - The activities should keep the kids entertained for about 3 hours.\n - Plan a mix of active and passive games to maintain engagement.\n\n3. **Brainstorm Activity Ideas**:\n - Think of games and activities that fit the unicorn theme.\n - Ensure the activities are safe, fun, and suitable for 8-year-olds.\n - Consider both indoor and outdoor activities in case of rain.\n\n4. **List the Activities**:\n - Provide a list of 5-7 activities with brief descriptions.\n - Include any necessary materials or preparations for each activity.\n - Ensure the activities are varied to keep the kids interested.\n\n5. **Review the Shopping List**:\n - Refer to the shopping list created in the previous step to ensure you have all the necessary materials for the activities:\n \n {{SHOPPING_LIST}}\n \n\n6. **Finalize the Activities**:\n - Ensure the activities are feasible within the budget and theme.\n - Make sure the activities are safe and consider any common allergies or dietary restrictions.\n\nHere is an example structure to guide your suggestions:\n- **Activity 1**: [Description]\n- **Activity 2**: [Description]\n- **Activity 3**: [Description]\n- **Activity 4**: [Description]\n- **Activity 5**: [Description]\n- **Activity 6**: [Description]\n- **Activity 7**: [Description]\n\nEnsure each activity is clearly described and fits the unicorn theme. You should write only the activities, do not include the guidance structure.", @@ -93,11 +93,11 @@ "constraints": [ { "constraint": "Write out a timeline for the party day starting from 2 hours before guests arrive until cleanup is done showing exactly when to do food prep, decoration setup, when each activity should happen, and when to serve food and cake", - "validation_strategy": "llm" + "val_strategy": "llm" }, { "constraint": "Follow basic food safety guidelines especially for kids with common allergies like nuts and dairy", - "validation_strategy": "llm" + "val_strategy": "llm" } ], "prompt_template": "Your task is to draft a detailed timeline for the birthday party day, starting from 2 hours before guests arrive until cleanup is done. The timeline should include food prep, decoration setup, and scheduling of activities, ensuring the party runs smoothly and stays within the allocated time.\n\nTo accomplish this, follow these steps:\n\n1. **Review the Shopping List and Party Games**:\n First, review the shopping list and party games that have been prepared in the previous steps. This will help you understand the tasks that need to be scheduled and the activities that will take place during the party.\n \n {{SHOPPING_LIST}}\n \n \n {{PARTY_GAMES}}\n \n\n2. **Plan the Timeline**:\n Create a timeline that starts 2 hours before the guests arrive and ends with the cleanup after the party. Include the following key elements:\n - **Decoration Setup**: Schedule the setup of decorations, ensuring they are in place before guests arrive.\n - **Food Prep**: Plan the preparation of food and drinks, including any last-minute tasks that need to be done just before serving.\n - **Activity Schedule**: Allocate time slots for each of the 5-7 party games or activities, ensuring they are spaced out appropriately to keep the kids entertained for about 3 hours.\n - **Food and Cake Serving**: Schedule the serving of food and cake, making sure it fits well within the activity timeline.\n - **Cleanup**: Include a time slot for cleanup after the party, ensuring all tasks are completed efficiently.\n\n3. **Ensure Logical Flow**:\n Make sure the timeline flows logically, with each task leading smoothly into the next. Consider the time required for each activity and the transitions between them.\n\n4. **Include Buffer Time**:\n Add buffer time between activities to account for any unexpected delays or transitions.\n\n5. **Finalize the Timeline**:\n Compile all the scheduled tasks into a clear and concise timeline. Ensure it is easy to follow and includes all necessary details.\n\nHere is an example structure to guide your writing:\n- **2 Hours Before Guests Arrive**: Start decoration setup and initial food prep.\n- **1.5 Hours Before Guests Arrive**: Complete decoration setup and continue food prep.\n- **1 Hour Before Guests Arrive**: Final touches on decorations and food prep.\n- **Guests Arrive**: Welcome guests and begin the first activity.\n- **Activity 1**: [Describe the activity and its duration]\n- **Activity 2**: [Describe the activity and its duration]\n- **Serve Food**: [Schedule the serving of food]\n- **Activity 3**: [Describe the activity and its duration]\n- **Serve Cake**: [Schedule the serving of cake]\n- **Activity 4**: [Describe the activity and its duration]\n- **Activity 5**: [Describe the activity and its duration]\n- **Cleanup**: [Schedule the cleanup tasks]\n\nEnsure that each time slot is clearly defined and that the timeline is easy to follow. You should write only the timeline, do not include the guidance structure.", @@ -113,11 +113,11 @@ "constraints": [ { "constraint": "Draft a cute invitation text that includes all the important details like date, time, location, RSVP information, and any special instructions about allergies or what kids should bring or wear", - "validation_strategy": "llm" + "val_strategy": "llm" }, { "constraint": "The party theme colors should be pink, purple, and gold to match the unicorn decorations", - "validation_strategy": "llm" + "val_strategy": "llm" } ], "prompt_template": "Your task is to create a cute invitation text for an 8-year-old's unicorn-themed birthday party. The invitation should include all the important details and follow the party's theme colors: pink, purple, and gold.\n\nTo accomplish this, follow these steps:\n\n1. **Gather Party Details**:\n - Review the shopping list, party games, and timeline created in the previous steps to gather all necessary information:\n \n {{SHOPPING_LIST}}\n \n \n {{PARTY_GAMES}}\n \n \n {{PARTY_TIMELINE}}\n \n\n2. **Include Essential Information**:\n - **Date and Time**: Clearly state the date and time of the party.\n - **Location**: Provide the address and any specific instructions for getting to the party location.\n - **RSVP Information**: Include a contact email or phone number for RSVP and any deadline for responding.\n - **Special Instructions**: Mention any allergies, what kids should bring or wear, and any other important notes.\n\n3. **Theme and Tone**:\n - Use a cute and playful tone that fits the unicorn theme.\n - Incorporate the theme colors (pink, purple, and gold) into the design and wording of the invitation.\n\n4. **Format the Invitation**:\n - Use a clear and organized format, such as bullet points or paragraphs, to present the information.\n - Make sure the invitation is easy to read and visually appealing.\n\n5. **Example Structure**:\n - **Header**: A fun and colorful header that says \"Unicorn Birthday Party!\"\n - **Body**:\n - \"You're invited to [Child's Name]'s Unicorn Birthday Party!\"\n - \"Date: [Date]\"\n - \"Time: [Time]\"\n - \"Location: [Location]\"\n - \"RSVP by [Date] to [Email/Phone Number]\"\n - \"Special Instructions: [Allergies, what to bring or wear, etc.]\"\n - **Footer**: A cute closing line like \"Hope to see you there for a magical time!\"\n\n6. **Review and Finalize**:\n - Ensure all important details are included and the invitation is error-free.\n - Make any necessary adjustments to ensure the invitation is clear, cute, and fits the unicorn theme.\n\nFinally, write the cute invitation text based on the above guidelines and provide it as your answer.", @@ -134,7 +134,7 @@ "constraints": [ { "constraint": "Create a backup plan in case it rains", - "validation_strategy": "llm" + "val_strategy": "llm" } ], "prompt_template": "Your task is to develop a backup plan in case it rains, ensuring all activities can be moved indoors. Follow these steps to accomplish your task:\n\nFirst, review the shopping list, party games, timeline, and invitation text from the previous steps to understand the party setup and activities:\n\n{{SHOPPING_LIST}}\n\n\n{{PARTY_GAMES}}\n\n\n{{PARTY_TIMELINE}}\n\n\n{{INVITATION_TEXT}}\n\n\nNext, consider the following factors for the backup plan:\n1. **Indoor Space**: Ensure that the indoor space is large enough to accommodate all the activities and guests comfortably.\n2. **Activity Adjustments**: Modify the party games and activities to fit the indoor space. Consider the following:\n - **Space Constraints**: Ensure that games like \"Pin the Horn on the Unicorn\" or \"Unicorn Ring Toss\" can be played indoors without any hazards.\n - **Noise Levels**: Adjust activities to minimize noise, especially if the party is in a residential area.\n - **Safety**: Ensure that all indoor activities are safe and age-appropriate.\n3. **Food and Drinks**: Plan how to serve food and drinks indoors. Consider using tables or a buffet-style setup to minimize clutter.\n4. **Decorations**: Adjust the decoration setup to fit the indoor space. Ensure that the decorations are still visually appealing and fit the unicorn theme.\n5. **Timeline Adjustments**: Modify the party timeline to account for indoor activities. Ensure that the timeline is still efficient and keeps the kids entertained.\n\nFinally, write a detailed backup plan that includes:\n- **Indoor Activity Schedule**: A list of adjusted activities with their respective times.\n- **Indoor Setup Instructions**: Detailed instructions on how to set up the indoor space, including decorations, food, and drink stations.\n- **Safety Guidelines**: Any additional safety guidelines or considerations for indoor activities.\n\nEnsure that the backup plan is clear, concise, and easy to follow. The plan should allow for a smooth transition from outdoor to indoor activities in case of rain.", @@ -152,15 +152,15 @@ "constraints": [ { "constraint": "Everything must stay within a total budget of about ~$400", - "validation_strategy": "code" + "val_strategy": "code" }, { "constraint": "Follow basic food safety guidelines especially for kids with common allergies like nuts and dairy", - "validation_strategy": "llm" + "val_strategy": "llm" }, { "constraint": "The party theme colors should be pink, purple, and gold to match the unicorn decorations", - "validation_strategy": "llm" + "val_strategy": "llm" } ], "prompt_template": "Your task is to compile the shopping list, party games, timeline, invitation text, and backup plan into a single cohesive output for the birthday party. Follow these steps to accomplish your task:\n\n1. **Review the Shopping List**:\n Carefully review the detailed shopping list with estimated costs for decorations, food, drinks, party favors, and a cake that serves at least 20 people. Ensure the total budget stays within $400.\n \n {{SHOPPING_LIST}}\n \n\n2. **Review the Party Games**:\n Review the suggested 5-7 age-appropriate party games or activities that fit the unicorn theme and can keep the kids entertained for about 3 hours.\n \n {{PARTY_GAMES}}\n \n\n3. **Review the Party Timeline**:\n Review the timeline for the party day starting from 2 hours before guests arrive until cleanup is done, including food prep, decoration setup, and scheduling of activities.\n \n {{PARTY_TIMELINE}}\n \n\n4. **Review the Invitation Text**:\n Review the cute invitation text that includes all the important details like date, time, location, RSVP information, and any special instructions about allergies or what kids should bring or wear.\n \n {{INVITATION_TEXT}}\n \n\n5. **Review the Backup Plan**:\n Review the backup plan in case it rains, ensuring all activities can be moved indoors.\n \n {{BACKUP_PLAN}}\n \n\n6. **Compile the Information**:\n Combine all the reviewed information into a single cohesive output. Ensure that the output is well-organized and easy to follow. Include the following sections in your final output:\n - **Shopping List**: Detailed list with estimated costs.\n - **Party Games**: Suggested activities with descriptions.\n - **Party Timeline**: Step-by-step schedule for the party day.\n - **Invitation Text**: Cute and informative text for parents.\n - **Backup Plan**: Plan for indoor activities in case of rain.\n\n7. **Final Output**:\n Present the compiled information in a clear and concise manner. Ensure that all details are included and that the output is easy to read and understand.\n\nYour final output should be a comprehensive guide that includes all the necessary information for planning and executing the birthday party.", diff --git a/test/decompose/test_decompose.py b/test/decompose/test_decompose.py index 883ff905f..d23cbcf62 100644 --- a/test/decompose/test_decompose.py +++ b/test/decompose/test_decompose.py @@ -1,760 +1,379 @@ -"""Tests for cli/decompose/decompose.py functions. +"""Tests for ``cli/decompose/decompose.py`` run flow. -This module tests the reorder_subtasks and verify_user_variables functions -which handle dependency ordering and validation of decomposition results. +This module validates prompt loading, argument forwarding, template selection, +output writing, multi-job behavior, and cleanup behavior for the ``run`` command. """ +from pathlib import Path +from typing import Any +from unittest.mock import Mock + import pytest -from cli.decompose.decompose import reorder_subtasks, verify_user_variables -from cli.decompose.pipeline import DecompPipelineResult, DecompSubtasksResult +from cli.decompose.decompose import DecompVersion, run +from cli.decompose.logging import LogMode +from cli.decompose.pipeline import DecompBackend, DecompPipelineResult -# ============================================================================ -# Tests for reorder_subtasks -# ============================================================================ +class DummyTemplate: + """Minimal Jinja template stub used by tests.""" -class TestReorderSubtasksHappyPath: - """Happy path tests for reorder_subtasks function.""" + def render(self, **kwargs: Any) -> str: + return "# generated test program" - def test_no_dependencies(self) -> None: - """Test subtasks with no dependencies remain in original order.""" - subtasks: list[DecompSubtasksResult] = [ - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": [], - }, - { - "subtask": "Task B", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": [], - }, - { - "subtask": "Task C", - "tag": "TASK_C", - "constraints": [], - "prompt_template": "Do C", - "input_vars_required": [], - "depends_on": [], - }, - ] - result = reorder_subtasks(subtasks) +class DummyEnvironment: + """Minimal Jinja environment stub used by tests.""" - # Should maintain alphabetical order (topological sort is stable) - assert len(result) == 3 - assert result[0]["tag"] == "TASK_A" - assert result[1]["tag"] == "TASK_B" - assert result[2]["tag"] == "TASK_C" - - def test_simple_linear_dependency(self) -> None: - """Test simple linear dependency chain: C -> B -> A.""" - subtasks: list[DecompSubtasksResult] = [ - { - "subtask": "Task C", - "tag": "TASK_C", - "constraints": [], - "prompt_template": "Do C", - "input_vars_required": [], - "depends_on": ["TASK_B"], - }, - { - "subtask": "Task B", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": [], - }, - ] + def __init__(self, *args: Any, **kwargs: Any) -> None: + pass - result = reorder_subtasks(subtasks) + def get_template(self, template_name: str) -> DummyTemplate: + return DummyTemplate() - # Should reorder to A, B, C - assert len(result) == 3 - assert result[0]["tag"] == "TASK_A" - assert result[1]["tag"] == "TASK_B" - assert result[2]["tag"] == "TASK_C" - def test_diamond_dependency(self) -> None: - """Test diamond dependency: D depends on B and C, both depend on A.""" - subtasks: list[DecompSubtasksResult] = [ - { - "subtask": "Task D", - "tag": "TASK_D", - "constraints": [], - "prompt_template": "Do D", - "input_vars_required": [], - "depends_on": ["TASK_B", "TASK_C"], - }, - { - "subtask": "Task C", - "tag": "TASK_C", - "constraints": [], - "prompt_template": "Do C", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - { - "subtask": "Task B", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, +def make_decomp_result() -> DecompPipelineResult: + """Create a minimal valid decomposition result for CLI tests.""" + return { + "original_task_prompt": "Test task prompt", + "subtask_list": ["Task A"], + "identified_constraints": [], + "subtasks": [ { "subtask": "Task A", "tag": "TASK_A", + "general_instructions": "", "constraints": [], "prompt_template": "Do A", "input_vars_required": [], "depends_on": [], - }, - ] - - result = reorder_subtasks(subtasks) - - # A must be first, D must be last, B and C can be in either order - assert len(result) == 4 - assert result[0]["tag"] == "TASK_A" - assert result[3]["tag"] == "TASK_D" - assert {result[1]["tag"], result[2]["tag"]} == {"TASK_B", "TASK_C"} - - def test_case_insensitive_dependencies(self) -> None: - """Test that dependencies are case-insensitive.""" - subtasks: list[DecompSubtasksResult] = [ - { - "subtask": "Task B", - "tag": "task_b", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": ["TASK_A"], # Uppercase reference - }, - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": [], - }, - ] - - result = reorder_subtasks(subtasks) - - assert len(result) == 2 - assert result[0]["tag"] == "TASK_A" - assert result[1]["tag"] == "task_b" - - def test_multiple_independent_chains(self) -> None: - """Test multiple independent dependency chains.""" - subtasks: list[DecompSubtasksResult] = [ - # Chain 1: B -> A - { - "subtask": "Task B", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": [], - }, - # Chain 2: D -> C - { - "subtask": "Task D", - "tag": "TASK_D", - "constraints": [], - "prompt_template": "Do D", - "input_vars_required": [], - "depends_on": ["TASK_C"], - }, - { - "subtask": "Task C", - "tag": "TASK_C", - "constraints": [], - "prompt_template": "Do C", - "input_vars_required": [], - "depends_on": [], - }, - ] - - result = reorder_subtasks(subtasks) - - # A before B, C before D - assert len(result) == 4 - a_idx = next(i for i, t in enumerate(result) if t["tag"] == "TASK_A") - b_idx = next(i for i, t in enumerate(result) if t["tag"] == "TASK_B") - c_idx = next(i for i, t in enumerate(result) if t["tag"] == "TASK_C") - d_idx = next(i for i, t in enumerate(result) if t["tag"] == "TASK_D") - assert a_idx < b_idx - assert c_idx < d_idx - - def test_nonexistent_dependency_ignored(self) -> None: - """Test that dependencies referencing non-existent tasks are ignored.""" - subtasks: list[DecompSubtasksResult] = [ - { - "subtask": "Task B", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": [ - "TASK_A", - "NONEXISTENT", - ], # NONEXISTENT should be ignored - }, - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": [], - }, - ] - - result = reorder_subtasks(subtasks) - - # Should still work, ignoring the nonexistent dependency - assert len(result) == 2 - assert result[0]["tag"] == "TASK_A" - assert result[1]["tag"] == "TASK_B" - - def test_renumbers_subtask_descriptions(self) -> None: - """Test that subtask descriptions with numbers are renumbered after reordering.""" - subtasks: list[DecompSubtasksResult] = [ - { - "subtask": "3. Do task C", - "tag": "TASK_C", - "constraints": [], - "prompt_template": "Do C", - "input_vars_required": [], - "depends_on": ["TASK_B"], - }, - { - "subtask": "2. Do task B", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - { - "subtask": "1. Do task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": [], - }, - ] - - result = reorder_subtasks(subtasks) - - # Should reorder and renumber - assert len(result) == 3 - assert result[0]["subtask"] == "1. Do task A" - assert result[1]["subtask"] == "2. Do task B" - assert result[2]["subtask"] == "3. Do task C" - - def test_renumbers_only_numbered_subtasks(self) -> None: - """Test that only subtasks starting with numbers are renumbered.""" - subtasks: list[DecompSubtasksResult] = [ - { - "subtask": "2. Numbered task B", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - { - "subtask": "Unnumbered task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": [], - }, - ] - - result = reorder_subtasks(subtasks) - - # A should stay unnumbered, B should be renumbered to 2 - assert len(result) == 2 - assert result[0]["subtask"] == "Unnumbered task A" - assert result[1]["subtask"] == "2. Numbered task B" - - def test_renumbers_with_complex_reordering(self) -> None: - """Test renumbering with reordering.""" - subtasks: list[DecompSubtasksResult] = [ - { - "subtask": "4. Final task", - "tag": "TASK_D", - "constraints": [], - "prompt_template": "Do D", - "input_vars_required": [], - "depends_on": ["TASK_B", "TASK_C"], - }, - { - "subtask": "3. Third task", - "tag": "TASK_C", - "constraints": [], - "prompt_template": "Do C", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - { - "subtask": "2. Second task", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - { - "subtask": "1. First task", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": [], - }, - ] - - result = reorder_subtasks(subtasks) - - # Should maintain correct numbering after reorder - assert len(result) == 4 - assert result[0]["subtask"] == "1. First task" - assert result[3]["subtask"] == "4. Final task" - # B and C can be in either order but should be numbered 2 and 3 - middle_numbers = {result[1]["subtask"][:2], result[2]["subtask"][:2]} - assert middle_numbers == {"2.", "3."} - - -class TestReorderSubtasksUnhappyPath: - """Negative tests for reorder_subtasks function.""" - - def test_circular_dependency_two_nodes(self) -> None: - """Test circular dependency between two nodes.""" - subtasks: list[DecompSubtasksResult] = [ - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": ["TASK_B"], - }, - { - "subtask": "Task B", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - ] - - with pytest.raises(ValueError, match="Circular dependency detected"): - reorder_subtasks(subtasks) - - def test_circular_dependency_three_nodes(self) -> None: - """Test circular dependency in a chain of three nodes.""" - subtasks: list[DecompSubtasksResult] = [ - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": ["TASK_C"], - }, - { - "subtask": "Task B", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - { - "subtask": "Task C", - "tag": "TASK_C", - "constraints": [], - "prompt_template": "Do C", - "input_vars_required": [], - "depends_on": ["TASK_B"], - }, - ] - - with pytest.raises(ValueError, match="Circular dependency detected"): - reorder_subtasks(subtasks) - - def test_self_dependency(self) -> None: - """Test task depending on itself.""" - subtasks: list[DecompSubtasksResult] = [ - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": ["TASK_A"], } - ] - - with pytest.raises(ValueError, match="Circular dependency detected"): - reorder_subtasks(subtasks) - - def test_empty_subtasks_list(self) -> None: - """Test with empty subtasks list.""" - subtasks: list[DecompSubtasksResult] = [] - - result = reorder_subtasks(subtasks) - - assert result == [] - - -# ============================================================================ -# Tests for verify_user_variables -# ============================================================================ - - -class TestVerifyUserVariablesHappyPath: - """Happy path tests for verify_user_variables function.""" - - def test_no_input_vars_no_dependencies(self) -> None: - """Test with no input variables and no dependencies.""" - decomp_data: DecompPipelineResult = { - "original_task_prompt": "Test task", - "subtask_list": ["Task A"], - "identified_constraints": [], - "subtasks": [ - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": [], - } - ], - } - - result = verify_user_variables(decomp_data, None) - - assert result == decomp_data - assert len(result["subtasks"]) == 1 - - def test_valid_input_vars(self) -> None: - """Test with valid input variables.""" - decomp_data: DecompPipelineResult = { - "original_task_prompt": "Test task", - "subtask_list": ["Task A"], - "identified_constraints": [], - "subtasks": [ - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A with {{ USER_INPUT }}", - "input_vars_required": ["USER_INPUT"], - "depends_on": [], - } - ], - } - - result = verify_user_variables(decomp_data, ["USER_INPUT"]) - - assert result == decomp_data - - def test_case_insensitive_input_vars(self) -> None: - """Test that input variable matching is case-insensitive.""" - decomp_data: DecompPipelineResult = { - "original_task_prompt": "Test task", - "subtask_list": ["Task A"], - "identified_constraints": [], - "subtasks": [ - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": ["user_input"], # lowercase - "depends_on": [], - } - ], - } - - # Should work with uppercase input - result = verify_user_variables(decomp_data, ["USER_INPUT"]) - - assert result == decomp_data - - def test_valid_dependencies_in_order(self) -> None: - """Test with valid dependencies already in correct order.""" - decomp_data: DecompPipelineResult = { - "original_task_prompt": "Test task", - "subtask_list": ["Task A", "Task B"], - "identified_constraints": [], - "subtasks": [ - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": [], - }, - { - "subtask": "Task B", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - ], - } - - result = verify_user_variables(decomp_data, None) - - # Should not reorder since already correct - assert result["subtasks"][0]["tag"] == "TASK_A" - assert result["subtasks"][1]["tag"] == "TASK_B" - - def test_dependencies_out_of_order_triggers_reorder(self) -> None: - """Test that out-of-order dependencies trigger automatic reordering.""" - decomp_data: DecompPipelineResult = { - "original_task_prompt": "Test task", - "subtask_list": ["Task B", "Task A"], - "identified_constraints": [], - "subtasks": [ - { - "subtask": "Task B", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": [], - }, - ], - } - - result = verify_user_variables(decomp_data, None) - - # Should reorder to A, B - assert result["subtasks"][0]["tag"] == "TASK_A" - assert result["subtasks"][1]["tag"] == "TASK_B" - - def test_complex_reordering(self) -> None: - """Test complex dependency reordering.""" - decomp_data: DecompPipelineResult = { - "original_task_prompt": "Test task", - "subtask_list": ["Task D", "Task C", "Task B", "Task A"], - "identified_constraints": [], - "subtasks": [ - { - "subtask": "Task D", - "tag": "TASK_D", - "constraints": [], - "prompt_template": "Do D", - "input_vars_required": [], - "depends_on": ["TASK_B", "TASK_C"], - }, - { - "subtask": "Task C", - "tag": "TASK_C", - "constraints": [], - "prompt_template": "Do C", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - { - "subtask": "Task B", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": [], - }, - ], - } - - result = verify_user_variables(decomp_data, None) - - # A must be first, D must be last - assert result["subtasks"][0]["tag"] == "TASK_A" - assert result["subtasks"][3]["tag"] == "TASK_D" - - -class TestVerifyUserVariablesUnHappyPath: - """Negative tests for verify_user_variables function.""" - - def test_missing_required_input_var(self) -> None: - """Test error when required input variable is not provided.""" - decomp_data: DecompPipelineResult = { - "original_task_prompt": "Test task", - "subtask_list": ["Task A"], - "identified_constraints": [], - "subtasks": [ - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": ["MISSING_VAR"], - "depends_on": [], - } - ], - } + ], + } + + +def write_input_file(tmp_path: Path, content: str, name: str = "input.txt") -> str: + """Write task prompt content and return file path as string.""" + input_path = tmp_path / name + input_path.write_text(content, encoding="utf-8") + return str(input_path) + + +@pytest.fixture +def patch_jinja(monkeypatch: pytest.MonkeyPatch) -> None: + """Patch Jinja objects used by ``run``.""" + monkeypatch.setattr("cli.decompose.decompose.Environment", DummyEnvironment) + monkeypatch.setattr( + "cli.decompose.decompose.FileSystemLoader", lambda *args, **kwargs: None + ) + + +@pytest.fixture +def patch_validate_filename(monkeypatch: pytest.MonkeyPatch) -> None: + """Patch filename validation.""" + monkeypatch.setattr("cli.decompose.decompose.validate_filename", lambda _: True) + + +@pytest.fixture +def patch_logging(monkeypatch: pytest.MonkeyPatch) -> Mock: + """Patch logger setup and logger access.""" + logger = Mock() + monkeypatch.setattr("cli.decompose.decompose.configure_logging", lambda _: None) + monkeypatch.setattr("cli.decompose.decompose.get_logger", lambda _: logger) + monkeypatch.setattr( + "cli.decompose.decompose.log_section", lambda *args, **kwargs: None + ) + return logger + + +class TestRunSuccess: + """Tests for successful run scenarios.""" + + def test_default_backend_and_model( + self, + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, + patch_jinja: None, + patch_validate_filename: None, + patch_logging: Mock, + ) -> None: + """Default backend/model are forwarded to pipeline.""" + input_file = write_input_file(tmp_path, "Test prompt") + captured: dict[str, Any] = {} + + def fake_decompose(**kwargs: Any) -> DecompPipelineResult: + captured.update(kwargs) + return make_decomp_result() + + monkeypatch.setattr( + "cli.decompose.decompose.pipeline.decompose", fake_decompose + ) + + run(out_dir=tmp_path, out_name="default_case", input_file=input_file) + + assert captured["backend"] == DecompBackend.ollama + assert captured["model_id"] == "mistral-small3.2:latest" + + def test_input_file_mode_forwards_inference_args( + self, + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, + patch_jinja: None, + patch_validate_filename: None, + patch_logging: Mock, + ) -> None: + """Input file mode forwards args to ``pipeline.decompose``.""" + input_file = write_input_file(tmp_path, "Summarize document.") + captured: dict[str, Any] = {} + + def fake_decompose(**kwargs: Any) -> DecompPipelineResult: + captured.update(kwargs) + return make_decomp_result() + + monkeypatch.setattr( + "cli.decompose.decompose.pipeline.decompose", fake_decompose + ) + + run( + out_dir=tmp_path, + out_name="case_forward", + input_file=input_file, + model_id="llama3:8b", + backend=DecompBackend.ollama, + backend_req_timeout=111, + input_var=["DOC"], + log_mode=LogMode.debug, + ) + + assert captured["task_prompt"] == "Summarize document." + assert captured["backend"] == DecompBackend.ollama + assert captured["model_id"] == "llama3:8b" + assert captured["backend_req_timeout"] == 111 + assert captured["user_input_variable"] == ["DOC"] + assert captured["log_mode"] == LogMode.debug + + def test_interactive_mode_reads_prompt_and_ignores_input_vars( + self, + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, + patch_jinja: None, + patch_validate_filename: None, + patch_logging: Mock, + ) -> None: + """Interactive mode reads prompt and sends ``None`` input vars.""" + captured: dict[str, Any] = {} + + def fake_decompose(**kwargs: Any) -> DecompPipelineResult: + captured.update(kwargs) + return make_decomp_result() + + monkeypatch.setattr( + "cli.decompose.decompose.pipeline.decompose", fake_decompose + ) + monkeypatch.setattr("typer.prompt", lambda *args, **kwargs: "A\\nB") + + run( + out_dir=tmp_path, + out_name="interactive_case", + input_file=None, + input_var=["IGNORED_IN_INTERACTIVE_MODE"], + ) + + assert captured["task_prompt"] == "A\nB" + assert captured["user_input_variable"] is None + + def test_latest_version_resolves_to_last_declared_version( + self, + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, + patch_validate_filename: None, + patch_logging: Mock, + ) -> None: + """``latest`` resolves to the last declared enum version.""" + input_file = write_input_file(tmp_path, "Test") + requested_templates: list[str] = [] + + class TrackingEnvironment: + """Tracking Jinja environment for template resolution assertions.""" + + def __init__(self, *args: Any, **kwargs: Any) -> None: + pass + + def get_template(self, template_name: str) -> DummyTemplate: + requested_templates.append(template_name) + return DummyTemplate() + + monkeypatch.setattr("cli.decompose.decompose.Environment", TrackingEnvironment) + monkeypatch.setattr( + "cli.decompose.decompose.FileSystemLoader", lambda *args, **kwargs: None + ) + monkeypatch.setattr( + "cli.decompose.decompose.pipeline.decompose", + lambda **kwargs: make_decomp_result(), + ) + + run( + out_dir=tmp_path, + out_name="version_case", + input_file=input_file, + version=DecompVersion.latest, + ) + + assert requested_templates == ["m_decomp_result_v2.py.jinja2"] + + def test_successful_run_writes_outputs( + self, + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, + patch_jinja: None, + patch_validate_filename: None, + patch_logging: Mock, + ) -> None: + """Successful run writes expected directory structure and files.""" + input_file = write_input_file(tmp_path, "Generate subtasks.") + + monkeypatch.setattr( + "cli.decompose.decompose.pipeline.decompose", + lambda **kwargs: make_decomp_result(), + ) + + run(out_dir=tmp_path, out_name="ok_case", input_file=input_file) + + out_path = tmp_path / "ok_case" + assert out_path.exists() + assert out_path.is_dir() + assert (out_path / "ok_case.json").exists() + assert (out_path / "ok_case.py").exists() + assert (out_path / "validations").exists() + assert (out_path / "validations" / "__init__.py").exists() + + def test_multi_line_input_file_creates_numbered_jobs( + self, + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, + patch_jinja: None, + patch_validate_filename: None, + patch_logging: Mock, + ) -> None: + """Each non-empty input line becomes one numbered output job.""" + input_file = write_input_file(tmp_path, "Task 1\n\nTask 2\n") + calls: list[str] = [] + + def fake_decompose(**kwargs: Any) -> DecompPipelineResult: + calls.append(kwargs["task_prompt"]) + return make_decomp_result() + + monkeypatch.setattr( + "cli.decompose.decompose.pipeline.decompose", fake_decompose + ) + + run(out_dir=tmp_path, out_name="batch", input_file=input_file) + + assert calls == ["Task 1", "Task 2"] + assert (tmp_path / "batch_1" / "batch_1.json").exists() + assert (tmp_path / "batch_2" / "batch_2.json").exists() + + +class TestRunFailures: + """Tests for failure scenarios during run.""" + + def test_pipeline_exception_after_output_dir_creation_cleans_up( + self, + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, + patch_jinja: None, + patch_validate_filename: None, + patch_logging: Mock, + ) -> None: + """A failure after output-dir registration removes partial output.""" + input_file = write_input_file(tmp_path, "fail") + + monkeypatch.setattr( + "cli.decompose.decompose.pipeline.decompose", + lambda **kwargs: make_decomp_result(), + ) + + original_mkdir = Path.mkdir + + def fail_after_create(self: Path, *args: Any, **kwargs: Any) -> None: + original_mkdir(self, *args, **kwargs) + if self.name == "validations" and self.parent.name == "fail_case": + raise RuntimeError("fail") + + monkeypatch.setattr(Path, "mkdir", fail_after_create) + + with pytest.raises(RuntimeError, match="fail"): + run(out_dir=tmp_path, out_name="fail_case", input_file=input_file) + + assert not (tmp_path / "fail_case").exists() + + def test_pipeline_decompose_exception_is_reraised( + self, + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, + patch_jinja: None, + patch_validate_filename: None, + patch_logging: Mock, + ) -> None: + """Exceptions from ``pipeline.decompose`` are propagated.""" + input_file = write_input_file(tmp_path, "fail") + + def raise_inference_error(**kwargs: Any) -> DecompPipelineResult: + raise RuntimeError("inference error") + + monkeypatch.setattr( + "cli.decompose.decompose.pipeline.decompose", raise_inference_error + ) + + with pytest.raises(RuntimeError, match="inference error"): + run(out_dir=tmp_path, out_name="err_case", input_file=input_file) + + assert not (tmp_path / "err_case").exists() + + def test_invalid_output_dir_fails_before_inference( + self, + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, + patch_jinja: None, + patch_validate_filename: None, + patch_logging: Mock, + ) -> None: + """Invalid ``out_dir`` fails before pipeline call.""" + input_file = write_input_file(tmp_path, "Test prompt") + + decompose_mock = Mock(return_value=make_decomp_result()) + monkeypatch.setattr( + "cli.decompose.decompose.pipeline.decompose", decompose_mock + ) + + missing_dir = tmp_path / "does_not_exist" with pytest.raises( - ValueError, - match='Subtask "task_a" requires input variable "MISSING_VAR" which was not provided', + AssertionError, match='Path passed in the "out-dir" is not a directory' ): - verify_user_variables(decomp_data, None) - - def test_missing_required_input_var_with_some_provided(self) -> None: - """Test error when one of multiple required variables is missing.""" - decomp_data: DecompPipelineResult = { - "original_task_prompt": "Test task", - "subtask_list": ["Task A"], - "identified_constraints": [], - "subtasks": [ - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": ["VAR1", "VAR2"], - "depends_on": [], - } - ], - } + run(out_dir=missing_dir, out_name="m_decomp_result", input_file=input_file) + + decompose_mock.assert_not_called() + + def test_empty_input_file_raises_value_error( + self, + tmp_path: Path, + monkeypatch: pytest.MonkeyPatch, + patch_jinja: None, + patch_validate_filename: None, + patch_logging: Mock, + ) -> None: + """Input files with only blank lines are rejected.""" + input_file = write_input_file(tmp_path, "\n \n\t\n") + + decompose_mock = Mock(return_value=make_decomp_result()) + monkeypatch.setattr( + "cli.decompose.decompose.pipeline.decompose", decompose_mock + ) with pytest.raises( - ValueError, - match='Subtask "task_a" requires input variable "VAR2" which was not provided', + ValueError, match="Input file contains no non-empty task lines" ): - verify_user_variables(decomp_data, ["VAR1"]) - - def test_dependency_on_nonexistent_subtask(self) -> None: - """Test error when subtask depends on non-existent subtask.""" - decomp_data: DecompPipelineResult = { - "original_task_prompt": "Test task", - "subtask_list": ["Task A"], - "identified_constraints": [], - "subtasks": [ - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": ["NONEXISTENT_TASK"], - } - ], - } + run(out_dir=tmp_path, out_name="empty_case", input_file=input_file) - with pytest.raises( - ValueError, - match='Subtask "task_a" depends on variable "NONEXISTENT_TASK" which does not exist', - ): - verify_user_variables(decomp_data, None) - - def test_circular_dependency_detected(self) -> None: - """Test that circular dependencies are caught during reordering.""" - decomp_data: DecompPipelineResult = { - "original_task_prompt": "Test task", - "subtask_list": ["Task A", "Task B"], - "identified_constraints": [], - "subtasks": [ - { - "subtask": "Task B", - "tag": "TASK_B", - "constraints": [], - "prompt_template": "Do B", - "input_vars_required": [], - "depends_on": ["TASK_A"], - }, - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": [], - "depends_on": ["TASK_B"], - }, - ], - } - - with pytest.raises(ValueError, match="Circular dependency detected"): - verify_user_variables(decomp_data, None) - - def test_empty_input_var_list_treated_as_none(self) -> None: - """Test that empty input_var list is treated same as None.""" - decomp_data: DecompPipelineResult = { - "original_task_prompt": "Test task", - "subtask_list": ["Task A"], - "identified_constraints": [], - "subtasks": [ - { - "subtask": "Task A", - "tag": "TASK_A", - "constraints": [], - "prompt_template": "Do A", - "input_vars_required": ["REQUIRED_VAR"], - "depends_on": [], - } - ], - } - - # Both should raise the same error - with pytest.raises(ValueError, match="requires input variable"): - verify_user_variables(decomp_data, []) - - with pytest.raises(ValueError, match="requires input variable"): - verify_user_variables(decomp_data, None) + decompose_mock.assert_not_called()