Lesson 5 of 25
The Secret of Silent Suggestion (Few-Shot Prompting)
Instead of describing the output you want, show two or three finished examples and let the model infer the pattern. This works because a worked example carries decisions that adjectives cannot - exactly where the line falls between two categories, how an edge case is handled, how long a sentence should be. It is the difference between telling someone to write concisely and handing them a paragraph you consider concise.
The original examples work as written on Gemini. What is worth adding is scale and destination: because the context window is large, you can show more examples than feels necessary and then hand over a whole file to process, with the results landing in a Sheet rather than the chat. If you are classifying or extracting regularly, the examples belong in a Gem so the pattern is saved.
- Show more examples than feels necessary; the window is large.
- Upload the file to process; ask for results in a Sheet.
- Save a recurring pattern as a Gem.
- Keep classification and counting as separate steps.
- Examples can be images too, for visual pattern tasks.
Instead of
Look at this customer review and tell me if it's positive, negative, or neutral. The review is: 'The product arrived on time, but the quality wasn't what I expected.'
Perplexity version
Classify customer reviews as Positive, Negative, Mixed or Neutral. Learn the pattern from these examples. Review: 'I absolutely love this product. It has changed my daily routine.' -> Positive Review: 'Complete waste of money. Broke after one day.' -> Negative Review: 'Delivery was fast and the item matched the description, but it is overpriced for what it is.' -> Mixed Review: 'Received the order.' -> Neutral Review: 'The kurta fit perfectly but the colour had faded by the second wash.' -> Mixed Review: 'Delivery to Hyderabad took eleven days. Product itself is fine.' -> Mixed Review: 'Bahut acha product hai, delivery thodi late thi.' -> Mixed Review: 'Size chart is wrong. Ordered L, got something closer to M. Returned it.' -> Negative The rules these set: praise plus complaint is Mixed, never Neutral. Neutral is only for reviews with no opinion at all. Hinglish and mixed-language reviews are classified on meaning, not language. First, classify this one: Review: 'The product arrived on time, but the quality wasn't what I expected.' Then: I am attaching a CSV export of about 400 reviews from our store. Read the file and create a Google Sheet called 'Review sentiment - batch 1' with columns Review ID, Review Text, Sentiment, Confidence (High/Low), Theme. For Theme, group the complaints into recurring categories you identify from the data itself rather than ones I have given you, and list those categories in the chat before you fill the column. Do the labelling first. Once the Sheet exists, I will add the count formulas myself so I can see how the totals were reached. If this is going to be a weekly job, tell me what to put in a Gem called 'Review Classifier' so the examples and rules above are saved.
Instead of
Please extract the person's name, the company they work for, and their job title from this sentence: 'We are pleased to announce that Priya Sharma will be joining our team as the new Head of Marketing at Innovate Corp.'
Perplexity version
I am going to teach you an extraction pattern by example, and then point you at files rather than pasted text. The pattern is a spreadsheet row, not JSON - I want the output in Sheets, so demonstrate it as a row. Columns: Name | Company | Title | Source | Inferred? Worked rows: 'The keynote will be given by Raj Patel, CEO of FutureTech Solutions.' -> Raj Patel | FutureTech Solutions | CEO | (source) | no 'Our quarterly review will be led by Anita Desai, our firm's Managing Director.' -> Anita Desai | (leave blank) | Managing Director | (source) | no 'Welcome to Vikram Reddy and Sneha Kulkarni, who join Zephyr Labs as Design Lead and Head of Product respectively.' -> two separate rows, both with Zephyr Labs 'Dr. S. Ramanathan has been appointed to the board.' -> Dr. S. Ramanathan | (leave blank) | Board Member | (source) | no 'The event was a great success and we thank everyone who attended.' -> no row at all What these rows teach: an unnamed company leaves the cell blank, never a guess and never the word 'null'. Several people means several rows. No person means no row. Names keep their honorifics and initials exactly. First, warm up on this one in the chat so I can check the pattern took: 'We are pleased to announce that Priya Sharma will be joining our team as the new Head of Marketing at Innovate Corp.' Now the real job. I am attaching three things: a PDF of press releases, a folder of screenshots of LinkedIn announcement posts, and a photo I took of a printed conference programme. Read all three - the images and the photographed page as well as the PDF text - and apply the pattern to every announcement you find. Build a Google Sheet called 'Appointments extract' with the five columns above, one row per person. In the Source column give the file name and the page or image number so I can trace every row back. Where you were tempted to fill a company from your own knowledge of the person, leave Company blank, put your guess in a sixth column called 'Possible company' and set Inferred? to yes - I will decide which of those to accept. The photographed programme will have OCR errors. Flag any row where you were unsure of the reading rather than silently correcting a name. If this becomes a monthly job, tell me exactly what to put in a Gem called 'Appointment Extractor' - including that the worked rows above need to live in the Gem's instructions, because a new chat with the same Gem will not remember them.
Instead of
Rewrite the following sentence in a very short, simple, and powerful style, like Ernest Hemingway. The sentence is: 'Despite the fact that he was feeling quite tired, he knew that he had to continue on his journey if he wanted to reach his destination by morning.'
Perplexity version
Match a prose style defined by example rather than by adjectives. Style examples: 1. The sun was hot. The road was long. He walked on. 2. The coffee was bitter. Rain beat the window. The phone did not ring. 3. She did not look back. The train left. That was all. What I do not want: - Overwrought: 'The scorching, merciless sun beat down relentlessly upon the endless, winding road.' - Empty: 'It was hot. He walked. He was tired.' Terse is not the same as vacant - the style keeps concrete detail and refuses to decorate it. State the three rules you infer from the samples before you apply them, so I can correct your reading. Then rewrite: Target: 'Despite the fact that he was feeling quite tired, he knew that he had to continue on his journey if he wanted to reach his destination by morning.' Give versions at roughly 8, 15 and 25 words. Then the part I actually need: I am attaching a Google Doc with about 2,000 words of my own writing. Apply the same style to it, and give me the result as a new Doc called 'Draft - terse pass' with my original untouched. In the chat, list the five changes you made most often, so I can learn to make them myself instead of coming back to you each time. If I want this as a standing editor, tell me what to put in a Gem called 'Terse Editor' - and note that the Gem keeps the style examples but not this conversation, so the examples need to go in its instructions.