You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/lab-2/README.md
+49-74Lines changed: 49 additions & 74 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,107 +4,85 @@ description: Some general useful prompt templates
4
4
logo: images/ibm-blue-background.png
5
5
---
6
6
7
-
Now here comes the fun part, and exploration for your Prompt Engineering (PE) journey.
8
-
Be sure you have AnythingLLM (or Open-WebUI) available, and open in a _new_ Workspace.
9
-
The testing "Who is Batman?" workspace should be left alone for this.
10
-
Maybe call it "Learning Prompt Engineering" or the like, just like below.
7
+
Now, here comes the fun exploration for your Prompt Engineering (PE) journey.
8
+
9
+
Open a brand _new_ Workspace in AnythingLLM (or Open-WebUI) called "Learning Prompt Engineering".
11
10
12
11

13
12
14
13
## Zero, Single, Multi Shot prompting
15
14
16
-
Now that we've played with a couple different versions of prompts, lets talk about the differences between them:
15
+
Let's talk about different types of prompts with examples.
17
16
18
-
- Zero Shot: No previous data or guidelines given before completing request.
19
-
- Our "brain storming prompt" was a zero shot prompt, it just started with "do this thing." Then we built off of it, and turned it into a Single Shot prompt.
20
-
- One Shot: One piece of data or guideline given before completing request.
21
-
- Our email option was a One Shot/Single Shot prompt, because we gave more context on the email and referenced the situation. You'll notice that this is where you'll normally start.
22
-
- Few Shot: Multiple pieces of data or guidelines given before completing request.
23
-
- Finally our resume one is a Few Shot, because hopefully you did some back and forth to build out a great blurb about yourself, and how you can be ready for this next great job.
17
+
### Zero-shot Prompting
24
18
25
-
## Brain storming prompt
19
+
These prompts don't have any previous data, structure, or guidelines provided with the request. Here's an example you can try out:
26
20
27
-
Now lets try our first real prompt, copy the following into the message box:
28
21
```
29
-
I'm looking to explore [subject] in a [format].
30
-
Do you have any suggestions on [topics] I can cover?
22
+
I want to explore pasta making recipes.
23
+
Do you have any suggestions for recipes that are unique and challenging?
31
24
```
32
25
33
-
This is a good "brain storming idea" prompt. Fill in `[subject]`, `[format]`, and `[topics]` for liking,
34
-
I'll be running:
35
-
```
36
-
I'm looking to explore pasta making recipes. Do you
37
-
have any suggestions on recipes that are unique and challanging?
38
-
```
39
-
40
-
As you can see granite-3.1 comes back with some very challenging options:
26
+
As you can see, this Granite model comes back with some very challenging options:
Now this may seem odd, or even pointless, but hopefully you can start seeing that if you treat the prompt like
56
-
a conversation that you interate on, you can talk back and forth with the granite-3.1 and find interesting
57
-
nuggets of knowledge.
41
+
These simple back-and-forth questions are examples of zero-shot prompts. Try testing out the model with simple prompts like this about any subject you can think of. Next, we'll start to add some complexity to our prompts
58
42
59
-
## Client or Customer email generation
43
+
## One-Shot and Multi-Shot Prompting
60
44
61
-
Next create a new "thread" so the context window resets, and lets try something everyone has probably already
62
-
done, but give you a "mad libs" prompt that can help just churn them out for you.
45
+
First, create a new "thread" so the context window resets. You can think of a *context window* as the amount of information a model can "remember".
Take the following prompt, and fill it out to your content. Have some fun with it :)
49
+
In the following examples, we'll add more guidance in our prompt. By providing **one** example or structure, we achieve *one-shot prompting*. Take the provided prompts, and replace the [words] in brackets with your own choices. Have fun with it!
50
+
67
51
```
68
-
I want you to act as a customer support assistant who
69
-
is [characteristic]. How would you respond to [text]
70
-
as a representative of our [type] company?
52
+
I want you to act as a customer support assistant who is [characteristic].
53
+
How would you respond to [text] as a representative of our [type] company?
71
54
```
72
55
73
56
My version will be:
74
57
```
75
-
I want you to act as a customer support assistant who
76
-
is an expert in shipping logistics. How would you respond
77
-
to client who has had their freight lost as a
78
-
representative of our company?
58
+
I want you to act as a customer support assistant who is an expert in shipping logistics.
59
+
How would you respond to client who has had their freight lost as a representative of our company?
Oh, that's not nearly enough, or interesting right? Well it's because we haven't interated on it, we just wrote a "client" with no context, or what they may
84
-
have lost. So lets see if we can fill it out more:
64
+
That's not a satisfactory or interesting response, right? We need to interate on it, and provide more context about the client, like what they may have lost. **Tip: always think about adding more context!**
65
+
85
66
```
86
-
The freight they lost was an industrial refrigerator,
87
-
from Burbank, California to Kanas City, MO. I need you to
88
-
write out an apology letter, with reference to the
89
-
shipping order, of #00234273 and the help line of 18003472845,
90
-
with a discount code of OPPSWEDIDITAGAIN for 15% off
91
-
shipping their next order.
92
-
Mention that sometimes the trucks have accidents and
93
-
need to be repaired and we should be able to reach
94
-
out in a couple weeks.
67
+
The freight they lost was an industrial refrigerator, from Burbank, California to Kanas City, MO.
68
+
I need you to write out an apology letter, with reference to the shipping order #00234273
69
+
and the help line of 1-800-347-2845, with a discount code of OPPSWEDIDITAGAIN for 15% off
70
+
shipping their next order. Mention that sometimes, the trucks have accidents and need
71
+
to be repaired and we should be able to reach out in a couple weeks.
95
72
```
96
73
97
74

98
75
99
-
So much better! With more context, and more of a back story to what you are asking for, building off the intial prompt, we got something
100
-
that with just a small tweaks we can email to our client.
76
+
So much better! By providing more context and more insight into what you are expecting in a response, we can improve the quality of our responses greatly with small tweaks.
77
+
78
+
By providing **multiple** examples, you're achieving *multi-shot prompting*!.
101
79
102
-
## Your work history prompt
80
+
## Work History Prompt
103
81
104
-
You probably have your resume on this machine we are working on right? Lets take it and build a "blurb" about your skill set and who you are
105
-
and maybe if you are feeling adventurous you can even get a cover letter out of it. (Don't forget to start a new thread!)
82
+
You might have your resume on the laptop you're working on. If you do, you can take it and build a summary about your skill set and who you are. If you are really adventurous, you can even try to make the model write you a cover letter! *Don't forget to start a new thread!*
83
+
84
+
Here's a prompt to help you getting started, you can fill in the [words] again.
106
85
107
-
Here's a prompt to help you getting started:
108
86
```
109
87
The following text is my resume for my career up until
110
88
my most recent job. I am [your job now] with
@@ -118,29 +96,27 @@ skill set, and my previous expertise
118
96
119
97

120
98
121
-
Now for mine, it wasn't great, but it at least give me somethings to work off of. Again, this is just a start, but you can build off of this blurb and
122
-
see what you can actually accomplish.
99
+
My response has room for improvement, but gives me something to work with. Try to build off of and modify this blurb until you're happy with the quality of the response you receive. Think outside of the box!
123
100
124
101
## Summarization Prompt
125
102
126
-
Something you'll discover quickly is that leveraging your local AI model to summarize long documents and/or emails can help figure out if you
127
-
actually need to read the details of something. Showing the age of the author here, but remember [CliffNotes](https://en.wikipedia.org/wiki/CliffsNotes)? Yep, you have your own
128
-
built in CliffNotes bot with AI.
103
+
Summarizing long documents or emails is a very popular use case to leverage your local AI model for.
104
+
105
+
The author of this workshop is probably older than you, but remember [CliffNotes](https://en.wikipedia.org/wiki/CliffsNotes)? Well, you have your own built-in CliffNotes bot with AI on your laptop now!
129
106
130
107
Here's a prompt to help you set up your AI model to put it "head space" this was inspired from [this website](https://narrato.io/blog/get-precise-insights-with-30-chatgpt-prompts-for-summary-generation/):
131
108
132
109
```
133
-
Generate an X-word summary of the following document,
110
+
Generate an [X]-word summary of the following document,
134
111
highlighting key insights, notable quotes, and the overall
135
112
tone of the core point of it.
136
113
Be sure to add any specific call to actions or things that
137
114
need to be done by a specific date.
138
115
```
139
116
140
-
## Role playing prompt
117
+
## Role-Playing Prompt
141
118
142
-
If you noticed in the previous lab we talked about leveraging a single prompt to build a
143
-
"single shot" role playing if you skipped it, we'll be going over it again here.
119
+
If you're familiar with the role-playing game Dungeons & Dragons, this excercise is for you!
144
120
145
121
```
146
122
Generate a self-contained dungeon adventure for a party of 4 adventurers,
@@ -149,14 +125,13 @@ with a clear objective, unique challenges, and a memorable boss encounter,
149
125
all designed to be completed in a single session of gameplay
150
126
```
151
127
152
-
The student took inspiration from [this website](https://www.the-enchanted-scribe.com/post/6-steps-one-prompt-using-chatgpt-to-generate-one-shot-d-d-adventures), which goes deeper in depth, and can build out the
153
-
whole thing for you if you want.
128
+
The student took inspiration from [this website](https://www.the-enchanted-scribe.com/post/6-steps-one-prompt-using-chatgpt-to-generate-one-shot-d-d-adventures), which goes more in-depth, and can build out a whole game for you if you want.
154
129
155
-
The best part of this prompt is that you can take the output and extend or contract
156
-
the portions it starts with, and tailor the story to your adventurers needs!
130
+
The best part of this prompt is that you can take the output and extend or shorten
131
+
the portions it starts with, and tailor the story to your adventurers' needs!
157
132
158
-
## Other ideas?
133
+
## Other Ideas?
159
134
160
135
We'd love to add more to this workshop for future students, if you've come up with something
161
136
clever or maybe someone beside you has and you'd like to save it for others we'd love
162
-
a [Pull Request](https://github.com/IBM/opensource-ai-workshop/tree/main/docs/lab-5) of it.
137
+
a [Pull Request](https://github.com/IBM/opensource-ai-workshop/tree/main/docs/lab-2) of it.
0 commit comments