From the course: Prompt Engineering with LangChain
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Few-shot prompt templates
From the course: Prompt Engineering with LangChain
Few-shot prompt templates
- [Instructor] Earlier in the course, we talked about the ability of large language models to perform tasks with zero-shot prompting, meaning they've never seen this example before and they weren't specifically trained on that task. There's also a emergent ability in large language models called few-shot learning. So few-shot learning is just a form of in-context learning where in the prompt you're providing a few examples to help the language model perform on the tasks that you want it to. LangChain offers a FewShotPromptTemplate that's going to allow you to provide a few examples to prime the model before your main prompt. This is useful for providing relevant context and, quote, unquote, warming up the model on your task. So when do you want to use a FewShotPromptTemplate? Well, you want to use it if your task requires some background context to perform well. For example, summarization tasks often benefit from example summaries. If you want to bias the model towards a certain style…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Introduction to prompt templates6m 31s
-
(Locked)
Multi-input prompt templates5m 9s
-
(Locked)
Chat prompt template5m 20s
-
(Locked)
Serializing prompts2m 52s
-
(Locked)
Zero-shot prompts5m 28s
-
(Locked)
Custom prompt templates7m 41s
-
(Locked)
Prompt pipelining5m 49s
-
(Locked)
Chat prompt pipelining3m 21s
-
(Locked)
Prompt composition4m 40s
-
(Locked)
Few-shot prompt templates8m 1s
-
(Locked)
Few-shot prompt templates for chat5m 10s
-
(Locked)
Introduction to example selectors2m 56s
-
(Locked)
Length-based example selector3m 9s
-
(Locked)
Max marginal relevance example selector4m 47s
-
(Locked)
N-gram overlap example selector5m 25s
-
(Locked)
Semantic similarity example selector2m 50s
-
(Locked)
Partial prompt templates4m 19s
-
-
-
-