### Clone Presenton Repository Source: https://docs.presenton.ai/development Clones the official Presenton AI GitHub repository and navigates into the project directory. This is the first step to get the project files onto your local machine. ```bash git clone https://github.com/presenton/presenton.git cd presenton ``` -------------------------------- ### Run Presenton Docker Image (Linux/macOS) Source: https://docs.presenton.ai/tutorial/generate-presentation-over-api-using-docker Starts the Presenton Docker container on Linux or macOS. It maps port 5000, sets the LLM provider to 'google' with an API key, disables key changes, and mounts a local volume for user data. Ensure Docker is installed and accessible. ```bash docker run -it --name presenton -p 5000:80 -e LLM="google" -e GOOGLE_API_KEY="***" -e CAN_CHANGE_KEYS="false" -v "./user_data:/app/user_data" ghcr.io/presenton/presenton:latest ``` -------------------------------- ### Run Presenton Docker Image (Windows PowerShell) Source: https://docs.presenton.ai/tutorial/generate-presentation-over-api-using-docker Starts the Presenton Docker container on Windows using PowerShell. It maps port 5000, sets the LLM provider to 'google' with an API key, disables key changes, and mounts a local volume for user data. Ensure Docker is installed and accessible. ```powershell docker run -it --name presenton -p 5000:80 -e LLM="google" -e GOOGLE_API_KEY="***" -e CAN_CHANGE_KEYS="false" -v "${PWD}\user_data:/app/user_data" ghcr.io/presenton/presenton:latest ``` -------------------------------- ### Install Python Project Dependencies Source: https://docs.presenton.ai/tutorial/create-agent-to-create-pitch-decks This command installs the necessary Python libraries for the project. It includes 'requests' for making HTTP requests, 'beautifulsoup4' for web scraping, 'openai' for interacting with the OpenAI API, and 'pydantic' for data validation and modeling. Ensure you have Python and pip installed. ```bash pip install requests beautifulsoup4 openai pydantic ``` -------------------------------- ### Run Presenton Development Environment with Docker Compose (GPU) Source: https://docs.presenton.ai/development Builds and starts the Presenton AI development environment using Docker Compose with GPU support. This is suitable for tasks requiring GPU acceleration. ```bash docker compose up development-gpu --build ``` -------------------------------- ### GET /api/v1/ppt/template/{id}/example Source: https://docs.presenton.ai/api-reference/template/get-template-example Retrieves example slides content data for a specified template. This data can be used to generate a presentation from a JSON structure. ```APIDOC ## GET /api/v1/ppt/template/{id}/example ### Description Retrieves example slides content data for a specified template. This data can be used to generate a presentation from a JSON structure. ### Method GET ### Endpoint /api/v1/ppt/template/{id}/example ### Parameters #### Path Parameters - **id** (string) - Required - The id of the template, must be one of general, modern, standard, swift or your custom template #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **template** (string) - The name of the template. - **slides** (array) - An array of slide objects, each containing layout and content. - **layout** (string) - The layout of the slide. - **content** (object) - The content of the slide. #### Response Example ```json { "template": "", "slides": [ { "layout": "", "content": {} } ] } ``` #### Error Response (422) - **detail** (array) - An array of validation error objects. - **loc** (array) - The location of the validation error. - **msg** (string) - The error message. - **type** (string) - The type of error. #### Error Response Example ```json { "detail": [ { "loc": [ "" ], "msg": "", "type": "" } ] } ``` ``` -------------------------------- ### Clone Presenton Repository and Start Server Source: https://docs.presenton.ai/creating-custom-presentation-templates Commands to clone the Presenton GitHub repository and start the development server using Docker Compose. This sets up the Presenton environment locally. ```bash git clone https://github.com/presenton/presenton.git cd presenton docker compose up development --build ``` -------------------------------- ### Run Presenton Development Environment with Docker Compose (No GPU) Source: https://docs.presenton.ai/development Builds and starts the Presenton AI development environment using Docker Compose without GPU support. This command ensures all necessary services are running for local development. ```bash docker compose up development --build ``` -------------------------------- ### Initialize PitchDeckGenerator Class with OpenAI Setup Source: https://docs.presenton.ai/tutorial/create-agent-to-create-pitch-decks This Python code defines the 'PitchDeckGenerator' class. The constructor initializes the Presenton API base URL, sets up the OpenAI client by calling `setup_openai`, and initializes an empty list to store generated questions. The `setup_openai` method is crucial for authenticating with OpenAI. ```python class PitchDeckGenerator: def __init__(self): self.presenton_base_url = "https://api.presenton.ai" self.openai_client = None self.last_questions = [] # Store the generated questions self.setup_openai() ``` -------------------------------- ### PresentOn AI Generation API Response (Bash) Source: https://docs.presenton.ai/guide/generate-presentation-with-templates-and-themes This example shows the expected JSON response from the PresentOn AI API after a successful presentation generation request. It includes the presentation ID, a link to the generated file, an edit path, and the number of credits consumed. This response is part of the API interaction initiated by a generation request. ```bash { "presentation_id": "d3000f96-096c-4768-b67b-e99aed029b57", "path": "https://api.presenton.ai/static/user_data/d3000f96-096c-4768-b67b-e99aed029b57/Introduction_to_Machine_Learning.pdf", "edit_path": "https://presenton.ai/presentation?id=d3000f96-096c-4768-b67b-e99aed029b57", "credits_consumed": 5 } ``` -------------------------------- ### Install Python Dependencies Source: https://docs.presenton.ai/tutorial/generate-presentation-from-csv Installs the necessary Python libraries, 'requests' for making HTTP requests and 'pandas' for data manipulation, using pip. ```bash pip install requests pandas ``` -------------------------------- ### Access Presenton AI Web Interface Source: https://docs.presenton.ai/quickstart After successfully launching the Presenton AI Docker container, this URL is used to access the application's web interface through a browser. It assumes the container is running and accessible on the default mapped port. ```text http://localhost:5000 ``` -------------------------------- ### Run Presenton Docker Container on Windows Source: https://docs.presenton.ai/quickstart This command uses Docker to run the latest version of the Presenton AI container on Windows. It maps port 5000 on the host to port 80 in the container and mounts the current directory's 'app_data' to '/app_data' within the container. This is intended for use in PowerShell on Windows. ```powershell docker run -it --name presenton -p 5000:80 -v "${PWD}\app_data:/app_data" ghcr.io/presenton/presenton:latest ``` -------------------------------- ### Run Presenton Docker Container on Linux/macOS Source: https://docs.presenton.ai/quickstart This command uses Docker to run the latest version of the Presenton AI container. It maps port 5000 on the host to port 80 in the container and mounts a local 'app_data' directory to '/app_data' within the container. This is intended for use in Bash or Zsh shells on Linux and macOS. ```bash docker run -it --name presenton -p 5000:80 -v "./app_data:/app_data" ghcr.io/presenton/presenton:latest ``` -------------------------------- ### GET /api/v1/ppt/template/all Source: https://docs.presenton.ai/api-reference/template/get-all-templates Retrieves a list of all available presentation templates. ```APIDOC ## GET /api/v1/ppt/template/all ### Description Retrieves a list of all available presentation templates. This endpoint is useful for fetching template options for creating new presentations. ### Method GET ### Endpoint /api/v1/ppt/template/all ### Parameters #### Header Parameters - **Authorization** (string) - Required - The bearer token to authenticate with ### Request Example ```json { "headers": { "Authorization": "Bearer YOUR_ACCESS_TOKEN" } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the template. - **name** (string) - The name of the template. #### Response Example ```json [ { "id": "tpl_abc123", "name": "Modern Business" }, { "id": "tpl_def456", "name": "Minimalist Portfolio" } ] ``` #### Error Response (422) - **detail** (array) - An array of validation error objects. - **loc** (array) - The location of the error in the request (e.g., `["header", "Authorization"]`). - **msg** (string) - A message describing the validation error. - **type** (string) - The type of validation error. #### Error Response Example (422) ```json { "detail": [ { "loc": [ "header", "Authorization" ], "msg": "Invalid authentication credentials", "type": "invalid_credentials" } ] } ``` ``` -------------------------------- ### Generate Presentation with Templates and Themes (Bash) Source: https://docs.presenton.ai/guide/generate-presentation-with-templates-and-themes This code snippet demonstrates how to generate a presentation using the PresentOn AI API. It specifies content, slide count, language, template, theme, and export format. Dependencies include `curl` and a valid API key. The input is a JSON payload, and the output is a JSON response containing presentation details. ```bash curl -X POST https://api.presenton.ai/api/v1/ppt/presentation/generate \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sk-presenton-xxxxx" \ -d '{ "content": "Introduction to Machine Learning", "n_slides": 5, "language": "English", "template": "general", "theme": "edge-yellow", "export_as": "pdf" }' ``` -------------------------------- ### Run Presenton with Ollama Model (Docker) Source: https://docs.presenton.ai/configurations/using-ollama-models This command launches Presenton using a specified Ollama model directly. It requires Docker to be installed and configured. Ensure you replace 'your_pexels_api_key' with a valid key if you intend to use Pexels for images. ```bash docker run -it --name presenton -p 5000:80 \ -e LLM="ollama" \ -e OLLAMA_MODEL="llama3.2:3b" \ -e IMAGE_PROVIDER="pexels" \ -e PEXELS_API_KEY="your_pexels_api_key" \ -e CAN_CHANGE_KEYS="false" \ -v "./app_data:/app_data" \ ghcr.io/presenton/presenton:latest ``` -------------------------------- ### Configure MySQL Database Connection for Presenton Source: https://docs.presenton.ai/configurations/using-external-database This example shows how to configure Presenton to use a MySQL database by setting the DATABASE_URL environment variable in a Docker run command. The connection string includes user, password, host, default MySQL port (3306), and the database name. Similar to the PostgreSQL example, it sets up port mapping and volume mounting for persistent user data. ```bash docker run -it --name presenton \ -p 5000:80 \ -e DATABASE_URL="mysql://user:password@host:3306/mydb" \ -v "./user_data:/app/user_data" \ ghcr.io/presenton/presenton:latest ``` -------------------------------- ### Docker Run Command for Presenton AI Source: https://docs.presenton.ai/configurations/environment-variables Example Docker command to run Presenton AI, configuring LLM, image provider, and other settings via environment variables. ```bash docker run -it --name presenton -p 5000:80 \ -e LLM="ollama" \ -e OLLAMA_MODEL="llama3.2:3b" \ -e OLLAMA_URL="http://localhost:11434" \ -e CAN_CHANGE_KEYS="false" \ -e IMAGE_PROVIDER="pexels" \ -e PEXELS_API_KEY="your_pexels_key" \ -v "./app_data:/app_data" \ ghcr.io/presenton/presenton:latest ``` -------------------------------- ### Generate Presentation using Presenton AI API Source: https://docs.presenton.ai/using-presenton-api Examples for generating a presentation via the Presenton AI API. This involves sending a POST request with presentation details such as content, number of slides, language, template, and export format. Requires an API key for authorization. ```bash curl -X POST https://api.presenton.ai/api/v1/ppt/presentation/generate \ -H "Content-Type: application/json" \ -H "Authorization: Bearer sk-presenton-xxxxx" \ -d '{ "content": "Introduction to Machine Learning", "n_slides": 5, "language": "English", "template": "general", "export_as": "pptx" }' ``` ```python import requests import json url = "https://api.presenton.ai/api/v1/ppt/presentation/generate" data = { "content": "Introduction to Machine Learning", "n_slides": 5, "language": "English", "template": "modern", "export_as": "pptx" } headers = { "Content-Type": "application/json", "Authorization": "Bearer sk-presenton-xxxxx" } response = requests.post(url, json=data, headers=headers) print(response.json()) ``` ```javascript const data = { content: "Introduction to Machine Learning", n_slides: 5, language: "English", template: "swift", export_as: "pptx" }; fetch("https://api.presenton.ai/api/v1/ppt/presentation/generate", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": "Bearer sk-presenton-xxxxx" }, body: JSON.stringify(data) }) .then(response => response.json()) .then(data => { console.log(data); }) .catch(error => { console.error("Error:", error); }); ``` -------------------------------- ### GET /api/v1/ppt/images/uploaded Source: https://docs.presenton.ai/api-reference/images/get-uploaded-images Fetches all images that have been uploaded. Requires an API key for authentication. ```APIDOC ## GET /api/v1/ppt/images/uploaded ### Description Retrieves a list of all uploaded images. Authentication is required using a bearer token. ### Method GET ### Endpoint /api/v1/ppt/images/uploaded ### Parameters #### Path Parameters None #### Query Parameters None #### Header Parameters - **Authorization** (string) - Required - The bearer token to authenticate with (e.g., `Bearer sk-presenton-xxxxxxxx`). ### Request Example ```bash curl -X GET \ https://api.presenton.ai/api/v1/ppt/images/uploaded \ -H 'Authorization: Bearer sk-presenton-xxxxxxxx' ``` ### Response #### Success Response (200) - **any** (any) - The response contains the uploaded image data. #### Response Example ```json { "example": "" } ``` #### Error Response (422) - **detail** (array) - Contains validation error details. - **loc** (array) - The location of the error in the request. - **msg** (string) - The error message. - **type** (string) - The type of error. #### Error Response Example ```json { "detail": [ { "loc": [ "" ], "msg": "", "type": "" } ] } ``` ``` -------------------------------- ### OpenAPI Specification for Get Uploaded Images Source: https://docs.presenton.ai/api-reference/images/get-uploaded-images This OpenAPI specification defines the 'get /api/v1/ppt/images/uploaded' endpoint. It details the request method, path, authentication requirements (Bearer token), and possible responses, including successful retrieval (200) and validation errors (422). ```yaml paths: /api/v1/ppt/images/uploaded: get: summary: Get all uploaded images servers: - url: https://api.presenton.ai requestBody: {} responses: '200': description: Successful Response content: application/json: schema: type: array items: {} example: value: '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' example: value: detail: - loc: - msg: type: security: - bearerAuth: [] components: schemas: ValidationError: title: ValidationError type: object required: - loc - msg - type properties: loc: type: array items: anyOf: - type: string - type: integer title: Location msg: type: string title: Message type: type: string title: Error Type HTTPValidationError: title: HTTPValidationError type: object properties: detail: type: array items: $ref: '#/components/schemas/ValidationError' title: Detail ``` -------------------------------- ### Generate Questions Using OpenAI (Python) Source: https://docs.presenton.ai/tutorial/create-agent-to-create-pitch-decks This function uses the OpenAI API to generate exactly 3 relevant questions based on provided company information. It constructs a prompt detailing company specifics and uses a function-calling tool to ensure structured output. Includes fallback questions and error handling. ```python def generate_questions(self, company_info: Dict[str, str]) -> List[str]: """Generate questions using OpenAI based on company information""" print("šŸ¤– Generating questions using OpenAI...") prompt = f""" Based on this company information, generate exactly 3 relevant questions to ask the user to better understand their business for creating a pitch deck: Company URL: {company_info['url']} Company Title: {company_info['title']} Company Description: {company_info['description']} H1: {company_info['h1']} First Paragraph: {company_info['first_paragraph']} Generate 3 specific, relevant questions that will help create a compelling pitch deck. Focus on understanding their business model, target market, unique value proposition, and growth plans. The questions should be clear, specific, and designed to gather essential information for creating a professional pitch deck. """ try: response = self.openai_client.chat.completions.create( model="gpt-4o-mini", messages=[{"role": "user", "content": prompt}], tools=[{ "type": "function", "function": { "name": "get_questions", "description": "Get exactly 3 questions to ask the user about their business", "parameters": { "type": "object", "properties": { "questions": { "type": "array", "items": {"type": "string"}, "description": "List of exactly 3 questions to ask the user about their business" } }, "required": ["questions"] } } }], tool_choice={"type": "function", "function": {"name": "get_questions"}}, max_tokens=300, temperature=0.7 ) # Extract questions from the tool call response tool_call = response.choices[0].message.tool_calls[0] arguments = json.loads(tool_call.function.arguments) questions = arguments.get('questions', []) # Ensure we have exactly 3 questions if len(questions) < 3: fallback_questions = [ "What is your company's main product or service?", "Who is your target market?", "What makes your solution unique?" ] questions = questions + fallback_questions[:3-len(questions)] else: questions = questions[:3] print("āœ… Generated questions:") for i, question in enumerate(questions, 1): print(f" {i}. {question}") # Store the questions for later use in structure generation self.last_questions = questions return questions except Exception as e: print(f"āŒ Error generating questions: {str(e)}") return [ "What is your company's main product or service?", "Who is your target market?", "What makes your solution unique?" ] ``` -------------------------------- ### Configure OpenAI Client with API Key in Python Source: https://docs.presenton.ai/tutorial/create-agent-to-create-pitch-decks This Python method within the 'PitchDeckGenerator' class sets up the OpenAI client. It retrieves the API key from the 'OPENAI_API_KEY' environment variable. If the key is not found, it prints an error message and exits the script. It then initializes the OpenAI client with the provided API key. ```python def setup_openai(self): """Setup OpenAI client with API key""" api_key = os.getenv('OPENAI_API_KEY') if not api_key: print("āŒ Error: OPENAI_API_KEY environment variable not set") print("Please set your OpenAI API key: export OPENAI_API_KEY='your-key-here'") sys.exit(1) self.openai_client = openai.OpenAI(api_key=api_key) ``` -------------------------------- ### Generate Pitch Deck Structure with OpenAI API (Python) Source: https://docs.presenton.ai/tutorial/create-agent-to-create-pitch-decks Generates a markdown-formatted pitch deck structure using the OpenAI API. It takes company information and user answers to questions as input to create a relevant outline. Dependencies include the OpenAI client library. The output is a string representing the markdown structure. ```python def generate_pitch_deck_structure(self, company_info: Dict[str, str], answers: List[str]) -> str: """Generate pitch deck structure using OpenAI""" print("šŸ¤– Generating pitch deck structure...") prompt = f""" Create a comprehensive pitch deck structure in markdown format for this company: Company Information: - URL: {company_info['url']} - Title: {company_info['title']} - Description: {company_info['description']} - H1: {company_info['h1']} Questions Asked and User Answers: {chr(10).join([f"Q: {question}\nA: {answer}\n" for question, answer in zip(self.last_questions, answers)])} Generate a pitch deck structure with 8-12 slides covering: 1. Title slide with company name and tagline 2. Problem statement 3. Solution overview 4. Market opportunity 5. Business model 6. Competitive advantage 7. Go-to-market strategy 8. Financial projections 9. Team 10. Funding ask (if applicable) 11. Contact information Use the questions and answers provided to create a more targeted and relevant pitch deck structure. Format as markdown with clear slide titles and bullet points for content. """ try: response = self.openai_client.chat.completions.create( model="gpt-4o-mini", messages=[{"role": "user", "content": prompt}], max_tokens=1500, temperature=0.7 ) structure = response.choices[0].message.content.strip() print("āœ… Generated pitch deck structure") return structure except Exception as e: print(f"āŒ Error generating structure: {str(e)}") return self.get_default_structure(company_info) ``` -------------------------------- ### Get Presentation Generation Status (OpenAPI) Source: https://docs.presenton.ai/api-reference/presentation/check-async-presentation-generation-status This OpenAPI definition describes the GET request to check the status of an asynchronous presentation generation task. It details the request parameters (task ID, Authorization header) and the structure of the JSON response for both successful (200) and validation error (422) cases. ```yaml paths: path: /api/v1/ppt/presentation/status/{id} method: get servers: - url: https://api.presenton.ai request: security: [] parameters: path: id: schema: - type: string required: true title: Id description: ID of the presentation generation task query: {} header: Authorization: schema: - type: string required: true title: Authorization description: The bearer token to authenticate with cookie: {} body: {} response: '200': application/json: schemaArray: - type: object properties: id: allOf: - type: string title: Id status: allOf: - type: string title: Status message: allOf: - anyOf: - type: string - type: 'null' title: Message error: allOf: - anyOf: - additionalProperties: true type: object - type: 'null' title: Error created_at: allOf: - type: string format: date-time title: Created At updated_at: allOf: - type: string format: date-time title: Updated At data: allOf: - anyOf: - additionalProperties: true type: object - type: 'null' title: Data title: AsyncPresentationGenerationTaskModel refIdentifier: '#/components/schemas/AsyncPresentationGenerationTaskModel' requiredProperties: - status examples: example: value: id: status: message: error: {} created_at: '2023-11-07T05:31:56Z' updated_at: '2023-11-07T05:31:56Z' data: {} description: Successful Response '422': application/json: schemaArray: - type: object properties: detail: allOf: - items: $ref: '#/components/schemas/ValidationError' type: array title: Detail title: HTTPValidationError refIdentifier: '#/components/schemas/HTTPValidationError' examples: example: value: detail: - loc: - msg: type: description: Validation Error deprecated: false type: path components: schemas: ValidationError: properties: loc: items: anyOf: - type: string - type: integer type: array title: Location msg: type: string title: Message type: type: string title: Error Type type: object required: - loc - msg - type title: ValidationError ``` -------------------------------- ### GET /api/v1/ppt/presentation/all Source: https://docs.presenton.ai/api-reference/presentation/get-all-user-presentations Retrieves all presentations for the authenticated user. Supports pagination to manage large result sets. ```APIDOC ## GET /api/v1/ppt/presentation/all ### Description Retrieves all presentations for the authenticated user. Supports pagination to manage large result sets. ### Method GET ### Endpoint https://api.presenton.ai/api/v1/ppt/presentation/all ### Parameters #### Query Parameters - **page** (integer) - Optional - The page number to retrieve. Defaults to 1. - **page_size** (integer) - Optional - The number of items per page. Defaults to 10. #### Header Parameters - **Authorization** (string) - Required - The bearer token to authenticate with. Example: `Bearer sk-presenton-xxxxxxxx` ### Request Example ```json { "Authorization": "Bearer sk-presenton-xxxxxxxx" } ``` ### Response #### Success Response (200) - **total_pages** (integer) - The total number of pages available. - **page** (integer) - The current page number. - **page_size** (integer) - The number of items per page. - **results** (array) - An array containing the user's presentations. #### Response Example ```json { "total_pages": 123, "page": 1, "page_size": 10, "results": [ // Presentation objects go here ] } ``` #### Error Response (422) - **detail** (array) - An array of validation errors. #### Error Response Example ```json { "detail": [ { "loc": [ "query", "page" ], "msg": "value is not a valid integer", "type": "type_error.integer" } ] } ``` ``` -------------------------------- ### GET /api/v1/ppt/presentation/status/{task_id} Source: https://docs.presenton.ai/api-reference/presentation/generate-presentation-async Retrieves the status of an ongoing or completed presentation generation task using its unique task ID. ```APIDOC ## GET /api/v1/ppt/presentation/status/{task_id} ### Description Retrieves the status of a presentation generation task. Use the task ID obtained from the POST /api/v1/ppt/presentation endpoint. ### Method GET ### Endpoint /api/v1/ppt/presentation/status/:task_id ### Parameters #### Path Parameters - **task_id** (string) - Required - The ID of the presentation generation task. #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication (e.g., Bearer sk-presenton-xxxxxxxx). ### Response #### Success Response (200) - **status** (string) - The current status of the task (e.g., 'PENDING', 'PROCESSING', 'COMPLETED', 'FAILED'). - **presentation_url** (string) - Optional - URL to the generated presentation if the status is 'COMPLETED'. - **error_message** (string) - Optional - Description of the error if the status is 'FAILED'. #### Response Example ```json { "status": "COMPLETED", "presentation_url": "https://presenton.ai/presentations/xxxxxxxxxx.pptx" } ``` #### Error Response (400/401/500) - **error** (string) - Description of the error. ```json { "error": "Task not found" } ``` ``` -------------------------------- ### Generate Presentation via API (JavaScript) Source: https://docs.presenton.ai/tutorial/generate-presentation-over-api-using-docker Demonstrates how to generate a presentation using the Fetch API in JavaScript. It sends a POST request to the Presenton API with presentation details in JSON format. Handles the response and potential errors. ```javascript fetch("http://localhost:5000/api/v1/ppt/presentation/generate", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ content: "Introduction to Machine Learning", n_slides: 5, language: "English", template: "general", export_as: "pptx" }) }) .then(res => res.json()) .then(data => console.log(data)) .catch(err => console.error("Error:", err)); ``` -------------------------------- ### Import Python Libraries for Pitch Deck Generation Source: https://docs.presenton.ai/tutorial/create-agent-to-create-pitch-decks This Python code block imports essential libraries for the pitch deck generation script. It includes modules for HTTP requests, JSON handling, environment variables, URL parsing, web scraping (BeautifulSoup), OpenAI API interaction, and Pydantic for data models. ```python import requests import json import os import sys from urllib.parse import urlparse from bs4 import BeautifulSoup import openai from typing import Dict, List, Optional from pydantic import BaseModel, Field ``` -------------------------------- ### GET /websites/presenton_ai/presentations/{presentationId} Source: https://docs.presenton.ai/api-reference/presentation/get-presentation-and-slides-by-id Fetches a presentation and its slides based on the provided presentation ID. An API key is required for authentication. ```APIDOC ## GET /websites/presenton_ai/presentations/{presentationId} ### Description Retrieves a presentation and its slides by its unique identifier. ### Method GET ### Endpoint /websites/presenton_ai/presentations/{presentationId} ### Parameters #### Path Parameters - **presentationId** (string) - Required - The unique identifier of the presentation. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **presentationId** (string) - The ID of the presentation. - **title** (string) - The title of the presentation. - **slides** (array) - A list of slides within the presentation. - **slideId** (string) - The ID of the slide. - **content** (string) - The content of the slide. #### Response Example ```json { "presentationId": "pres_12345", "title": "My Awesome Presentation", "slides": [ { "slideId": "slide_abc", "content": "This is the first slide." }, { "slideId": "slide_def", "content": "This is the second slide." } ] } ``` ### Authentication An API Key is required for authentication. Include it in the `Authorization` header as a Bearer token. **Authorization**: `Bearer sk-presenton-xxxxxxxx` ``` -------------------------------- ### Python: Main Execution Flow for Pitch Deck Generator Source: https://docs.presenton.ai/tutorial/create-agent-to-create-pitch-decks This Python script defines the main execution flow for generating a pitch deck. It handles user input for a company URL, fetches company information, generates questions, collects answers, structures the pitch deck, and calls the Presenton API to generate the final presentation. It includes functions for running the generator and a main entry point. ```python def run(self): """Main execution flow""" print("šŸš€ Pitch Deck Generator") print("=" * 50) # Get company URL company_url = input("Enter the company website URL: ").strip() if not company_url: print("āŒ No URL provided. Exiting.") return # Fetch company information company_info = self.fetch_company_info(company_url) # Generate questions questions = self.generate_questions(company_info) # Get user answers answers = self.get_user_answers(questions) # Generate pitch deck structure structure = self.generate_pitch_deck_structure(company_info, answers) # Generate presentation result = self.generate_presentation(company_info, structure) if result: print("\nšŸŽ‰ Pitch deck generation completed!") print(f"šŸ“„ You can download the pitch deck from: {self.presenton_base_url}{result.get('path')}") print(f"āœļø Edit the pitch deck at: {self.presenton_base_url}{result.get('edit_path')}") else: print("\nāŒ Failed to generate presentation. Please check your setup.") def main(): """Main entry point""" generator = PitchDeckGenerator() generator.run() if __name__ == "__main__": main() ``` -------------------------------- ### Generate Presentation Source: https://docs.presenton.ai/guide/generate-presentation-with-templates-and-themes Generates a presentation based on provided content, number of slides, language, template, and theme. ```APIDOC ## POST /api/v1/ppt/presentation/generate ### Description Generates a presentation with a specified number of slides, using a chosen template and theme. The presentation content is derived from the provided text. ### Method POST ### Endpoint /api/v1/ppt/presentation/generate ### Parameters #### Request Body - **content** (string) - Required - The main topic or content for the presentation. - **n_slides** (integer) - Required - The desired number of slides in the presentation. - **language** (string) - Required - The language for the presentation content (e.g., "English"). - **template** (string) - Required - The name of the template to use for the presentation (e.g., "general", "modern"). - **theme** (string) - Required - The name of the theme to apply to the presentation (e.g., "edge-yellow", "mint-blue"). - **export_as** (string) - Required - The desired format for the exported presentation (e.g., "pdf"). ### Request Example ```json { "content": "Introduction to Machine Learning", "n_slides": 5, "language": "English", "template": "general", "theme": "edge-yellow", "export_as": "pdf" } ``` ### Response #### Success Response (200) - **presentation_id** (string) - The unique identifier for the generated presentation. - **path** (string) - The URL to access the generated presentation file. - **edit_path** (string) - The URL to edit the presentation online. - **credits_consumed** (integer) - The number of credits consumed for generating the presentation. #### Response Example ```json { "presentation_id": "d3000f96-096c-4768-b67b-e99aed029b57", "path": "https://api.presenton.ai/static/user_data/d3000f96-096c-4768-b67b-e99aed029b57/Introduction_to_Machine_Learning.pdf", "edit_path": "https://presenton.ai/presentation?id=d3000f96-096c-4768-b67b-e99aed029b57", "credits_consumed": 5 } ``` ``` -------------------------------- ### GET /api/v1/ppt/presentation/{id} Source: https://docs.presenton.ai/guide/edit-presentation-using-api Fetches the details of an existing presentation, including slide indices, content, and schema. Useful for understanding what can be edited. ```APIDOC ## GET /api/v1/ppt/presentation/{id} ### Description Fetches the details of an existing presentation, including slide indices, content, and schema. Useful for understanding what can be edited. ### Method GET ### Endpoint /api/v1/ppt/presentation/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the presentation to fetch. ### Response #### Success Response (200) - **slides** (array) - A list of slide objects containing their index and editable content. - **index** (integer) - The index of the slide. - **content** (object) - The current content of the slide. #### Response Example ```json { "slides": [ { "index": 0, "content": { "title": "Example Title" } }, { "index": 5, "content": { "companyName": "Old Company Name", "revenue": 1000000 } } ] } ``` ``` -------------------------------- ### Generate Presentation with Presenton API (Python) Source: https://docs.presenton.ai/tutorial/create-agent-to-create-pitch-decks Generates a presentation file (e.g., PDF) using the Presenton API. It takes company information and a pre-generated pitch deck structure as input. This function makes a POST request to the Presenton API endpoint. Dependencies include the 'requests' library. The output is a dictionary containing presentation details or None if an error occurs. ```python def generate_presentation(self, company_info: Dict[str, str], structure: str) -> Optional[Dict]: """Generate presentation using Presenton API""" print("šŸŽØ Generating presentation using Presenton API...") presentation_prompt = f""" Create a professional pitch deck for {company_info['title']}. Company Information: - Website: {company_info['url']} - Description: {company_info['description']} Pitch Deck Structure: {structure} Create a compelling pitch deck with professional slides, clear messaging, and engaging visuals. Focus on storytelling and making the business case compelling. """ try: url = f"{self.presenton_base_url}/api/v1/ppt/presentation/generate" data = { 'content': presentation_prompt, 'n_slides': 10, 'language': 'English', 'template': 'general', 'export_as': 'pdf' } print("Presentation generation can take a couple of minutes, please wait...") response = requests.post( url, data=data, timeout=500, headers={"Authorization": "Bearer sk-presenton-xxxxx"} ) response.raise_for_status() result = response.json() print("āœ… Presentation generated successfully!") print(f" Presentation ID: {result.get('presentation_id')}") print(f" Download path: {result.get('path')}") print(f" Edit URL: {self.presenton_base_url}{result.get('edit_path')}") return result except requests.exceptions.RequestException as e: print(f"āŒ Error connecting to Presenton API: {str(e)}") return None except Exception as e: print(f"āŒ Error generating presentation: {str(e)}") return None ``` -------------------------------- ### GET /api/v1/ppt/presentation/status/task-xxxxxxxxxx Source: https://docs.presenton.ai/api-reference/presentation/create-presentation-from-json-async Retrieves the status of a presentation creation task using its unique task ID. This allows you to monitor the progress and completion of your asynchronous presentation generation requests. ```APIDOC ## GET /api/v1/ppt/presentation/status/:task_id ### Description Get the status of presentation creation. ### Method GET ### Endpoint /api/v1/ppt/presentation/status/:task_id ### Parameters #### Path Parameters - **task_id** (string) - Required - The ID of the presentation creation task. #### Header Parameters - **Authorization** (string) - Required - Bearer token for authentication. ### Response #### Success Response (200) - **status** (string) - The current status of the task (e.g., 'processing', 'completed', 'failed'). - **presentation_url** (string) - (Optional) The URL to the generated presentation if the status is 'completed'. #### Response Example ```json { "status": "completed", "presentation_url": "https://example.com/path/to/your/presentation.pptx" } ``` ``` -------------------------------- ### POST /api/v1/ppt/presentation/generate Source: https://docs.presenton.ai/guide/configuration-and-controls-for-generation Generates a presentation based on provided content and instructions. The `export_as` parameter allows specifying the output format. ```APIDOC ## POST /api/v1/ppt/presentation/generate ### Description Generates a presentation from given text content and instructions. Supports various output formats including PPTX and PDF. ### Method POST ### Endpoint https://api.presenton.ai/api/v1/ppt/presentation/generate ### Parameters #### Query Parameters - **theme** (string) - Optional - Specifies the theme for the presentation. #### Request Body - **content** (string) - Required - The main text content for the presentation. - **instructions** (string) - Optional - Specific instructions for content generation. - **tone** (string) - Optional - The desired tone of the presentation (e.g., 'educational'). - **verbosity** (string) - Optional - The level of detail in the presentation. - **web_search** (boolean) - Optional - Whether to use web search for content. - **image_type** (string) - Optional - The type of images to use (e.g., 'ai-generated'). - **n_slides** (integer) - Optional - The number of slides to generate. - **language** (string) - Optional - The language of the presentation. - **template** (string) - Optional - The template to use for the presentation. - **include_table_of_contents** (boolean) - Optional - Whether to include a table of contents. - **include_title_slide** (boolean) - Optional - Whether to include a title slide. - **export_as** (string) - Optional - The desired export format ('pptx' or 'pdf'). Defaults to 'pptx'. ### Request Example ```json { "content": "Introduction to Machine Learning", "instructions": "Focus on beginner-friendly explanations and add examples.", "tone": "educational", "verbosity": "standard", "web_search": true, "image_type": "ai-generated", "n_slides": 5, "language": "English", "template": "general", "include_table_of_contents": true, "include_title_slide": true, "export_as": "pptx" } ``` ### Response #### Success Response (200) - **presentation_id** (string) - The unique identifier for the generated presentation. - **path** (string) - The URL to download the generated presentation file. - **edit_path** (string) - The URL to edit the presentation online. - **credits_consumed** (integer) - The number of credits consumed for this generation. #### Response Example ```json { "presentation_id": "d3000f96-096c-4768-b67b-e99aed029b57", "path": "https://api.presenton.ai/static/user_data/d3000f96-096c-4768-b67b-e99aed029b57/Introduction_to_Machine_Learning.pptx", "edit_path": "https://presenton.ai/presentation?id=d3000f96-096c-4768-b67b-e99aed029b57", "credits_consumed": 5 } ``` ```