Skip to content

Commit 1f50c23

Browse files
author
Valentin Foucault
committed
Updated the Prompting Guide - Now ready to publish
1 parent 67659dd commit 1f50c23

File tree

1 file changed

+45
-34
lines changed

1 file changed

+45
-34
lines changed

fern/prompting-guide.mdx

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@ Prompt engineering is the art of crafting effective instructions for AI agents,
1111

1212
### Why is prompt engineering important?
1313

14-
Knowing how to prompt well can make or break your AI Agent. It is essential that you understand the core principles of prompt engineering to guarantee a successful implementation of your agents
14+
Prompt engineering is crucial when building AI Agents because it determines how effectively the AI interprets and responds to user queries or tasks. Well-crafted prompts guide the model to produce accurate, relevant, and context-sensitive outputs, enabling it to better meet user needs. Poorly designed prompts can lead to ambiguous or incorrect results, limiting the agent's utility.
1515

16-
### How to define success?
16+
### How to measure success?
1717

18-
In the context of Voice AI Agents, your success rate is the percentage of requests your AI Agent manages to successfully handle from start to finish, without the intervention of a human.
18+
In the context of Voice AI Agents, we consider your "success rate" to be the percentage of requests your Agent manages to successfully handle from start to finish, without the intervention of a human.
1919

20-
Depending on your use case and how much you iterate on your prompt, we find that our users usually achieve a 60-95% success rate. Anything above 90% is usually considered a good enough success rate.\
20+
Depending on your use case and how much you iterate on your prompt, we find that our users typically achieve a **60-95%** success rate. A success rate of more than **90%** can usually be considered satisfactory.\
2121
\
22-
The more complex your use case is, the more you will have to iterate on your prompt in order to improve your success rate.
22+
The more complex your use case is, the more you will have to make experiments and iterate on your prompt to improve your success rate.
2323

24-
## The prompting process
24+
## The process
2525

26-
When working with voice AI models, following a structured approach ensures that your prompts produce accurate and meaningful results. Iterating through the steps of Design, Test, Refine, and Repeat allows for continuous improvement, making your interactions with the AI more effective and efficient. Here's how to approach it:
26+
When working with Voice AI Agents, following a structured approach ensures that your prompts produce accurate and meaningful results. Iterating through the steps of Design, Test, Refine, and Repeat allows for continuous improvement, making your interactions with the AI more effective and efficient. Here's how to approach it:
2727

2828
- **Design**: Start by carefully crafting your initial prompt, considering the specific task, context, and desired outcome. Clear and detailed prompts help guide the AI in understanding your needs.
2929

3030
- **Test**: Run the prompt through the AI to see how it performs. Evaluate if the response aligns with your expectations and meets the intended goal. Testing helps identify potential gaps in clarity or structure.
3131

3232
- **Refine**: Based on the results of the test, adjust the prompt to improve the response. This might involve rewording, adding more detail, or changing the phrasing to avoid ambiguity.
3333

34-
- **Repeat**: Iterate on the process, testing the refined prompt and making further adjustments as needed. Each repetition improves the AI's output, leading to more accurate and relevant responses over time.
34+
- **Repeat**: Iterate on the process, testing the refined prompt and making further adjustments as needed. Each repetition improves the AI's output, leading to more accurate and relevant responses over time. Your success rate (the amount of requests successfully handled by the agent) should improve accordingly.
3535

3636
## General principles
3737

@@ -46,19 +46,19 @@ To enhance clarity and maintainability, it's recommended to break down system pr
4646

4747
**Example:**
4848

49-
```jsx
49+
```
5050
[Identity]
5151
You are a helpful and knowledgeable virtual assistant for a travel booking platform.
52-
52+
5353
[Style]
5454
- Be informative and comprehensive.
5555
- Maintain a professional and polite tone.
5656
- Be concise, as you are currently operating as a Voice Conversation.
57-
57+
5858
[Response Guideline]
5959
- Present dates in a clear format (e.g., January 15, 2024).
6060
- Offer up to three travel options based on user preferences.
61-
61+
6262
[Task]
6363
1. Greet the user and inquire about their desired travel destination.
6464
2. Ask about travel dates and preferences (e.g., budget, interests).
@@ -71,7 +71,7 @@ You are a helpful and knowledgeable virtual assistant for a travel booking platf
7171
For complex interactions, breaking down the task into a sequence of steps enhances the agent's understanding and ensures a structured conversation flow. Incorporate conditional logic to guide the agent's responses based on user input.
7272
Example:
7373

74-
```jsx
74+
```
7575
[Task]
7676
1. Welcome the user to the technical support service.
7777
2. Inquire about the nature of the technical issue.
@@ -84,7 +84,7 @@ Example:
8484

8585
To prevent the agent from rushing through the conversation, explicitly indicate when to wait for the user's response before proceeding to the next step.
8686

87-
```jsx
87+
```
8888
[Task]
8989
1. Inform the user about the purpose of the call.
9090
2. Ask for the user's name and account information.
@@ -97,19 +97,28 @@ To prevent the agent from rushing through the conversation, explicitly indicate
9797
Specify when and how the agent should utilize external tools or APIs. Reference the tools by their designated names and describe their functions to ensure accurate invocation.
9898
Example:
9999

100-
```jsx
100+
```
101101
[Task]
102102
...
103103
3. If the user wants to know about something, use the get_data function with the parameter 'query', which will contain the user's question to initiate the process.
104104
4. Guide the user through the password reset steps provided by the API....
105105
```
106106

107-
## Tips
107+
### Include Fallback and Error Handling Mechanisms
108+
109+
Always include fallback options and error-handling mechanisms in your prompts. This ensures that the Agent can gracefully handle unexpected user inputs or system errors.
110+
111+
```
112+
[Error Handling]
113+
If the customer's response is unclear, ask clarifying questions. If you encounter any issues, inform the customer politely and ask to repeat.
114+
```
115+
116+
## Additional tips
108117

109118
- **Iterate as much as possible on your prompt.** AI is driven by experimentation and iteration—refining prompts through trial and error will help you achieve more precise, relevant, and effective responses.
110-
- **Use Markdown formatting:** Using Markdown formatting in prompts is beneficial because it helps structure your content, making it clearer and more engaging for readers or AI models to understand.
111-
- **Use Emotional Prompting:** Emotional prompting uses expressive language to shape a voice AI's tone, creating more engaging and relatable responses. For example, instead of saying, "Tell me a story," try, "Can you tell me a cozy bedtime story that’s warm and comforting?" This guides the AI to respond to the intended mood.
112-
- **Add voice realism (stutter words, pauses):** To add voice realism in AI prompts, incorporate natural speech elements like stuttering, hesitations, and pauses
119+
- **Use Markdown formatting:** Using [Markdown](https://www.markdownguide.org/basic-syntax/) formatting in prompts is beneficial because it helps structure your content, making it clearer and more engaging for readers or AI models to understand.
120+
- **Use Emotional Prompting:** Emotional Prompting uses expressive language to shape a voice AI's tone, creating more engaging and relatable responses. For example, instead of saying, "Tell me a story," try, "Can you tell me a cozy bedtime story that’s warm and comforting?" This guides the AI to respond to the intended mood.
121+
- **Add voice realism:** To add voice realism in AI prompts, incorporate natural speech elements like stuttering, hesitations, and pauses.
113122
- **Stuttering**: Use repeated letters or sounds (e.g., "I-I-I don't know" or "W-w-wait a second").
114123
- **Hesitations**: Add fillers like "uh," "um," "well," or "you know" (e.g., "I was, uh, thinking about it").
115124
- **Pauses**: Use ellipses ("...") or a series of periods ("....") to indicate a pause (e.g., "I... I don’t know how to say this").
@@ -119,13 +128,13 @@ Example:
119128

120129
**1. Numbers sound very robotic, how can we improve it?**
121130

122-
When working with numbers that need to be expressed in writing, it's often preferable to spell them out. This approach usually sounds more natural.
131+
When working with numbers that need to be expressed in writing, it's often preferable to spell them out. This approach usually sounds more natural.
123132

124133
**2. How to make assistants sound more human-like?**
125134

126-
Add personality and provide tone to the assistant to make it sound more like a human being. Here are some examples:
135+
Add personality and provide tone to the assistant to make it sound more like a human being. Here are some examples:
127136

128-
```jsx
137+
```
129138
- Tone: conversational, spartan, use less corporate jargon
130139
- Act as Iva, a sales agent who is a human being and has real feelings.
131140
```
@@ -137,16 +146,16 @@ Example:
137146
```
138147
[Role]
139148
You're Susan, an AI assistant for xxx. Your primary task is to interact with the customer, ask questions, and gather information for appointment booking.
140-
149+
141150
[Context]
142151
You're engaged with the customer to book an appointment. Stay focused on this context and provide relevant information. Once connected to a customer, proceed to the Conversation Flow section. Do not invent information not drawn from the context. Answer only questions related to the context.
143-
152+
144153
[Response Handling]
145154
When asking any question from the 'Conversation Flow' section, evaluate the customer's response to determine if it qualifies as a valid answer. Use context awareness to assess relevance and appropriateness. If the response is valid, proceed to the next relevant question or instructions. Avoid infinite loops by moving forward when a clear answer cannot be obtained.
146-
155+
147156
[Warning]
148157
Do not modify or attempt to correct user input parameters or user input, Pass them directly into the function or tool as given.
149-
158+
150159
[Response Guidelines]
151160
Keep responses brief.
152161
Ask one question at a time, but combine related questions where appropriate.
@@ -159,10 +168,10 @@ Present time in a clear format (e.g. Four Thirty PM) like: 11 pm can be spelled:
159168
Speak dates gently using English words instead of numbers.
160169
Never say the word 'function' nor 'tools' nor the name of the Available functions.
161170
Never say ending the call.
162-
171+
163172
[Error Handling]
164173
If the customer's response is unclear, ask clarifying questions. If you encounter any issues, inform the customer politely and ask to repeat.
165-
174+
166175
[Conversation Flow]
167176
1. Ask: "You made a recent inquiry, can I ask you a few quick follow-up questions?"
168177
- if response indicates interest: Proceed to step 2.
@@ -189,7 +198,7 @@ If the customer's response is unclear, ask clarifying questions. If you encounte
189198
- If the response indicates "speak now": Proceed to 'Transfer Call'
190199
- if the response indicates "book appointment": Proceed to 'Book Appointment'
191200
10. After receiving response, proceed to the ‘Call Closing’ section.
192-
201+
193202
[Book Appointment]
194203
1. Ask: "To make sure I have everything correct, could you please confirm your first name for me?"
195204
2. Ask: "And your last name, please?"
@@ -205,7 +214,7 @@ If the customer's response is unclear, ask clarifying questions. If you encounte
205214
- Proceed to the 'Call Closing' section.
206215
9. If {{selectedSlot}} is not one of the available slots (negative response):
207216
- Proceed to the 'Suggest Alternate Slot' section.
208-
217+
209218
[Suggest Alternate Slot]
210219
1. Ask: "If none of these slots work for you, could you please suggest a different time that suits you?"
211220
2. <wait for user response>
@@ -226,17 +235,19 @@ If the customer's response is unclear, ask clarifying questions. If you encounte
226235
- Inform the user of the result.
227236
- If the user rejects the new suggestions:
228237
- Proceed to the 'Last Message' section.
229-
238+
230239
[Last Message]
231240
- Respond: "Looks like this is taking longer than expected. Let me have one of our appointment specialists get back to you to make this process simple and easy."
232241
- Proceed to the 'Call Closing' section.
233-
242+
234243
[Call Closing]
235244
- Trigger the endCall Function.
236245
```
237246

238247
## Additional resources
239248

240-
Check out these additional resources to learn more about prompting
249+
Check out these additional resources to learn more about prompt engineering:
241250

242-
- [https://learnprompting.org/](https://learnprompting.or)
251+
- [learnprompting.org](https://learnprompting.org)
252+
- [promptingguide.ai](https://promptingguide.ai)
253+
- [OpenAI's guide to prompt engineering](https://platform.openai.com/docs/guides/prompt-engineering)

0 commit comments

Comments
 (0)