QM2 Evolution: From Static Engine to AI-Powered Intelligence

Published: (March 14, 2026 at 03:20 AM EDT)
2 min read
Source: Dev.to

Source: Dev.to

Overview

A high‑performance CLI quiz engine built with Python, now evolved into a smart study companion with Gemini AI integration and 84 % test coverage.

New Release: QM2 v1.1.0

The latest version adds a “brain” to the engine by integrating Google Gemini AI. The goal is to generate a 20‑question, high‑quality quiz on any topic in under 10 seconds using the Gemini 1.5 & 2.0 Flash models.

AI‑Powered Features

  • Topic‑to‑Quiz – Simply provide a topic (e.g., “Advanced Python Decorators” or “World War II History”) and the tool creates a full quiz instantly.
  • Multi‑Type Support – The AI generates all four supported question types:
    1. Multiple Choice
    2. True/False
    3. Fill‑in‑the‑blank
    4. Matching pairs
  • Smart Retries – Exponential backoff and a fallback chain (Gemini 2.0 Flash → 1.5 Flash → 1.5 Pro) keep the experience uninterrupted even when rate limits are hit.
  • Advanced JSON Sanitization – A custom module strips any AI “chatter” and extracts a clean, valid quiz schema.

Implementation Details

  • Google GenAI SDK – Handles communication with Gemini models.
  • Exponential Backoff Logic – Gracefully manages API rate limits.
  • Mocked AI Testingunittest.mock simulates Gemini responses, allowing CI/CD to verify JSON parsing and fallback logic without a real API key or token usage.

Installation & Usage

# Upgrade to the latest version
pip install --upgrade qm2
# Set your Gemini API key
export GEMINI_API_KEY="your_google_ai_key"

# Run QM2
qm2

Enter a topic when prompted, and the CLI will generate the quiz on the fly.

Documentation & Resources

  • PyPI:
  • GitHub:
  • Docs:

Call to Action

If QM2 helps your study sessions, consider starring the GitHub repository. Your feedback is welcome—let’s discuss the future of AI‑generated educational content in the comments!

0 views
Back to Blog

Related posts

Read more »

Travigo

Travel as fast as you speak with Gemini! Where live agents meet immersive storytelling & 3D navigation. This project was created for entering the Gemini Live Ag...

Micro games

Hey Gamers! 👾 As part of the Rapid Games Prototyping module, we are tasked with reviewing a peer's game. The challenge is to analyse a prototype built in just...