Minu's Games logo
MINU'S ROBOTICS

A Minu's Games EdTech Lab

← Code & Cognition
Day 28 of 30Artificial Intelligence

💬Prompting & Using AI APIs

🎯 Today's objective

Get reliable results from an LLM and call it from Python.

📖 Key concepts

  • Clear prompts: role, task, format, examples
  • Temperature controls randomness
  • Validate & never trust blindly (hallucinations)
  • Keep API keys secret (server-side)

💻 Try this code

# Pattern for calling an LLM API from Python (pseudo-code)
import os
# client = SomeLLM(api_key=os.environ["LLM_API_KEY"])  # key from env, never hard-coded
prompt = "You are a tutor. Explain loops to a 12-year-old in 3 bullet points."
# print(client.generate(prompt))

👥 Learn it your way

🧒 Young Explorers

Talking to AI is a skill: clear, specific questions get clear, specific answers.

Your task

Write a great prompt that turns a paragraph into a 3-line summary for a 10-year-old.

💼 Professionals

Treat prompts as code: version them, add structure/examples, validate outputs, handle keys via env.

Your task

Design a prompt + simple output check for "extract name, date, amount from an email".

🤖 AI connection

Prompt engineering + API calls is the most in-demand practical AI skill right now — and it’s just functions, strings, and env vars you already know.

✅ Quick check

Where should API keys live?

In environment variables / server-side — never hard-coded or client-side.

What is a hallucination?

When an AI confidently states something false.