Few-shot prompting

Sometimes you want to be able to prompt the GenAI with examples of the output you want it to produce in response to your question. This can be a useful way of asking the LLM to summarise and reformat content found in a block of text – by giving it the format of the summary you want it to produce. This is known as few-shot prompting, because you’re giving a few examples of how to respond.
For example, suppose we had a file with transcripts of telephone calls to an answerphone. We want the tool to extract the name and number of the caller, and the reason for the call. A suitable prompt might be:
Prompt
“Hi my name’s Fred Flintstone, I’m calling from Bedrock 10235. We’ve an escaped sabretooth that needs catching. Hurry.” Name: Fred Flintstone, Number: Bedrock 10235, Reason: escaped sabretooth.
“Animal welfare? I’m looking for TC, yes he’s an alley cat you may have collected. I’m Benny calling from 63352. I want TC back.” Name: Benny, Number: 63352, Reason: I want TC back.
“Call me back on 8824 224251.” Name: BLANK, Number 8824 224251, Reason: BLANK.
Response
Here’s a neatly organized summary of those messages:
| Name | Number | Reason |
| Fred Flintstone | Bedrock 10235 | Escaped sabretooth |
| Benny | 63352 | Wants TC (alley cat) back |
| Unknown | 8824 224251 | No reason given |
Let me know if you’d like to log these into a specific format or forward them somewhere!
If you now input the remaining transcripts of the answerphone messages in the same conversation, the LLM will produce a summary in the same way.
Prompt
"Hi Eric from Croydon calling. I want to report a wild animal. 8876 242512."
Response
Got it! Here's the updated summary including Eric’s message:
| Name | Number | Reason |
| Fred Flintstone | Bedrock 10235 | Escaped sabretooth |
| Benny | 63352 | Wants TC (alley cat) back |
| Unknown | 8824 224251 | No reason given |
| Eric | 8876 242512 | Report a wild animal |
Want to sort or filter these in any way?
Create a summary of court hearings
You have notes from the advisers in your organisation which contain the details of court hearings for their cases in the next week.
You need to create a summary which includes the date and time of the hearing, name of the court, name of the client, and the adviser attending the hearing. Try to frame a prompt sequence that will produce the summary.
Safina Browne’s notes
Alan Johnson’s court hearing for unfair dismissal is listed at Croydon Employment Tribunal on 7th March 2026 at 10am. Need to remember to bring all four files of evidence.
Betty Smith’s hearing for financial proceedings after divorce is listed at South London County Court on 10 March 2026 at 2pm. She will only settle if she receives the house.
Amera Shah’s hearing for breach of contract is listed at the Royal Courts of Justice on 8th March 2026 at 10am. Remember that some witnesses are appearing via video link.
Discussion
You could choose how you wanted the output formatting. We went with an approach similar to the telephone message example you saw earlier.
We created two examples:
“Safina Browne’s notes. Alan Johnson’s court hearing for unfair dismissal is listed at Croydon Employment Tribunal on 7th March 2026 at 10am. Need to remember to bring all four files of evidence.” Date and Time of Hearing: 7th March 2026 at 10am, Name of Court: Croydon Employment Tribunal, Name of Client: Alan Johnson, Adviser: Safina Browne.
“Safina Browne’s notes. Betty Smith’s hearing for financial proceedings after divorce is listed at South London County Court on 10 March 2026 at 2pm. She will only settle if she receives the house.” Date and Time of Hearing: 10th March 2026 at 2pm, Name of Court: South London County Court, Name of Client: Betty Smith, Adviser: Safina Browne.
We then tested the LLM with the third query to see how it performed.
Safina Browne’s notes. Amera Shah’s hearing for breach of contract is listed at the Royal Courts of Justice on 8th March 2026 at 10am. Remember that some witnesses are appearing via video link.
Chain of thought
