I Replaced My “Dumb” Ask NHL With AI… and It Actually Slaps A developer replaced a hardcoded NHL stats app with an AI-powered assistant using Google's Gemini API, allowing users to ask natural-language questions about hockey. The project demonstrates how to structure prompts and implement retry logic for reliable AI responses. “Who are the top scorers this season?” Old app: ❌ hardcoded endpointsjust knows New app: ✅ AI that Yeah… we’re doing that. I turned my Ask NHL screen into a real AI-powered assistant using Google’s Gemini API — and it took way less code than you think 👀 Let’s build it together 🛠️ Most sports apps do this: But users don’t think in endpoints… they think in questions: 👉 “Who’s the best goalie right now?” 👉 “Who leads in penalty minutes?” 👉 “What happened in today’s games?” So I said… screw it. Let’s let AI handle it. We send a user’s question → to Gemini → get a clean NHL answer back. That’s it. But the 🔑 is how you structure it so it’s: If your prompt sucks… your AI sucks 🤷♂️ Here’s mine: private fun buildPrompt question: String : String = """ You are the "Ask NHL" assistant inside an NHL fan app. Answer the user's hockey question directly and concisely 2-4 sentences max . If the question isn't about hockey or the NHL, politely say you can only help with NHL topics. Question: $question""".trimIndent Here’s the full request flow with Retry/Backoff strategy — this is a must : / Talks to Gemini to answer free-text NHL questions from the "Ask NHL" screen. /class AskNhlRepository @Inject constructor private val geminiApi: GeminiApi, { / Sends question to Gemini and returns the generated answer text. Wrapped in a Result so the ViewModel can cleanly show an error state instead of crashing or leaking a raw exception into the UI layer. Retries transient failures rate limits, 5xx, network blips with exponential backoff before giving up — Gemini free-tier flash throws 503 "overloaded" fairly often, so one failed attempt isn't treated as a real failure yet. / suspend fun askQuestion question: String : Result