This example requires additional dependencies for image processing, document handling, and visualization.
Install dependencies:
# Navigate to project root
cd youtu-agent
# Install PPT generation dependencies
uv sync --extra ppt-genDownload template files to examples/ppt_gen/template directory.
Navigate to the example directory, prepare the reference resource (plain text / markdown / html webpage) for PPT generation. For example, download the Nobel Prize webpage.
# Navigate to the example directory
cd examples/ppt_gen
# Download sample webpage
wget https://www.nobelprize.org/prizes/physics/2025/popular-information/ -O webpage.htmlRun the PPT generation script.
python main.py \
--file webpage.html \
--template_path templates \
--yaml_path yaml_example2.yaml \
--pages 8 \
--disable_tooluse \
--extra_prompt "Ensure rich content. In English" \
--template_name 11The script will produce a json file and a pptx file if everything is OK. Pass --yaml_path to switch between different template definitions.
For more details, see YAML-driven template configuration.
The template workflow is powered by a YAML config (see yaml_example.yaml). The config plays two roles:
- type_map — maps slide
typevalues (e.g.,title,items_page_4) to the slide index inside the reference template. These indices tell the renderer which base slide to duplicate. - Page definitions — each
<name>_pageblock describes all fields that can appear on that slide. Every field specifiestype, optional length constraints, and additional hints that are injected into the LLM’s JSON schema viagen_schema.build_schema.
Supported field types include str, int, content (rich text/image/table payload), content_list, item_list, str_list, and image. When the agent finishes generating content, fill_template_with_yaml_config reads the YAML config, looks up the target slide via type_map, duplicates the correct template page, and renders each field based on the declared type mappings. To customize a template:
- Duplicate
yaml_example.yaml, adjusttype_mapto match the slide order in your PPT template. - Update or add page blocks so that every slide type you want the agent to produce has the correct field definitions.
- Run the script with
--yaml_path <your_config.yaml>to load the new schema and automatically align the agent output with your PPT.
- Use the Selection Pane in PowerPoint to rename shapes so their names exactly match YAML field names (for example:
title,subtitle,item_title1,item_content1,label1,content1). - No duplicate names on the same slide. Each shape name must be unique so the renderer can target it deterministically.
- Refer to existing templates in
examples/ppt_gen/templatesand the field definitions inyaml_example.yamlas a naming guide.