Building a chat assistant or form for a multi-slot AI video tool often leads to hallucinated features and confusing pricing. A new tutorial on DEV.to tackles this exact pain point for the tinydeskoutstanding.video studio, a parody site for NPRโ€™s Tiny Desk Concerts. The author, lpgit, demonstrates how to replace subjective scene selection with a deterministic 40-line Python script. By treating seat availability as data, the code ensures users always pick the correct template without guessing.

The Seat Map and Pricing Logic

The studio offers three distinct scenes: 'Just Me' (1 slot), 'Back Row' (2 slots), and 'Whole Band' (5 slots). The critical insight for developers is that pricing is fixed per scene and resolution, not per photo uploaded. The script defines these constraints explicitly in a SCENES dictionary, pulling seat names directly from the site's llms.txt to match the UI. Prices range from $9.98 for 480p to $39.98 for 4K, identical across all three scenes. This uniformity simplifies the logic: the goal is minimizing UI complexity, not cost.

Solving for the Smallest Fit

The core function, pick_scene, treats the user's requested seats as a set and finds the smallest scene that covers them. This prevents over-engineering; if a user only wants to replace the lead singer, the script forces the 'Just Me' scene instead of the five-slot 'Whole Band' option. Fewer slots mean fewer opportunities for user error in photo placement. The code also handles edge cases, such as requesting a non-existent 'Drummer' seat, by raising a clear ValueError. This guardrail stops AI assistants from inventing UI elements that don't exist.

Common Pitfalls and Guardrails

The tutorial highlights three frequent mistakes users make without this logic. First, there is no standalone 'Sax only' scene; users must select 'Whole Band' and leave other seats empty. Second, combining a lead singer and a back singer requires the 'Whole Band' scene, as neither smaller scene covers both. Third, the pricing model does not penalize larger scenes, so users don't need to fear extra costs for flexibility. The script outputs a clear plan, listing which seats will be filled and which will retain original performers.

Key Takeaways

  • Use data structures to map UI constraints, preventing AI hallucinations about available features.
  • Pricing uniformity across scenes allows developers to optimize for user experience, not cost.
  • Explicit error handling for invalid inputs (like non-existent seats) is crucial for assistant reliability.

The Bottom Line

Stop letting your chatbot paraphrase product pages. Give it the seat map as data and let pure functions handle the logic.