[WIP] Add AI-generated PowerPoint workflow using enterprise template#1
Draft
Copilot wants to merge 1 commit into
Draft
[WIP] Add AI-generated PowerPoint workflow using enterprise template#1Copilot wants to merge 1 commit into
Copilot wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
src/pptx/ai_workflow/package with:__init__.py– public exportstemplate_inspector.py– inspect layouts/placeholders in enterprise templaterenderer.py– render LLM JSON slides into a Presentation using the templatevalidator.py– validate LLM JSON against schema rulesschema.py– LLM output JSON schema / dataclassestests/test_ai_workflow.pycovering all new utilitiesdocs/user/enterprise-ai-workflow.rstspecification & guide documentOriginal prompt
Build support for an AI-generated PowerPoint workflow that uses a company/default enterprise PowerPoint template as the required starting point.
Context from user:
Required outcome:
.pptxtemplate viaPresentation(template_path)rather than starting fromPresentation().idx, name, and type values in the enterprise template.title,bullets,image,chart, andtableto specific template layout indices and placeholder indices.slide.shapes.add_table()/slide.shapes.add_chart()as fallback..pptxoutput..pptx.Important implementation guidance based on python-pptx docs:
prs = Presentation("enterprise_template.pptx").prs.slide_layouts[index]but do not assume built-in indices if using a custom template; provide an inspection step.slide.placeholders[idx]; this uses placeholderidx, not list position.slide.shapes.add_chart(...).chartaccesses the chart.slide.shapes.add_table(...).tableaccesses the table.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: can u teach complete python-pptx
Assistant: Absolutely — I can teach you
python-pptxfrom beginner to practical advanced usage.python-pptxis a Python library used to create, edit, and automate PowerPoint.pptxfiles. It is useful for AI-generated PPTs, reports, dashboards, business presentations, chart decks, and automated slide generation.1. Install
python-pptxMain dependencies include:
lxmlPillowXlsxWriterfor charts2. Basic Idea of
python-pptxEverything starts with a
Presentationobject.This creates a blank PowerPoint file using the default template.
You can also open an existing PowerPoint file:
This is very important for AI-generated PPTs because you can use a branded company template.
3. Slides and Slide Layouts
Every slide is created from a slide layout.
Common default layouts:
012345678Example: