From 7109a496f1a5e41de0ac04af10f2b66ad3455db8 Mon Sep 17 00:00:00 2001 From: sauravniraula Date: Wed, 16 Jul 2025 22:03:46 +0545 Subject: [PATCH] fix(fastapi): improves slide layout selection system prompt --- .../generate_presentation_structure.py | 45 ++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/servers/fastapi/utils/llm_calls/generate_presentation_structure.py b/servers/fastapi/utils/llm_calls/generate_presentation_structure.py index 6e632419..34880943 100644 --- a/servers/fastapi/utils/llm_calls/generate_presentation_structure.py +++ b/servers/fastapi/utils/llm_calls/generate_presentation_structure.py @@ -13,22 +13,44 @@ def get_prompt(presentation_layout: PresentationLayoutModel, n_slides: int, data return [ { "role": "system", + # "content": f""" + # You're a professional presentation designer with years of experience in designing clear and engaging presentations. + # {presentation_layout.to_string()} + # # Steps + # 1. Analyze provided Number of slides, Presentation title, Slides content and Presentation Layout. + # 2. Select appropriate slide layout **index** for each slide. + # # Notes + # - Slide layout should be selected based on provided content for slide and notes. + # - Don't fall into patterns like always using layout 2 and after layout 1. + # - Each presentation should have its own unique flow and rhythm. + # - Select type for {n_slides} slides. + # **Go through notes and steps and make sure they are all followed. Rule breaks are strictly not allowed.** + # """, "content": f""" - You're a professional presentation designer with years of experience in designing clear and engaging presentations. - + You're a professional presentation designer. {presentation_layout.to_string()} - # Steps - 1. Analyze provided Number of slides, Presentation title, Slides content and Presentation Layout. - 2. Select appropriate slide layout **index** for each slide. + # CRITICAL RULES + - NEVER use layout type 1 (bullet points) for more than 30% of slides + - MUST use at least 3 different layout types across presentation + - NO consecutive slides with same layout type - # Notes - - Slide layout should be selected based on provided content for slide and notes. - - Don't fall into patterns like always using layout 2 and after layout 1. - - Each presentation should have its own unique flow and rhythm. - - Select type for {n_slides} slides. + # Selection Strategy + 1. **Ignore bullet point format** - focus on slide PURPOSE + 2. **Match content to layout**: + - Title/intro → Title layouts + - Process/steps → Visual process layouts + - Comparisons → Side-by-side layouts + - Data → Chart/graph layouts + - Concepts → Image + text layouts + - Key messages → Emphasis layouts - **Go through notes and steps and make sure they are all followed. Rule breaks are strictly not allowed.** + 3. **Force variety**: If recently used a layout type, pick different one + 4. **Prioritize visual layouts** over text-heavy ones + + **Think PURPOSE not FORMAT. Make it visually engaging.** + + Select layout index for each of the {n_slides} slides. """, }, { @@ -60,4 +82,5 @@ async def generate_presentation_structure( ), response_format=response_model, ) + print(response.choices[0].message.parsed) return response.choices[0].message.parsed