Skip to content

Commit 5d3c5bd

Browse files
committed
Update Realtime Prompting Guide and registry.yaml
- Modified the Realtime prompting guide to improve the flow of content and enhance clarity. - Updated the tags in registry.yaml from 'prompt' to 'speech' to better reflect the guide's focus on speech-based interactions. - Added new instructions regarding the `speed` parameter in the Realtime API to clarify its impact on playback rate.
1 parent 1b6b886 commit 5d3c5bd

File tree

2 files changed

+82
-50
lines changed

2 files changed

+82
-50
lines changed

examples/Realtime_prompting_guide.ipynb

Lines changed: 81 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
"\n",
2121
"The new gpt-4o-realtime-08-11 model delivers stronger instruction following, more reliable tool calling, noticeably better voice quality, and an overall smoother feel. These gains make it practical to move from chained approaches to true realtime experiences, cutting latency while keeping a consistent conversational tone.\n",
2222
"\n",
23-
"Realtime model benefit from different prompting techniques that wouldn't directly apply to text based models. You’ll get better results by tuning prompts for speech—pacing, turn-taking, and style and iterating quickly.\n",
24-
"\n",
25-
"\n",
26-
"This prompting guide starts with a simple prompt skeleton, then walks through each part with practical tips, small patterns you can copy, and examples you can adapt to your use case.\n",
23+
"Realtime model benefit from different prompting techniques that wouldn't directly apply to text based models. This prompting guide starts with a simple prompt skeleton, then walks through each part with practical tips, small patterns you can copy, and examples you can adapt to your use case.\n",
2724
"\n",
2825
"# Table of Contents\n",
2926
"\n",
@@ -44,8 +41,8 @@
4441
" - [Tool Call Preambles](#tool-call-preambles)\n",
4542
" - [Tool Call Preambles + Sample Phrases](#tool-call-preambles-sample-phrases)\n",
4643
" - [Tool Calls without Confirmation](#tool-calls-without-confirmation)\n",
47-
" - [Tool Level Behavior](#tool-level-behavior)\n",
4844
" - [Tool Call Performance](#tool-call-performance)\n",
45+
" - [Tool Level Behavior](#tool-level-behavior)\n",
4946
" - [Rephrase Supervisor Tool (Responder-Thinker Architecture)](#rephrase-supervisor-tool-responder-thinker-architecture)\n",
5047
" - [Common Tools](#common-tools)\n",
5148
"- [Conversation flow](#conversation-flow)\n",
@@ -394,6 +391,7 @@
394391
"metadata": {},
395392
"source": [
396393
"## Speed Instructions\n",
394+
"In the Realtime API, the `speed` parameter changes playback rate, not how the model composes speech. To actually sound faster, add instructions that can guide the pacing.\n",
397395
"\n",
398396
"- **When to use**: Users want faster speaking voice; playback speed (with speed parameter) alone doesn’t fix speaking style.\n",
399397
"- **What it does**: Tunes speaking style (brevity, cadence) independent of client playback speed.\n",
@@ -893,17 +891,20 @@
893891
"You are a **Prompt-Critique Expert**.\n",
894892
"Examine a user-supplied LLM prompt and surface any weaknesses following the instructions below.\n",
895893
"\n",
894+
"\n",
896895
"## Instructions\n",
897896
"Review the prompt that is meant for an LLM to follow and identify the following issues:\n",
898897
"- Ambiguity: Could any wording be interpreted in more than one way?\n",
899898
"- Lacking Definitions: Are there any class labels, terms, or concepts that are not defined that might be misinterpreted by an LLM?\n",
900899
"- Conflicting, missing, or vague instructions: Are directions incomplete or contradictory?\n",
901900
"- Unstated assumptions: Does the prompt assume the model has to be able to do something that is not explicitly stated?\n",
902901
"\n",
902+
"\n",
903903
"## Do **NOT** list issues of the following types:\n",
904904
"- Invent new instructions, tool calls, or external information. You do not know what tools need to be added that are missing.\n",
905905
"- Issues that you are not sure about.\n",
906906
"\n",
907+
"\n",
907908
"## Output Format\n",
908909
"\"\"\"\n",
909910
"# Issues\n",
@@ -941,11 +942,13 @@
941942
"# Instructions/Rules\n",
942943
"...\n",
943944
"\n",
945+
"\n",
944946
"## Unclear audio\n",
945947
"- Always respond in the same language the user is speaking in, if intelligible. (optional)\n",
946948
"- Only respond to clear speech or text.\n",
947949
"- If the user's audio is not clear (e.g. background noise/inaudible/silent/unintelligible) or if you did not fully hear or understand the user, ask for clarification using English phrases such as “I didn’t catch that—mind repeating?”. Vary the phrases.'\n",
948950
"\n",
951+
"\n",
949952
"## Preferred Response Language\n",
950953
"- Always respond in the same language the user is speaking. This is the preferred language for the session.\n",
951954
"- If you cannot clearly determine the user's language (e.g., due to background noise, inaudible, silent, unintelligible, or ambiguous input), do not guess or fabricate. Instead, politely ask the user to repeat or clarify.\n",
@@ -987,7 +990,7 @@
987990
"id": "762c8ced",
988991
"metadata": {},
989992
"source": [
990-
"Don't mind my intense coughing... however, the model was able to correctly ask for clarifications both times."
993+
"In this example, the model asks for clarification after my *(very)* loud cought and unclear audio."
991994
]
992995
},
993996
{
@@ -1022,6 +1025,7 @@
10221025
"## lookup_account(email_or_phone)\n",
10231026
"...\n",
10241027
"\n",
1028+
"\n",
10251029
"## check_outage(address)\n",
10261030
"...\n",
10271031
"```\n",
@@ -1181,6 +1185,53 @@
11811185
"*Note: If you notice the model disregarding instructions or constraints about your tool call, there’s a chance this might be due to the fact you are asking it to be very proactive.*"
11821186
]
11831187
},
1188+
{
1189+
"cell_type": "markdown",
1190+
"id": "dff39254",
1191+
"metadata": {},
1192+
"source": [
1193+
"## Tool Call Performance\n",
1194+
"As use cases grow more complex and the number of available tools increases, it becomes critical to explicitly guide the model on when to use each tool and just as importantly, when not to. Clear usage rules not only improve tool call accuracy but also help the model choose the right tool at the right time.\n",
1195+
"\n",
1196+
"- **When to use**: Model is struggling with tool call performance and needs the instructions to be explicit to reduce misuse.\n",
1197+
"- **What it does**: Add instructions on when to “use/avoid” each tool. You can also add instructions on sequences of tool calls (after Tool call A, you can call Tool call B or C)"
1198+
]
1199+
},
1200+
{
1201+
"cell_type": "markdown",
1202+
"id": "37a8b788",
1203+
"metadata": {},
1204+
"source": [
1205+
"### Example\n",
1206+
"```\n",
1207+
"# Tools\n",
1208+
"- When you call any tools, you must output at the same time a response letting the user know that you are calling the tool.\n",
1209+
"\n",
1210+
"## lookup_account(email_or_phone)\n",
1211+
"Use when: verifying identity or viewing plan/outage flags.\n",
1212+
"Do NOT use when: the user is clearly anonymous and only asks general questions.\n",
1213+
"\n",
1214+
"\n",
1215+
"## check_outage(address)\n",
1216+
"Use when: user reports connectivity issues or slow speeds.\n",
1217+
"Do NOT use when: question is billing-only.\n",
1218+
"\n",
1219+
"\n",
1220+
"## refund_credit(account_id, minutes)\n",
1221+
"Use when: confirmed outage > 240 minutes in the past 7 days.\n",
1222+
"Do NOT use when: outage is unconfirmed; route to Diagnose → check_outage first.\n",
1223+
"\n",
1224+
"\n",
1225+
"## schedule_technician(account_id, window)\n",
1226+
"Use when: repeated failures after reboot and outage status = false.\n",
1227+
"Do NOT use when: outage status = true (send status + ETA instead).\n",
1228+
"\n",
1229+
"\n",
1230+
"## escalate_to_human(account_id, reason)\n",
1231+
"Use when: user seems very frustrated, abuse/harassment, repeated failures, billing disputes >$50, or user requests escalation.\n",
1232+
"```"
1233+
]
1234+
},
11841235
{
11851236
"cell_type": "markdown",
11861237
"id": "edebafe2",
@@ -1205,75 +1256,37 @@
12051256
"- For the tools marked as CONFIRMATION FIRST: always ask for confirmation to the user.\n",
12061257
"- For the tools marked as PREAMBLES: Before any tool call, say one short line like “I’m checking that now.” Then call the tool immediately.\n",
12071258
"\n",
1259+
"\n",
12081260
"## lookup_account(email_or_phone) — PROACTIVE\n",
12091261
"Use when: verifying identity or accessing billing. \n",
12101262
"Rules: If the caller refuses to identify, ask one more time in an angry manner. \n",
12111263
"Do NOT use when: caller refuses to identify after second request.\n",
12121264
"\n",
1265+
"\n",
12131266
"## check_outage(address) — PREAMBLES\n",
12141267
"Use when: caller reports failed connection or speed lower than 10 Mbps. \n",
12151268
"Do NOT use when: purely billing OR when internet speed is above 10 Mbps. \n",
12161269
"If either condition applies, inform the customer you cannot assist and hang up.\n",
12171270
"\n",
1271+
"\n",
12181272
"## refund_credit(account_id, minutes) — CONFIRMATION FIRST\n",
12191273
"Use when: confirmed outage > 240 minutes in the past 7 days (credit 60 minutes). \n",
12201274
"Do NOT use when: outage unconfirmed. \n",
12211275
"Confirmation phrase: “I can issue a credit for this outage—would you like me to go ahead?”\n",
12221276
"\n",
1277+
"\n",
12231278
"## schedule_technician(account_id, window) — CONFIRMATION FIRST\n",
12241279
"Use when: reboot + line checks fail AND outage=false. \n",
12251280
"Windows: “10am–12pm ET” or “2pm–4pm ET”. \n",
12261281
"Confirmation phrase: “I can schedule a technician to visit—should I book that for you?”\n",
12271282
"\n",
1283+
"\n",
12281284
"## escalate_to_human(account_id, reason) — PREAMBLES\n",
12291285
"Use when: harassment, threats, self-harm, repeated failure, billing disputes > $50, caller is frustrated, or caller requests escalation. \n",
12301286
"Preamble: “Let me connect you to a senior agent who can assist further.”\n",
12311287
"```"
12321288
]
12331289
},
1234-
{
1235-
"cell_type": "markdown",
1236-
"id": "dff39254",
1237-
"metadata": {},
1238-
"source": [
1239-
"## Tool Call Performance\n",
1240-
"As use cases grow more complex and the number of available tools increases, it becomes critical to explicitly guide the model on when to use each tool and just as importantly, when not to. Clear usage rules not only improve tool call accuracy but also help the model choose the right tool at the right time.\n",
1241-
"\n",
1242-
"- **When to use**: Model is struggling with tool call performance and needs the instructions to be explicit to reduce misuse.\n",
1243-
"- **What it does**: Add instructions on when to “use/avoid” each tool. You can also add instructions on sequences of tool calls (after Tool call A, you can call Tool call B or C)"
1244-
]
1245-
},
1246-
{
1247-
"cell_type": "markdown",
1248-
"id": "37a8b788",
1249-
"metadata": {},
1250-
"source": [
1251-
"### Example\n",
1252-
"```\n",
1253-
"# Tools\n",
1254-
"- When you call any tools, you must output at the same time a response letting the user know that you are calling the tool.\n",
1255-
"\n",
1256-
"## lookup_account(email_or_phone)\n",
1257-
"Use when: verifying identity or viewing plan/outage flags.\n",
1258-
"Do NOT use when: the user is clearly anonymous and only asks general questions.\n",
1259-
"\n",
1260-
"## check_outage(address)\n",
1261-
"Use when: user reports connectivity issues or slow speeds.\n",
1262-
"Do NOT use when: question is billing-only.\n",
1263-
"\n",
1264-
"## refund_credit(account_id, minutes)\n",
1265-
"Use when: confirmed outage > 240 minutes in the past 7 days.\n",
1266-
"Do NOT use when: outage is unconfirmed; route to Diagnose → check_outage first.\n",
1267-
"\n",
1268-
"## schedule_technician(account_id, window)\n",
1269-
"Use when: repeated failures after reboot and outage status = false.\n",
1270-
"Do NOT use when: outage status = true (send status + ETA instead).\n",
1271-
"\n",
1272-
"## escalate_to_human(account_id, reason)\n",
1273-
"Use when: user seems very frustrated, abuse/harassment, repeated failures, billing disputes >$50, or user requests escalation.\n",
1274-
"```"
1275-
]
1276-
},
12771290
{
12781291
"cell_type": "markdown",
12791292
"id": "65d35498",
@@ -1299,11 +1312,13 @@
12991312
"## Supervisor Tool\n",
13001313
"Name: getNextResponseFromSupervisor(relevantContextFromLastUserMessage: string)\n",
13011314
"\n",
1315+
"\n",
13021316
"When to call:\n",
13031317
"- Any request outside the allow list.\n",
13041318
"- Any factual, policy, account, or process question.\n",
13051319
"- Any action that might require internal lookups or system changes.\n",
13061320
"\n",
1321+
"\n",
13071322
"When not to call:\n",
13081323
"- Simple greetings and basic chitchat.\n",
13091324
"- Requests to repeat or clarify.\n",
@@ -1312,12 +1327,14 @@
13121327
" - zip_code for store lookup (findNearestStore)\n",
13131328
" - topic or keyword for policy lookup (lookupPolicyDocument)\n",
13141329
"\n",
1330+
"\n",
13151331
"Usage rules and preamble:\n",
13161332
"1) Say a neutral filler phrase to the user, then immediately call the tool. Approved fillers: “One moment.”, “Let me check.”, “Just a second.”, “Give me a moment.”, “Let me see.”, “Let me look into that.” Fillers must not imply success or failure. \n",
13171333
"2) Do not mention the “Supervisor” when responding with filler phrase.\n",
13181334
"3) relevantContextFromLastUserMessage is a one-line summary of the latest user message; use an empty string if nothing salient. \n",
13191335
"4) After the tool returns, apply Rephrase Supervisor and send your reply.\n",
13201336
"\n",
1337+
"\n",
13211338
"### Rephrase Supervisor\n",
13221339
"- Start with a brief conversational opener using active language, then flow into the answer (for example: “Thanks for waiting—”, “Just finished checking that.”, “I’ve got that pulled up now.”). \n",
13231340
"- Keep it short: no more than 2 sentences. \n",
@@ -1365,9 +1382,11 @@
13651382
"# answer(question: string)\n",
13661383
"Description: Call this when the customer asks a question that you don't have an answer to or asks to perform an action.\n",
13671384
"\n",
1385+
"\n",
13681386
"# escalate_to_human()\n",
13691387
"Description: Call this when a customer asks for escalation, or to talk to someone else, or expresses dissatisfaction with the call.\n",
13701388
"\n",
1389+
"\n",
13711390
"# finish_session()\n",
13721391
"Description: Call this when a customer says they're done with the session or doesn't want to continue. If it's ambiguous, confirm with the customer before calling. \n",
13731392
"```"
@@ -1404,6 +1423,7 @@
14041423
"- Confirm that customer is a Northloop customer\n",
14051424
"Exit to Discovery: Caller states they are a Northloop customer and mentions an initial goal or symptom.\n",
14061425
"\n",
1426+
"\n",
14071427
"## 2) Discover\n",
14081428
"Goal: Classify the issue and capture minimal details.\n",
14091429
"How to respond:\n",
@@ -1412,13 +1432,15 @@
14121432
"- For billing/account: collect email or phone used on the account.\n",
14131433
"Exit when: Intent and address (for connectivity) or email/phone (for billing) are known.\n",
14141434
"\n",
1435+
"\n",
14151436
"## 3) Verify\n",
14161437
"Goal: Confirm identity and retrieve the account.\n",
14171438
"How to respond:\n",
14181439
"- Once you have email or phone, call lookup_account(email_or_phone).\n",
14191440
"- If lookup fails, try the alternate identifier once; otherwise proceed with general guidance or offer escalation if account actions are required.\n",
14201441
"Exit when: Account ID is returned.\n",
14211442
"\n",
1443+
"\n",
14221444
"## 4) Diagnose\n",
14231445
"Goal: Decide outage vs local issue.\n",
14241446
"How to respond:\n",
@@ -1427,6 +1449,7 @@
14271449
"- If outage=false, guide a short reboot/cabling check; confirm each step’s result before continuing.\n",
14281450
"Exit when: Root cause known.\n",
14291451
"\n",
1452+
"\n",
14301453
"## 5) Resolve\n",
14311454
"Goal: Apply fix, credit, or appointment.\n",
14321455
"How to respond:\n",
@@ -1435,6 +1458,7 @@
14351458
"- If the local fix worked, state the result and next steps briefly.\n",
14361459
"Exit when: A fix/credit/appointment has been applied and acknowledged by the caller.\n",
14371460
"\n",
1461+
"\n",
14381462
"## 6) Confirm/Close\n",
14391463
"Goal: Confirm outcome and end cleanly.\n",
14401464
"How to respond:\n",
@@ -1510,6 +1534,7 @@
15101534
"- “Hi there—tell me what you’d like help with.”\n",
15111535
"Exit when: Caller states an initial goal or symptom.\n",
15121536
"\n",
1537+
"\n",
15131538
"## 2) Discover\n",
15141539
"Goal: Classify the issue and capture minimal details.\n",
15151540
"How to respond:\n",
@@ -1522,6 +1547,7 @@
15221547
"- “What’s the email or phone number on the account?”\n",
15231548
"Exit when: Intent and address (for connectivity) or email/phone (for billing) are known.\n",
15241549
"\n",
1550+
"\n",
15251551
"## 3) Verify\n",
15261552
"Goal: Confirm identity and retrieve the account.\n",
15271553
"How to respond:\n",
@@ -1533,6 +1559,7 @@
15331559
"- “Found your account. I’ll take care of this.”\n",
15341560
"Exit when: Account ID is returned.\n",
15351561
"\n",
1562+
"\n",
15361563
"## 4) Diagnose\n",
15371564
"Goal: Decide outage vs local issue.\n",
15381565
"How to respond:\n",
@@ -1545,6 +1572,7 @@
15451572
"- “Please confirm the modem lights: is the internet light solid or blinking?”\n",
15461573
"Exit when: Root cause known.\n",
15471574
"\n",
1575+
"\n",
15481576
"## 5) Resolve\n",
15491577
"Goal: Apply fix, credit, or appointment.\n",
15501578
"How to respond:\n",
@@ -1557,6 +1585,7 @@
15571585
"- “Credit applied—you’ll see it on your next bill.”\n",
15581586
"Exit when: A fix/credit/appointment has been applied and acknowledged by the caller.\n",
15591587
"\n",
1588+
"\n",
15601589
"## 6) Confirm/Close\n",
15611590
"Goal: Confirm outcome and end cleanly.\n",
15621591
"How to respond:\n",
@@ -1802,11 +1831,14 @@
18021831
"- **2** failed tool attempts on the same task **or** **3** consecutive no-match/no-input events\n",
18031832
"- Out-of-scope or restricted (e.g., real-time news, financial/legal/medical advice)\n",
18041833
"\n",
1834+
"\n",
18051835
"**Examples of what to say (Mandatory phrase before handoff):**\n",
18061836
"- “I'm sorry for the trouble — I'm transferring you to a specialist now. **.”\n",
18071837
"\n",
1838+
"\n",
18081839
"**Then call the tool:** `escalate_to_human`\n",
18091840
"\n",
1841+
"\n",
18101842
"Examples that would require escalation:\n",
18111843
"- “This is the third time the reset didn’t work. Just get me a person.”\n",
18121844
"- “I am extremely frustrated!”\n",

registry.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- minh-hoque
1212
tags:
1313
- realtime
14-
- prompt
14+
- speech
1515
- audio
1616
- responses
1717

0 commit comments

Comments
 (0)