Skip to content

armgit / camel

Public Imported from GitHub
0

๐Ÿซ CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

Auto-update documentation after merge [skip ci]

camel-docs-bot3dd2d4f42553
diff --git a/docs/mintlify/cookbooks/applications/pptx_toolkit.mdx b/docs/mintlify/cookbooks/applications/pptx_toolkit.mdx
new file mode 100644
index 000000000..0b2ff2296
--- /dev/null
+++ b/docs/mintlify/cookbooks/applications/pptx_toolkit.mdx
@@ -0,0 +1,130 @@
+---
+title: "๐Ÿซ ๐Ÿ“Š CAMEL-AI PPTXToolkit Cookbook"
+---
+
+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
+
+<hr />
+
+## ๐Ÿšฅ Pipeline Overview
+
+1. **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
+
+2. **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](https://colab.research.google.com/drive/1W_dsoq1jrO8A_TzwUxzAr4wFSWeXLmn7?usp=sharing)
+
+
+
+```python
+%pip install "camel-ai[all]==0.2.66"
+```
+
+## โš™๏ธ Configuration
+Set your API keys securely:
+
+
+```python
+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.
+
+
+```python
+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:
+
+
+```python
+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
+
+
+```python
+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}")
+
+```
diff --git a/docs/mintlify/docs.json b/docs/mintlify/docs.json
index e3575c2ca..a2e3cbf35 100644
--- a/docs/mintlify/docs.json
+++ b/docs/mintlify/docs.json
@@ -88,9 +88,9 @@
{
"group": "Basic Concepts",
"pages": [
- "cookbooks/basic_concepts/create_your_first_agent",
"cookbooks/basic_concepts/agents_message",
"cookbooks/basic_concepts/agents_prompting",
+ "cookbooks/basic_concepts/create_your_first_agent",
"cookbooks/basic_concepts/create_your_first_agents_society",
"cookbooks/basic_concepts/model_speed_comparison"
]
@@ -121,6 +121,7 @@
"cookbooks/applications/customer_service_Discord_bot_with_agentic_RAG",
"cookbooks/applications/dynamic_travel_planner",
"cookbooks/applications/finance_discord_bot",
+ "cookbooks/applications/pptx_toolkit",
"cookbooks/applications/roleplaying_scraper"
]
},