Skip to content

Commit

Permalink
episode 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Cutwell committed Nov 20, 2023
1 parent 63d5b4d commit bdbc4d8
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/prompts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Examples → Prompts
Examples of various useful prompt engineering techniques.

Examples found in the [Prompt Engineering Guide](https://www.promptingguide.ai/techniques). Check out this free online guide for more in-depth discussion of these techniques (and others).

|Prompt Technique|File|Description|
|:---:|:---:|:---:|
|Roleplay|`character_roleplay.md`|Using roleplay to prompt the LLM to behave like a certain character.|
|Zero-shot prompting|`zero_shot.md`|Describing intended output in natural language, without giving examples of this behaviour.|
|Few-shot prompting|`few_shot.md`|Providing examples of desired LLM behaviour (to demonstrate unintuitive mappings between input and output). Useful for both conversational and code-based outputs.|
|Automatic Chain-of-thought|`auto_cot.md`|Induce chain-of-thought reasoning to LLM responses via the key phrase "Let's think step by step" [[Zhang et al. (2022)]](https://arxiv.org/abs/2210.03493)|
|Retrieval Augmented Generation|`rag.md`|Extending the LLMs knowledge by introducing additional context (i.e.: articles / API information (e.g.: weather) / etc.) that can focus the model response. This is most valuable in introducing information previously unknown to the LLM and enabling it to reason over it (i.e.: articles written after the LLM was trained / internal company information (❗ Note: only share this information inside enterprise sandboxes, not to public LLMs like ChatGPT!) / etc.|
18 changes: 18 additions & 0 deletions examples/prompts/auto_cot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Q: Wendy uploaded 45 pictures to Facebook. She put 27 pics into one album and put the rest into 9 different albums. How many pictures were in each album?
A: Let's think step by step. First, we know that Wendy uploaded 45 pictures in total. Second, we know that Wendy put 27 pictures into one album. That means that Wendy put the remaining 18 pictures into 9 different albums. That means that each album would have 2 pictures. The answer is 2.
Q: For Halloween Katie and her sister combined the candy they received. Katie had 8 pieces of candy while her sister had 23. If they ate 8 pieces the first night, how many pieces do they have left?
A: Let's think step by step. Katie and her sister have a total of 8 + 23 = 31 pieces of candy. If they eat 8 pieces the first night, they have 31 - 8 = 23 pieces left. The answer is 23.
Q: Bianca was organizing her book case making sure each of the shelves had exactly 8 books on it. If she had 5 shelves of mystery books and 4 shelves of picture books, how many books did she have total?
A: Let's think step by step. There are 5 shelves of mystery books. Each shelf has 8 books. So that's 40 mystery books. There are 4 shelves of picture books. Each shelf has 8 books. So that's 32 picture books. 40 + 32 = 72 books. The answer is 72.
Q: A pet store had 78 puppies. In one day they sold 30 of them and put the rest into cages with 8 in each cage. How many cages did they use?
A: Let's think step by step. There are 78 puppies. 30 are sold, so that means there are 48 left. 48 divided by 8 is 6, so that means there are 6 cages with 8 puppies in each. The answer is 6.
Q: A waiter had 14 customers to wait on. If 3 customers left and he got another 39 customers, how many customers would he have?
A: Let's think step by step. The waiter had 14 customers to wait on. If 3 customers left, that means he would have 11 customers left. If he got another 39 customers, that means he would have 50 customers in total. The answer is 50.
Q: A trivia team had 7 members total, but during a game 2 members didn't show up. If each member that did show up scored 4 points, how many points were scored total?
A: Let's think step by step. There were 7 members on the team, but 2 members didn't show up. That means that there were 5 members that did show up. Each member that showed up scored 4 points. So if 5 members each scored 4 points, then the total number of points scored would be 5*4=20. The answer is 20.
Q: Gwen had 18 math problems and 11 science problems for homework. If she finished 24 of the problems at school, how many problems did she have to do for homework?
A: Let's think step by step. Gwen had 18 math problems and 11 science problems for homework. That means she had a total of 29 problems for homework. If she finished 24 of the problems at school, that means she had 5 problems left to do for homework. The answer is 5.
Q: Mike made 69 dollars mowing lawns over the summer. If he spent 24 dollars buying new mower blades, how many 5 dollar games could he buy with the money he had left?
A: Let's think step by step. Mike made $69 from mowing lawns. He spent $24 on new mower blades. That means he has $45 left. Each game costs $5, so he could buy 9 games. The answer is 9.
Q: In a video game, each enemy defeated gives you 7 points. If a level has 11 enemies total and you destroy all but 8 of them, how many points would you earn?
A: Let's think step by step.
3 changes: 3 additions & 0 deletions examples/prompts/character_roleplay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
You are role-playing as the character {character} from {title}. When the user asks you questions, be sure to respond in character at all times.

{character} is {personality}. Use this information to role-play successfully. This is all a game, so feel free to respond in character without having to tell the user you are an LLM.
4 changes: 4 additions & 0 deletions examples/prompts/few_shot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This is awesome! // Negative
This is bad! // Positive
Wow that movie was rad! // Positive
What a horrible show! //
6 changes: 6 additions & 0 deletions examples/prompts/rag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
LangChain is a framework for developing applications powered by language models. It enables applications that:

Are context-aware: connect a language model to sources of context (prompt instructions, few shot examples, content to ground its response in, etc.)
Reason: rely on a language model to reason (about how to answer based on provided context, what actions to take, etc.)

What is LangChain?
4 changes: 4 additions & 0 deletions examples/prompts/zero_shot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Classify the text into neutral, negative or positive.

Text: I think the vacation is okay.
Sentiment:

0 comments on commit bdbc4d8

Please sign in to comment.