0% found this document useful (0 votes)
16 views6 pages

Week 4 Session 2

The document outlines a detailed lesson plan for Week 4, Session 2 of the Prompt Engineering Specialization course, focusing on 'Basic Scripting for Prompts' using Python. The 90-minute session aims to teach students how to automate and iterate prompts through hands-on coding, with specific learning objectives and activities designed to enhance technical skills. Materials, a session schedule, and assessment methods are also provided to ensure effective learning outcomes.

Uploaded by

McKay Thein
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views6 pages

Week 4 Session 2

The document outlines a detailed lesson plan for Week 4, Session 2 of the Prompt Engineering Specialization course, focusing on 'Basic Scripting for Prompts' using Python. The 90-minute session aims to teach students how to automate and iterate prompts through hands-on coding, with specific learning objectives and activities designed to enhance technical skills. Materials, a session schedule, and assessment methods are also provided to ensure effective learning outcomes.

Uploaded by

McKay Thein
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Below is a detailed **Lesson Plan** for **Week 4, Session 2** of the Prompt Engineering Specialization

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.

---

### Lesson Plan: Week 4, Session 2

**Title**: Basic Scripting for Prompts

**Date**: [Insert specific date, e.g., September 25, 2025, assuming a Tuesday/Thursday schedule]

**Duration**: 90 minutes

**Location**: Classroom or virtual platform (e.g., Zoom)

**Instructor**: [Your Name]

**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

---

### Learning Objectives

By the end of this session, students will:

1. Understand the basics of Python scripting for interacting with AI tools via APIs.

2. Write and execute a simple script to automate prompt testing.

3. Iterate prompts programmatically to explore variations or batch process tasks.

4. Troubleshoot basic scripting errors with peer support.

---

### Materials Needed


- Slides or visual aids (e.g., PowerPoint, Google Slides) with Python basics, API examples, and script
snippets

- 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)

- API keys or tokens (if required; instructor-prepared or student-generated with guidance)

- 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)

---

### Session Schedule

#### 0:00–0:10 | Welcome and Homework Debrief (10 minutes)

- **Activity**: Tool Exploration Reflections

- Instructor welcomes students, recaps Week 4, Session 1 (exploring AI tools like ChatGPT, Grok).

- Ask 2-3 volunteers to share their homework:

- “What tool did you try?” (e.g., “Hugging Face”).

- “What was your prompt and output?” (e.g., “Short story” → quirky tale).

- “One pro or con?” (e.g., “Pro: Free, Con: Slow”).

- Note observations on whiteboard (e.g., “ChatGPT: polished,” “Grok: deep”).

- **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.”

#### 0:10–0:30 | Lecture: Introduction to Scripting for Prompts (20 minutes)

- **Content**:
- **Why Script?**: Automate repetitive prompts, test variations, scale tasks (e.g., generate 10 taglines).

- **Python Basics**:

- Variables: `prompt = "Write a tagline"`

- Loops: `for i in range(3): print("Test")` → Repeats 3 times.

- Libraries: `requests` for API calls.

- **API Basics**: APIs let Python talk to AI tools (e.g., send prompt, get response).

- Example: OpenAI/Grok API structure (simplified).

- **Simple Script**:

```python

import requests

prompt = "Write a 1-sentence sci-fi story."

response = requests.post("API_URL", data={"prompt": prompt, "key": "YOUR_KEY"})

print(response.text)

```

- **Delivery**:

- Slides with code snippets and outputs:

- Manual: Type “Write a tagline” 5 times → Tedious.

- Script: Loop 5 taglines → Efficient.

- Live Demo (5 minutes):

- Run a script (e.g., Grok API): “Generate 3 one-line jokes.”

- Show output (e.g., “Why don’t skeletons fight? No guts!”).

- Tweak live: Change to “3 space jokes” → New outputs.

- Ask, “How could this save time?”

- **Engagement**: Pause at 0:25 to ask, “What task would you automate?” (Quick responses, e.g.,
“Essay ideas”).

- **Purpose**: Demystify coding, show its prompting power.

#### 0:30–0:40 | Break (10 minutes)

- **Activity**: Students stretch or chat; instructor preps coding environment.


- **Purpose**: Refresh for hands-on scripting.

#### 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.

- **Activity**: Scripting Starter Challenge

1. **Setup (5 min)**:

- Instructor explains: “You’ll write a script to send a prompt to an AI tool 3 times, varying it slightly.”

- Provide starter code (pre-tested with chosen API, e.g., Grok):

```python

import requests

api_url = "API_URL" # Instructor provides

api_key = "YOUR_KEY" # Instructor provides or guides setup

prompt = "Write a 1-sentence story about "

for i in range(3):

full_prompt = prompt + ["a cat", "a robot", "a spaceship"][i]

response = requests.post(api_url, data={"prompt": full_prompt, "key": api_key})

print(response.text)

```

- Ensure Python and API access (e.g., Jupyter Notebook link or lab setup).

2. **Individual Work (15 min)**:

- Students:

- Run the starter script, see outputs (e.g., 3 stories).

- Modify it: Change the prompt (e.g., “Give a tip about…”), adjust iterations, or tweak wording.

- Note results and any errors (e.g., “Key error” → typo).

- Stretch goal: Add a role (e.g., “As a scientist…”).

3. **Pair Troubleshoot (15 min)**:

- Pair up with a classmate.

- Share scripts, outputs, and issues.

- Debug together (e.g., fix syntax, adjust API call).


- Instructor circulates, asking, “What broke?” or “How’d you fix it?”

- **Facilitation**: Encourage experimentation (e.g., “Try 5 loops!”) and peer help.

- **Purpose**: Build coding confidence, apply automation to prompts.

#### 1:15–1:30 | Wrap-Up and Preview (15 minutes)

- **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?”).

- **Purpose**: Celebrate scripting wins, prep for project work.

---

### Assessment

- **Formative**:

- Participation in debrief and activity (observed engagement).

- Quality of scripts during activity (informal feedback).

- **No graded deliverables**: Focus on skill-building.

---

### Contingency Plans

- **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.
---

### Post-Session Notes for Instructor

- Reflect: Did students grasp Python basics? Any API issues?

- 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!

You might also like