From the course: Prompt Engineering with LangChain
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
N-gram overlap example selector
From the course: Prompt Engineering with LangChain
N-gram overlap example selector
- [Instructor] The n-gramOverlapExampleSelector selects and orders examples based on which examples are most similar to the input according to an n-gram overlap score. But what is an n-gram? So consider the following sentence, "Sunsets are always beautiful." From this sentence, you can construct a unigram, bigram, and a fourgram. Unigram would just be a sequence of individual words, so this sentence actually has four unigrams. Bigrams would be pairs of words, so this sentence has three bigrams, sunsets are, are always, and always beautiful, so on and so forth. And the N for n-gram just indicates that you can have as many in a sequence as you'd like. So that value of N is entirely up to you. But here I've represented n-grams of bigrams, trigrams, and four grams. The n-gram overlap score relies on the sentence blue score for overlap calculation. And this overlap score is actually a floating point number between zero and one. And it is going to select and order examples based on their…
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
-
-
-
-