Week 4 Session 2
Week 4 Session 2
course, titled *"Basic Scripting for Prompts."* This session builds on Week 4, Session 1’s exploration of AI
tools by introducing students to basic scripting (using Python) to automate and iterate prompts. It’s
designed for a 90-minute class (1.5 hours), combining lecture, demonstration, and hands-on coding to
enhance students’ technical skills in prompt engineering.
---
**Date**: [Insert specific date, e.g., September 25, 2025, assuming a Tuesday/Thursday schedule]
**Duration**: 90 minutes
**Target Audience**: College students (beginner to intermediate level, mixed technical backgrounds)
**Prerequisites**: Attendance at prior sessions; familiarity with AI tools from Week 4, Session 1; no
prior coding experience required
---
1. Understand the basics of Python scripting for interacting with AI tools via APIs.
---
- Access to a generative AI tool with an API (e.g., Grok via xAI API, OpenAI’s API, or a free alternative like
Hugging Face Inference API)
- Python environment: Instructor’s computer with Python installed (e.g., Jupyter Notebook, VS Code);
students’ laptops with Python (or lab setup with pre-installed Python)
- Whiteboard or digital equivalent (e.g., Jamboard) for notes and error examples
- Handout: "Python for Prompting Cheat Sheet" (optional, with commands like `print()`, `requests.get()`)
- Homework submissions: Students’ notes from Week 4, Session 1 (prompt, output, pro/con of a new
tool)
---
- Instructor welcomes students, recaps Week 4, Session 1 (exploring AI tools like ChatGPT, Grok).
- “What was your prompt and output?” (e.g., “Short story” → quirky tale).
- **Purpose**: Link tool experiences to scripting, showing how automation can enhance them.
- **Transition**: “You’ve seen how tools differ. Today, we’ll use Python to supercharge your prompting
with scripts.”
- **Content**:
- **Why Script?**: Automate repetitive prompts, test variations, scale tasks (e.g., generate 10 taglines).
- **Python Basics**:
- **API Basics**: APIs let Python talk to AI tools (e.g., send prompt, get response).
- **Simple Script**:
```python
import requests
print(response.text)
```
- **Delivery**:
- **Engagement**: Pause at 0:25 to ask, “What task would you automate?” (Quick responses, e.g.,
“Essay ideas”).
#### 0:40–1:15 | Activity: Write and Test a Prompt Script (35 minutes)
- **Content**: Students write a basic Python script to automate a prompt, test it, and debug.
1. **Setup (5 min)**:
- Instructor explains: “You’ll write a script to send a prompt to an AI tool 3 times, varying it slightly.”
```python
import requests
for i in range(3):
print(response.text)
```
- Ensure Python and API access (e.g., Jupyter Notebook link or lab setup).
- Students:
- Modify it: Change the prompt (e.g., “Give a tip about…”), adjust iterations, or tweak wording.
- **Content**:
- Recap: “Scripting lets you loop prompts, test fast, and scale up—Python makes it doable.”
- Debrief Activity: Invite 1-2 pairs to share (e.g., “My robot tips were hilarious!”). Note fixes on
whiteboard (e.g., “Space after prompt”).
- Next Session Preview: “We’ll review Weeks 1-4 and kick off a mini-project to flex your skills.”
- Homework: “Write a script to generate 3 outputs with your favorite tool. Bring the code, results, and
one challenge you faced.”
- **Activity**: Quick Q&A (e.g., “Any code stump you?” “Need API help?”).
---
### Assessment
- **Formative**:
---
- **If time runs short**: Shorten pair troubleshoot to 10 minutes, summarizing fixes as a group.
- **If tech fails**: Use pre-run outputs (e.g., “Here’s what my script gave…”), focus on code explanation.
- **If students lack coding experience**: Simplify to a single prompt script (no loop), or pair with
stronger coders.
---
- Prep for Week 5, Session 1: Plan review Q&A, brainstorm mini-project ideas.
---
This plan introduces scripting as a practical prompt engineering tool, keeping it accessible for beginners
while offering stretch goals for coders. It’s hands-on and collaborative, bridging manual prompting to
automation. Let me know if you’d like tweaks—like a different language or focus!