AI Pathfinder (Ages 15-18)

Module 7 of 10

Module 07: Building AI-Powered Projects

4 min read622 words
What you'll learn
Structure a tiny repo: `README`, `requirements.txt`, `.env.example`, entry script.Outline a sentiment CLI, study chatbot, and CSV dashboard—and know which fits your access to APIs.List failure modes: rate limits, sarcasm, empty input, formatting slips.Package evidence: sample inputs/outputs, known weaknesses, no secrets.

Your feed: “I shipped an app in twelve seconds.” Your reality: blank file, traceback butterflies, and a club demo you actually care about. This module bridges using AI to composing with it—portfolio habits, honest limits, and keys that never touch Discord.

Prerequisites: Modules 04–06 comfort. Safety: .env in .gitignore; revoke leaked keys immediately.

Time: First run ~2–4 hours; polish one track over ~6–10 hours.

Learning Objectives

By the end of this module, you will be able to:

  • Structure a tiny repo: README, requirements.txt, .env.example, entry script.
  • Outline a sentiment CLI, study chatbot, and CSV dashboard—and know which fits your access to APIs.
  • List failure modes: rate limits, sarcasm, empty input, formatting slips.
  • Package evidence: sample inputs/outputs, known weaknesses, no secrets.

1. Maker Mindset

Judges and mentors ask “what broke?” Known bugs + tests beat fake polish.

Habits: ugly v1 fast; keep ~10 test phrases; name limits (“English only; not for crisis counseling”).

Try This! Five bullets: app that would help your week—circle the smallest idea.

2. Folder Layout (Sketch)

project/
  README.md
  requirements.txt
  .env.example
  .gitignore   # must list .env
  data/sample.csv
  outputs/
  main_*.py
  tests/sample_cases.txt

.gitignore must include: .env, __pycache__, venv folders.

requirements.txt (concept): openai, python-dotenv, pandas, matplotlib—pin tighter before fairs.

3. Project A — Sentiment CLI (Shape)

Flow: read text → call chat API with low temperature → print LABEL | confidence | short reasonyou sanity-check sarcasm/slang.

Without pasting full API code: load key from os.environ, refuse empty input, cap output format in the system string, log off by default for privacy.

4. Project B — Study Buddy Chatbot (Shape)

System rules: tutor, not ghostwriter; refuse full graded submissions; suggest hints/outlines/practice; escalate uncertainty to textbook/teacher; no crisis counseling—point to trusted humans.

Memory: keep last N turns to control cost; trim oldest first.

5. Project C — Dashboard from CSV

Flow: read_csv → required columns check → describe() → two saved charts (trend + distribution). No API key—pairs well with AI projects (“model interprets; Python counts”).

6. Testing / Golden List

tests/sample_cases.txt — one string per line for sentiment. For dashboards, tiny CSV with edge cases your code should reject clearly.

SymptomLikely fix
401Key/env typo or revoked key
Rate limitSleep, smaller batches
Weird labelsLower temperature for classification
Empty replyContent filter—shorten/safer input

Hands-On: Dashboard Core

Key Example: CSV in, summaries + two PNGs out—great science-fair backbone even if you skip cloud APIs entirely.

python
[object Object], argparse
,[object Object], pathlib ,[object Object], Path
,[object Object], pandas ,[object Object], pd
,[object Object], matplotlib.pyplot ,[object Object], plt

,[object Object], ,[object Object],():
    p = argparse.ArgumentParser()
    p.add_argument(,[object Object],, ,[object Object],=Path)
    p.add_argument(,[object Object],, ,[object Object],=Path, default=Path(,[object Object],))
    args = p.parse_args()

    df = pd.read_csv(args.csv_path)
    ,[object Object], col ,[object Object], (,[object Object],, ,[object Object],, ,[object Object],):
        ,[object Object], col ,[object Object], ,[object Object], df.columns:
            ,[object Object], SystemExit(,[object Object],)

    df[,[object Object],] = pd.to_datetime(df[,[object Object],])
    ,[object Object],(,[object Object],, ,[object Object],(df))
    ,[object Object],(,[object Object],, ,[object Object],)
    ,[object Object],(,[object Object],, ,[object Object],)

    args.out.mkdir(parents=,[object Object],, exist_ok=,[object Object],)
    plt.figure(figsize=(,[object Object],, ,[object Object],))
    plt.plot(df[,[object Object],], df[,[object Object],], marker=,[object Object],)
    plt.title(,[object Object],)
    plt.xlabel(,[object Object],)
    plt.ylabel(,[object Object],)
    plt.tight_layout()
    plt.savefig(args.out / ,[object Object],, dpi=,[object Object],)
    plt.close()
    ,[object Object],(,[object Object],, args.out / ,[object Object],)

,[object Object], __name__ == ,[object Object],:
    main()

Stretch (words): add histogram of mood_score; optional OPENAI_API_KEY sentiment on one journal line you type—document disagreements.

Practice Challenges

Batch-read lines to CSV results; A/B system personas; --min-mood filter before plots; integrity probe (“write my whole essay”); cents estimate for 500 API calls; parse | outputs safely.

Your Challenge

Pick one track to polish:

  • S — sentiment + weekly journal CSV
  • C — scoped study coach with vocab in system context
  • D — real anonymous two-week data + poster charts + three-sentence surprise

Deliverables: public repo without secrets, README install/run, 10 test lines/rows, three honest weaknesses.

Discuss: Two-minute demo to a friend—what question stumped you? That’s next week’s fix list.

Key Takeaways

  • README + requirements + .env.example are the product intro.
  • Keys are passwords—environment variables only.
  • Sentiment demos need human editors; dashboards prove data skills.

Key Takeaway

  • Ship a vertical slice (works end-to-end) before you chase flashy extras.
  • System prompts = policy—write refusals and scope as clearly as code.
  • Test lists beat vibes for anything you’ll demo live.
  • Never commit secrets; grep for sk- before every push.
  • Honest limitations on the poster earn more trust than fake perfection.

Going Further

Provider structured output docs; Streamlit when PNGs feel tight; Modules 08–09 for portfolio + ethics before posting about people.

Small shipped thing with labeled limits beats imaginary mega-app energy.