AI Personal Learning
and practical guidance

Anthropic Hints Engineering Course - Chapter 7: Sample Guides (Less Sample Hints)

academic program

Giving Claude examples of how you want it to behave (or not behave) is very effective!, used for:

  • Getting the right answer
  • Get the answer in the correct format

This type of prompting is also known as "Less Sample Tips". You may also come across the phrases "zero samples", "n samples", or "one sample". The number of "samples" in these terms refers to how many examples are used in the prompt.


typical example

Let's say you're a developer trying to build a "parent bot" that will answer children's questions, and Claude's default response style is very formal and robotic, which may frustrate children.

Example:

Enter:
Prompt
User: Will Santa bring me presents on Christmas?

Output:
Claude The Answer.
I don't actually have any information about whether or not Santa Claus will bring you gifts on Christmas. Santa is a fictional character and whether or not he brings gifts depends on each family's beliefs and traditions. The important thing is to enjoy the holiday spirit and spend time with your loved ones, not just focus on the gifts.

You can take the time to describe your desired tone, but it's easier to just give Claude a few examples of ideal responses.

Example:

Enter:
Prompt
User: Please complete the dialog by writing a line and speaking as "A".
Q: Is the tooth fairy real?
A: Of course, baby. Wrap your teeth up and put them under your pillow tonight. It might be a surprise in the morning.
Q: Will Santa bring me presents on Christmas?

Output:
Claude's answer
A: Yes, dear, if you behave yourself this year, Santa Claus will surely bring you a Christmas present! Remember to leave him some cookies and milk on Christmas Eve.

In the following formatting examples, we can walk Claude through a set of formatting instructions step-by-step, showing him how to extract the name and occupation and format them the way we want, or we can provide some examples with the correct formatting for Claude to infer from. Note that the "" Let Claude start with the right steps.

Tip: Double-click on the cue box to scroll through the entire long cue.

Example:

Input:
Prompt
User: Silvermist Valley, a charming village inhabited by a group of extraordinary characters. Among them is neurosurgeon Dr. Liam Patel, who has revolutionized surgical techniques at the Regional Medical Center. Olivia Chan is an innovative architect who has transformed the village landscape through sustainable and stunning design. The local theater is enhanced by the captivating symphony of Ethan Kovacs, a professionally trained musician and composer. Isabella Torres, a self-taught chef with a passion for local ingredients, created a restaurant with a farm-to-table concept that has become a must-visit destination for food lovers. Together, these remarkable individuals, each with unique talents, add to the vibrancy of life in Silvermist Valley.
<individuals
1. Dr. Liam Patel [neurosurgeon]
2. Olivia Chan [architect] 3.
3. ethan kovacs [musician and composer]
4. Isabella Torres [chef].
</individuals

In the center of town, Chef Oliver Hamilton is changing the dining landscape with his farm-to-table restaurant, The Green Plate. Oliver's dedication to local, organic ingredients has earned the restaurant rave reviews from food critics and locals alike.

Not far away, at the Riverside Boulevard Library, director Elizabeth Chan is committed to creating a welcoming and inclusive space. She has significantly increased the town's literacy rate by expanding library resources and creating reading programs for children.

Stroll through the charming town square and you'll be mesmerized by the beautiful murals on the walls. These masterpieces are the work of renowned artist Isabella Torres, who specializes in capturing the essence of the riverfront's wooded setting and giving life to the town.

Riverside Shade's athletic accomplishments are also noteworthy, thanks to former Olympic swimmer and coach Marcus Jenkins. With his experience and enthusiasm, Marcus has trained the town's youth to win several regional championships with the Riverside Shade swim team.
<individuals
1. oliver hamilton [chef]
2. Elizabeth Chan [librarian].
3. Isabella Torres [artist].
4. Marcus Jenkins [coach].
</individuals

Oak Valley is a charming town inhabited by three remarkable individuals whose skills and dedication have had a profound impact on the community.
At the town's busy farmers' market, you'll find Laura Simmons, a passionate organic farmer known for her delicious, sustainably grown produce. Her commitment to promoting healthy eating has inspired the town's love of an ecological lifestyle.
At Oak Valley's Community Center, dance instructor Kevin Alvarez brings the joy of dance to people of all ages. His inclusive dance classes fostered a sense of unity and self-expression among residents and enriched the local arts scene.
Finally, Rachel O'Connor is a selfless volunteer who dedicates her time to various charitable programs. Her commitment to improving the lives of others creates a strong sense of community in Oak Valley.
Through their unique talents and unwavering dedication, Laura, Kevin, and Rachel have integrated themselves into the life of Oak Valley, helping to bring the town to life.
Assistant: <individuals

Output:
Claude's Response
1. Laura Simmons [organic farmer]
2. Kevin Alvarez [Dance Instructor]
3. rachel o'connor [volunteer].
</individuals

If you're ready to try the chapter exercises, click on the links below. If you want to manipulate any of the examples in this lesson, scroll down to see them!

practice

Exercise 7.1 - Formatting Mail Sorting with Examples

We're going to redo Exercise 2 in Chapter 6, but this time we'll edit the yellow-highlighted hint template box, using the "few examples" email and appropriate categorization (and formatting) to get Claude to output the correct answer. We want Claude to outputfinal letteris the letter of the category. If you forget the correct category corresponding to each e-mail, go back to Exercise 1 in Chapter 6 to check.

If your prompt generates the correct answer, Claude's response will readgreenerThe

Keep in mind that emails are categorized as follows:
(A) Pre-sale issues
(B) Damaged or defective items
(C) Billing issues
(D) Other (please explain)

Example:

Input:
Tip Template
Users: please categorize emails into the following categories and do not include explanations:
<categories
(A) Pre-sales questions
(B) Damaged or defective items
(C) Billing issues
(D) Other (please explain)
</categories

Here are some examples of the correct answer format:
<examples
Q: How much does it cost to buy Mixmaster 4000?
A: The correct category is: A

Q: My Mixmaster won't start.
A: The correct category is: B

Q: Please remove me from your mailing list.
A: The correct category is: D
</examples

This is the email that you need to categorize: {{EMAIL}}
Helper: The correct category is:

Variable:
Type {{EMAIL}}
---
Hi - my Mixmaster 4000 is making strange noises when I use it. It also smells kind of smoky and plastic, like burnt electronics. I need to replace it with a...
---
Can I use my Mixmaster 4000 to mix paint or is it only for mixing food?
---
I have waited 4 months since I canceled my service, why is the monthly charge still being deducted? What the heck is going on here?
---
How did I get here, I'm not very computer savvy. Help.

Output:
Claude's reply/last letter
---
B
---
A
---
C
---
D
AI Easy Learning

The layman's guide to getting started with AI

Help you learn how to utilize AI tools at a low cost and from a zero base.AI, like office software, is an essential skill for everyone. Mastering AI will give you an edge in your job search and half the effort in your future work and studies.

View Details>
May not be reproduced without permission:Chief AI Sharing Circle " Anthropic Hints Engineering Course - Chapter 7: Sample Guides (Less Sample Hints)

Chief AI Sharing Circle

Chief AI Sharing Circle specializes in AI learning, providing comprehensive AI learning content, AI tools and hands-on guidance. Our goal is to help users master AI technology and explore the unlimited potential of AI together through high-quality content and practical experience sharing. Whether you are an AI beginner or a senior expert, this is the ideal place for you to gain knowledge, improve your skills and realize innovation.

Contact Us
en_USEnglish