Documentation Index
Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
Use this file to discover all available pages before exploring further.
This notebook shows you how to automatically generate and assemble professional PowerPoint decks using CAMEL-AIβs PPTXToolkit. Youβll learn how to:
- Prompt an LLM to produce fully structured JSON for every slide
- Turn that JSON into a polished
.pptx with titles, bullets, step diagrams, tables, and images
- Leverage Markdown styling (
**bold**, *italic*) and Pexels image search via img_keywords
- Plug in your own .pptx templates (modern, boardroom, minimalist, etc.)
- Enjoy auto-layout selection for text, diagrams, and tables
π₯ Pipeline Overview
-
Single Agent: Content β JSON
- You send one prompt to the LLM
- It returns a JSON list with:
- A title slide (
title, subtitle)
- At least one step-by-step slide (all bullets start with
>>)
- At least one table slide (
table: {headers, rows})
- Two or more slides with meaningful
img_keywords
- All bullet slides using Markdown formatting
-
PPTXToolkit: JSON β
.pptx
- Pass that JSON into
PPTXToolkit.create_presentation(...)
- Renders slides with your chosen template, images via
img_keywords, chevrons/pentagons, and tables
- Outputs a ready-to-share PowerPoint file
Ready to build your next deck? Letβs get started! π
You can also check this cookbook in colab here
%pip install "camel-ai[all]==0.2.66"
βοΈ Configuration
Set your API keys securely:
from getpass import getpass
import os
# Prompt the user securely (input is hidden)
os.environ["OPENAI_API_KEY"] = getpass("π Enter your OpenAI API key: ")
os.environ["PEXELS_API_KEY"] = getpass("π Enter your Pexels API key (leave blank if not using images): ")
βοΈ Agent #1: Generate Structured JSON
One single LLM call to produce exactly the JSON your toolkit expects.
import os, json
from camel.agents import ChatAgent
from camel.models import ModelFactory
from camel.types import ModelPlatformType, ModelType
def generate_slides_json(topic: str, slide_count: int) -> list:
# Build our strict prompt
prompt = f"""
You are a world-class PowerPoint generator for CAMEL-AI's PPTXToolkit.
Create a presentation about "{topic}" with exactly {slide_count + 1} slides (1 title + {slide_count} content).
MANDATORY:
1. First slide: title & subtitle.
2. β₯1 step-by-step slide (all bullets start with ">>").
3. β₯1 table slide (with headers & rows).
4. β₯2 slides with non-empty img_keywords (search terms only).
5. Bullet slides use Markdown (**bold**, *italic*) in bullet_points.
6. Output MUST BE raw JSON (list of dicts), no markdown fences or commentary.
Example:
[
{{"title":"...","subtitle":"..."}},
{{"heading":"...","bullet_points":["...","..."],"img_keywords":"..."}},
{{"heading":"...","bullet_points":[">> Step 1..."],"img_keywords":"..."}},
{{"heading":"...","table":{{"headers":["A","B"],"rows":[["1","2"],["3","4"]]}},"img_keywords":"..."}}
]
"""
agent = ChatAgent(
system_message="You strictly output valid JSON for PowerPoint slides.",
message_window_size=5,
model=ModelFactory.create(
model_platform=ModelPlatformType.OPENAI,
model_type=ModelType.GPT_4_1,
model_config_dict={"temperature": 0.0},
)
)
resp = agent.step(prompt)
slides = json.loads(resp.msgs[0].content)
return slides
π¦ Build & Save PPTX
Local code uses PPTXToolkit to turn that JSON into a .pptx file:
from camel.toolkits.pptx_toolkit import PPTXToolkit
def build_pptx(slides_json: list, out_name: str = "presentation.pptx") -> str:
kit = PPTXToolkit(output_dir=".")
kit.create_presentation(json.dumps(slides_json), out_name)
return out_name
π Run the Pipeline
if __name__ == "__main__":
topic = input("π― Topic: ")
n = int(input("π # of content slides: "))
slides = generate_slides_json(topic, n)
filename = f"{topic.replace(' ','_')}.pptx"
path = build_pptx(slides, out_name=filename)
print(f"β
Deck saved to: {path}")