hands-on lab

Text Analysis and LLMs with Python - Module 5

Difficulty: Intermediate
Duration: Up to 1 hour and 30 minutes
Students: 2
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.

Description

Prompt Engineering

In this lab, you will learn what prompt engineering is, why it matters, and how to design effective prompts for language models. You’ll practice zero/one/few-shot prompting, chain-of-thought (for step-by-step tasks), and sampling controls to balance precision and creativity.

Learning objectives

Upon completion of this lab, you will be able to:

  • Discuss what prompt engineering is and why it is important for working with language models.
  • Identify and apply the key components of an effective prompt.
  • Use chain-of-thought prompting to improve reasoning and step-by-step problem solving.
  • Apply zero-shot, one-shot, and few-shot prompting to different tasks.
  • Adjust temperature, top-p, and (where supported) top-k parameters to control creativity, randomness, and output diversity.
  • Evaluate and refine prompts based on model responses to achieve desired outputs.

Intended audience

This course is designed for:

  • Data Scientists
  • Software Developers
  • Machine Learning Engineers
  • AI Engineers
  • DevOps Engineers

Prerequisites

Completion of previous modules is highly recommended before attempting this lab.

Lab structure

Demo: Mastering Prompt Engineering with GPT-4o-mini
In this demo, you will explore how small wording changes can dramatically change LLM outputs. You will:
- Break down the components of a strong prompt (role, audience, task, constraints, format).
- Use zero-/one-/few-shot prompting to steer behaviour.
- Apply concise chain-of-thought prompting for step-by-step tasks.
- Tune sampling controls like temperature and top-p (and top-k where supported).

Intended learning outcomes:
- Craft clearer prompts using role, audience, task, constraints, and format.
- Use zero/one/few-shot examples to guide the model.
- Trigger brief step-wise reasoning when appropriate.
- Adjust temperature/top-p to make outputs more precise or more creative.

Activity: Designing the Perfect Virtual Travel Guide
In this activity, you will improve a virtual travel-guide chatbot by tightening prompt structure, steering style with examples, adding light reasoning where needed, and tuning sampling for creativity vs precision.

Intended learning outcomes:
- Identify weaknesses in vague prompts and improve them with structure.
- Apply zero-shot, one-shot, and few-shot examples to guide behaviour.
- Use brief chain-of-thought prompting for multi-step questions.
- Adjust creativity with temperature

Hands-on Lab UUID

Lab steps

0 of 1 steps completed.Use arrow keys to navigate between steps. Press Enter to go to a step if available.
  1. Starting the Notebooks