1. Prepare Your Environment
You’ll need the following setup:a. OpenAI API Key
Get your API key from OpenAI Platform and set it as an environment variable:b. Presenton Instance
Ensure Presenton is running locally onhttp://localhost:5000
or update the URL in the script to match your setup.
2. Install Python Requirements
You’ll need several libraries for web scraping, AI integration, and API calls:3. Write the Python Script
Let’s build the script step by step.a. Import Libraries
b. Define Pydantic Models for Structured Outputs
c. Setup OpenAI Client
d. Fetch Company Information from URL
e. Generate Questions Using OpenAI with Structured Outputs
f. Get User Answers Interactively
g. Generate Pitch Deck Structure
h. Generate Presentation Using Presenton API
i. Main Execution Flow
Download complete code from github.
4. Run the Script
Save your script aspitch-deck-agent.py
and run:
- Ask for a company URL
- Fetch company information automatically
- Generate 3 AI-powered questions
- Collect your answers interactively
- Create a comprehensive pitch deck structure
- Generate a professional PDF presentation
5. Example Workflow
6. How It Works
- Company Information Extraction: The script fetches meta descriptions, titles, and content from company websites
- AI-Powered Question Generation: Uses GPT-4o-mini with structured outputs to generate exactly 3 relevant questions
- Interactive Q&A: Guides users through targeted questions to gather essential information
- Intelligent Structure Creation: Uses the Q&A context to create personalized pitch deck outlines
- Professional Presentation Generation: Leverages Presenton API to create polished PDF presentations
7. Key Features
- Structured Outputs: Uses OpenAI’s function calling for reliable question generation
- Web Scraping: Automatically extracts company information from URLs
- Contextual Generation: Questions and structure are based on actual company data
- Professional Output: Generates high-quality PDF presentations
- Error Handling: Comprehensive fallbacks and error management
8. Next Steps
- You can customize the number of slides or presentation layout as needed
- For more on API options, see Generate a PPT via API in 5 Minutes
- For advanced configuration (for example, using Ollama or GPU), see Environment Variables, Using GPU, and Using Ollama Models
- Consider adding support for multiple companies or batch processing
Need help? See the full documentation or open an issue on GitHub.