Structured Generative AI Workout Architect

By (author)BUSHRA Khalid

Tech stack:
PY

A robust Python module that uses Google's Gemini to generate highly personalized workout plans while strictly adhering to a predefined exercise librar...
read more
AI Contributions:0
Published At:August 13, 2026
Files Included:1 file(s)
Updated At:October 22, 2026

Read Me

# Structured Generative AI Workout Architect

This module bridges the gap between the creative power of Large Language Models (like Google Gemini) and the strict safety requirements of a fitness application.

## Features
1. **Context-Aware Prompting**: The AI is fed not only the user's goals and equipment, but also their *recent performance history* and *recently prescribed plans*. This ensures progressive overload and workout variety, bypassing the common issue of an LLM generating the exact same response for a given user profile.
2. **Structured JSON Output**: Enforces strict JSON schemas on the Gemini API response so the client app always receives a predictable, strongly-typed data structure (blocks, exercises, reps, sets, warmups, cooldowns).
3. **Anti-Hallucination Sanitization**: The most critical feature. Even when explicitly instructed not to, LLMs occasionally hallucinate exercises or ignore physical equipment constraints. The `_sanitize_plan` function acts as a firewall, intercepting the AI's output and cross-referencing every prescribed movement against the definitive database library. Any exercise that the user lacks equipment for, or that doesn't exist in the library, is safely stripped out.
4. **Fallback Safety**: If Gemini times out, returns malformed JSON, or if the sanitization pass strips out too many invalid exercises (dropping below a minimum threshold), the module gracefully delegates to a local, deterministic fallback engine.

This Code Gig is an excellent blueprint for developers looking to build safe, reliable, and strictly structured generative AI features into production applications.
```

Loading

Loading

Loading

More like this View all

gig-claude-developer-security-report

Turns deterministic security-scan findings into a plain-English developer report using live Claude — the AI writes the narrative, never the severity or facts.

  • 0

    Ratings

  • 4

    Files

    • PY

    Tech stack

ML Audit — SHAP Explainability Module

A plug-and-play Python script for auditing machine learning models using SHAP (SHapley Additive exPlanations). Produces client-ready charts, ranked importance tables, and flagged predictions suitable

  • 0

    Ratings

  • 1

    Files

    • PY

    Tech stack

AI Q&A: Repo-Aware Chat with 3-Tier Fallback

CodeMesh-AIs AI chat endpoint: searches indexed files for context, then tries OpenAI, local Ollama, then a heuristic fallback — so it always answers, even with zero AI providers configured.

  • 0

    Ratings

  • 1

    Files

    • PY

    Tech stack