Prototype: Yle RSS headlines → ChatGPT language exercises. Flask + nginx.
- Put your key in
secrets.env:
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-5.6
- Dev server:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python app.py
A background thread polls the Yle RSS feed every 60s and writes exercises into data/yleex.sqlite. The dashboard lists only items whose full exercise set is already cached. Luo uudelleen is per browser session and is not written back to that cache.
- Gunicorn (what nginx proxies to):
chmod +x run.sh
./run.sh
Listens on 127.0.0.1:11224. Cache only (no RSS, no new LLM calls):
./run.sh --cached
Or YLEEX_WORKER=0 in secrets.env / the environment. Luo uudelleen is also disabled in that mode.
- Nginx on the TurkuNLP host: install
nginx/yle-ex.confand get a separate Let's Encrypt cert foryle-ex.turkunlp.org(the churchbook/rag cert will not match):
sudo certbot --nginx -d yle-ex.turkunlp.org
sudo nginx -t && sudo systemctl reload nginx
Drop a YAML file in prompts/. Filename sort order is display order.
id: my_new_type
name: Nimi
name_en: English name
blurb: Short description
ui: quiz # cards | quiz | cloze | qa
temperature: 0.4
system: |
Reply with a single JSON object only.
user: |
Title: {{title}}
Lead: {{summary}}
Tags: {{categories}}Placeholders: {{title}} {{summary}} {{article}} {{categories}} {{link}} {{published}}.
JSON shapes:
cards:{ intro, cards: [{ front, back, example, note }] }quiz:{ intro, questions: [{ q, options, answer, explain }] }(answeris 0-based index)cloze:{ intro, passages: [{ text, answers, hints }] }(blanks are___)qa:{ intro, model_text, items: [{ prompt, sample }] }
If you change a prompt, cached answers for that type are rebuilt automatically.
Exercises use the full Yle article text (fetched from the item link) plus title and lead. Title links go to yle.fi.