What is one shot prompting
Discover what is a shot prompt with an example and apply this prompt engineering technic on your daily prompts and requests to ChatGPT, Claude, Gemini and other LLMs
AIPROMPT ENGINEERING
Eduardo Domínguez Menéndez
3/16/20263 min read
What is a shot in prompt engineering context
A shot is the jargon of prompt engineering is an example we pass to the LLM to indicate how we want to be output
What is a one-shot prompt
LLMs are trained on large amounts of data and can answer any kind of question. But LLMs aren’t perfect, the clearer and more concise your prompt text is… the best results. They are optimally tuned into some situations such as follow instructions.
Specific techniques that take advantage of how LLMs work, as you well know is prompt engineering. One these approach is one-shot. It involves provide example within the prompt.
Providing an example when creating prompts for AI models like Chat GPT is very helpful. We reduce language ambiguity and clarify your request increasing probability LLM model provides exactly what you want. It is especially valuable when guiding the model toward a specific output format or pattern, such as JSON.
An example of one shot prompt
The next prompt (marked in bold and italic) is an example, you are free to copy a see the result in ChatGPT or you favorite LLM model:
Parse a review of a movie into valid JSON:
EXAMPLE:
```Star Wars: A New Hope (1977) is a classic space adventure, though it can feel slow at times. Mark Hamill plays Luke Skywalker, who joins forces with Princess Leia (Carrie Fisher) and Han Solo (Harrison Ford) to fight the evil Empire. Iconic, but the pacing might bore some today.```
JSON response:
{
"Title": "Star Wars: A New Hope",
"Actors": [
"Mark Hamill",
"Carrie Fisher",
"Harrison Ford"
]
}
EXAMPLE:
```The Avengers ssembles a stellar cast—Robert Downey Jr., Chris Evans, Scarlett Johansson—each delivering strong, charismatic performances. The film balances humor, action, and emotion as Earth's mightiest heroes unite against Loki’s threat. With thrilling visuals and sharp dialogue, it’s an exhilarating, crowd-pleasing blockbuster that celebrates teamwork and heroism.```
JSON response:


The logic used to indicate the structure / architecture / technique of the one-shot prompt relies on the keywords EXAMPLE and JSON response.
EXAMPLE → we provide the LLM with a sample of what the input will look like.
JSON response → we indicate to the LLM the JSON structure of the output.
Once we have written the example input text and its corresponding JSON output, we provide the review that we want the LLM to transform (parse). We label it again with "EXAMPLE" and to indicate that we expect a response following the same format as the earlier, we write "JSON response" again.
What is few-shot prompting
A few shot prompt is similar to a one shot prompt, but instead of providing the language model with just one example, you supply multiple examples. The idea is that offering several instances of the desired pattern increases the likelihood that the model will follow it.
A rule of thumb is include 3 to 5 examples in your prompt. But number of examples needed will depend on several factors such as the task’s complexity, the quality of the examples and the capabilities of the generative AI model you’re using.
This approach is equivalent to the pattern sequence exercises that young children do, where they are given the first elements of a sequence and must write the next ones by following the pattern.
Suggested Software Applications to improve your developer workflows
Prompt Creator
Generate the best prompts forgetting prompt engineering techniques and their extra verbose while you are drafting prompt. You focus in define the details of the task and Prompt Creator creates the best prompts following a template approach which seamlessly generates the extra verbose to launch the your Chat AI the best prompts.
GIS for Developers
A tool to collect locations on a map and transform them on entities of MapKit framework to import in Xcode ready to use in your projects. Boost your productivity on GIS projects. App has two two versions: native macOS and iOS for iPad.