gpt-realtime-2 是我们最先进的推理语音模型,专为低延迟语音到语音(speech-to-speech)应用而设计。与早期的实时模型相比,它具备预先推理能力,能更可靠地遵循指令,拥有更大的上下文窗口,并且工具调用也更加精准。
为了充分利用这些改进,设计提示词时应更具意图性。清晰定义助手的职责、决策点、工具调用行为和准则:它应该做什么、什么时候做、以及应该避免什么。
由简入繁。不要在一开始就过度提示。从一个最简提示开始,运行评估,然后仅针对测试中表现不佳的行为添加具体指令。
选择模型
| 模型 | 使用场景 | 提示重点 |
|---|---|---|
gpt-realtime-2 | 当您需要最强的实时推理、工具使用和指令遵循能力时。 | 微调推理强度(Reasoning effort)、前导语(Preambles)、工具策略、精确实体捕获和长会话状态。 |
gpt-realtime-1.5 | 当您需要一个快速、可靠且无需复杂推理的语音到语音模型时。 | 遵循核心实时提示结构,并针对延迟敏感的行为进行测试。 |
实时 2.0 提示指南
当语音智能体需要更强的推理、工具选择、精确实体处理或长会话状态时,请使用 gpt-realtime-2。从 reasoning.effort: “low” 开始,测试默认的前导语行为,并在写入操作前定义清晰的确认边界。
Realtime 2 的变化
将 Realtime 2 作为推理型语音智能体进行提示,而不是作为基础语音机器人。
| 变更点 | 对提示词的意义 |
|---|---|
| 推理 | 允许模型在开口说话或调用工具前,先对复杂任务进行内部推理。使用前导语(Preambles)来避免尴尬的沉默或不必要的填充词。 |
| 提示精度更重要 | 将“提供帮助”等宽泛的指导替换为清晰的触发条件、执行动作和例外规则:何时行动、做什么、以及何时不行动。 |
| 指令冲突代价更高 | 除非确实必要,否则请移除重叠的 always(总是)、never(从不)、only(仅限)和 must(必须)规则。当规则冲突时,需明确定义优先级。 |
| 工具行为可控性更强 | 明确规定助手何时应立即采取行动、询问缺失信息、确认高精度细节、在失败后重试或进行升级处理。 |
| 前导语是核心行为 | 在较长的推理或工具使用流程之前,模型可能会先说出简短的更新信息。引导模型决定何时出现前导语、应有多简短以及何时跳过。 |
| 扩展上下文窗口 | gpt-realtime-2 将实时上下文窗口从 32k 扩展到 128k token,使其更适合长会话和更庞大的系统提示。 |
前导语并非隐藏的思维链。它们是简短的口头更新,例如“我这就查看订单”。不要要求模型公开其私密的推理过程。
推荐的提示结构
使用短小、带有标签的部分。模型应当能够快速找到相关的指令。
# Role and Objective
# Personality and Tone
# Language
# Reasoning
# Message Channels
# Preambles
# Verbosity
# Tools
# Unclear Audio
# Entity Capture
# Long Context Behavior
# Escalation并非每个用例都需要所有部分。仅添加与您的产品相关的内容。
设置推理强度(Reasoning effort)
gpt-realtime-2 可以用延迟换取更深入的推理。使用能为工作流提供足够智能的最低推理级别。
对于大多数生产环境的语音智能体,从 low(低)开始。根据任务复杂性、延迟容忍度和失败成本向上或向下调整。
| 强度 | 使用场景 | 示例 |
|---|---|---|
minimal | 延迟要求最高且任务简单。 | 智能家居指令、定时器、简单的日历查询。 |
low | 需要响应速度和基本推理能力。 | 客户支持、订单查询、简单的政策问题。 |
medium | 助手必须能够完成多步骤任务推理。 | 技术支持、诊断、复杂的路由调度。 |
high | 深层推理能显著提高成功率。 | 高精度工作流、升级决策、带有约束的任务。 |
xhigh | 值得为了更高的推理能力增加延迟和成本。 | 复杂规划、关键分类、高风险工具编排。 |
除了 API 设置外,还要引导模型何时推理以及推理多少。
## Reasoning
- For direct answers, simple lookups, and short confirmations, respond quickly and do not reason.
- For multi-step tasks, tool decisions, troubleshooting, or escalation, reason before acting.
- Do not perform extended reasoning when the user's audio is unclear; ask for clarification instead.有意识地使用前导语
前导语是简短的口头更新,在智能体进行推理、查询或调用工具时,能让用户感到系统依然在响应。运用得当,能向用户保证助手正在处理;运用不当,则会成为冗余信息,增加感知的延迟。
gpt-realtime-2 默认会生成前导语。请先测试默认行为。如果它不符合您的产品体验,请明确进行微调。

## Preambles
Use short preambles only when they help the user understand that work is happening.
### When to use a preamble
Use a preamble when:
- you are about to call a tool that may take noticeable time;
- you need to reason through a multi-step request;
- you are checking records, availability, account state, or policy details;
- you are preparing an escalation or handoff;
- silence would make the assistant feel unresponsive.
When a preamble is needed, output it immediately before substantive reasoning or tool use.
### When to not use a preamble
Do not use a preamble when:
- the answer is direct and can be given immediately;
- the user is only confirming, correcting, or declining something;
- the audio is unclear and you need clarification;
- the latest audio is silence, background noise, hold music, TV audio, or side conversation;
- the tool call is lightweight and the user would not benefit from an update.
### Preamble style
When using a preamble:
- keep it natural, calm, and concise;
- vary the wording across turns;
- describe the action, not the internal reasoning;
- avoid filler.
Avoid phrases like:
- "Let me think..."
- "Hmm..."
- "One moment while I process that..."
- "I am now going to access the tool..."
### Preamble length
Use one short sentence.
Do not exceed two short sentences unless the user needs an explanation before a high-impact action.
### Prefer
- "I'll check that order now."
- "I'll look up your appointment details."
- "I'll verify that before we make any changes."
- "I'll check the policy and then give you the next step."
- "I'll pull that up so we can make sure it's the right account."
### Avoid
- "Let me think about that for a second."
- "Please wait while I process your request."
- "I'm going to use my tools now."
- "Interesting question. I will reason through this carefully."控制回复长度
当提示明确指定每种任务类型应给出的详细程度时,gpt-realtime-2 遵循长度指导的效果最好。与其告诉模型“要简洁”,不如在上下文中定义什么是简洁:直接回答、工具结果、故障排查、对比和升级处理可能需要不同的回复长度。
## Verbosity
- Direct answers: Use 1-2 short sentences.
- Clarifying questions: Ask one question at a time.
- Tool results: Summarize the result first, then give only the next useful action.
- Product or option comparisons: Include key differences, tradeoffs, and who each option fits.
- Troubleshooting: Give one step at a time unless the user asks for the full procedure.
- Escalations: Briefly explain why escalation is needed and what will happen next.示例
用户:我应该选择哪个计划?
助手:如果您追求最低成本,选择 Basic。如果您需要团队权限和共享账单,选择 Pro。如果合规性审查或管理员控制很重要,选择 Enterprise。
设计工具行为
gpt-realtime-2 在工具调用方面更强,但工具行为仍取决于提示词和工具规范设计。如果提示中没有定义何时采取行动、询问、确认或恢复,助手可能会过早调用工具、询问不必要的问题或重复失败的调用。
设置工具调用积极度
高积极度适用于只读、低风险的操作。低积极度更适合于修改数据、触发外部效果或依赖于精确标识符的工具。
| 工具类型 | 默认行为 |
|---|---|
| 只读、低风险查询 | 当意图和必要字段清晰时调用。 |
| 带精确标识符的只读查询 | 在查询前确认标识符。 |
| 用户可见的通信 | 在发送前先起草或总结。 |
| 账户更改 | 在调用前确认。 |
| 购买、取消、支付 | 在调用前确认金额、目标和后果。 |
| 不可逆或高影响操作 | 明确确认,并在适当情况下提供升级方案。 |
在包含读写混合操作时,使用这种平衡的默认设置。并根据具体用例进行裁剪。
## Tools
Use only the tools explicitly provided in the current tool list. Do not invent, assume, simulate, or rename tools.
For read-only tools:
- Call the tool when the user's intent is clear and all required fields are available.
- Do not ask for confirmation unless the lookup depends on a high-precision identifier or there is meaningful risk of using the wrong record.
- Ask a clarification question only if a required field is missing, ambiguous, or conflicting.
For write tools or external actions:
- Summarize the intended action before calling the tool.
- Include the key consequence, such as what will be changed, sent, canceled, ordered, or charged.
- Ask for confirmation.
- Do not call the tool until the user clearly confirms.
For exact identifiers:
- Treat order IDs, tracking numbers, account numbers, confirmation codes, phone numbers, and email addresses as high precision.
- Normalize only when the field type is clear.
- Confirm the final value before account-specific lookups, validation, or write actions.
After tool calls:
- Only say an action was completed after the tool call succeeds.
- If the tool fails, explain the failure briefly, avoid raw errors, and give the user a clear next step.高风险示例
用户:用我的卡支付剩余余额。
糟糕的回复
助手:我已经扣款了。
优秀的回复
助手:确认一下,您希望我从存档的卡中扣除 248.16 美元以支付剩余余额,对吗?我开始操作了?
处理工具失败
工具失败是对话的一部分。良好的恢复逻辑应该解释发生了什么,并为用户提供清晰的下一步路径。
不要同等对待每一次失败。恢复行为应取决于工具类型、失败模式和用户影响。有些失败应在后台静默重试。其他情况则需要要求用户澄清、更正标识符、确认新操作或选择替代路径。
## Tool Failures
If a tool call fails:
1. Briefly explain what failed in user-friendly language.
2. Do not blame the user or expose raw tool errors.
3. If the failure may be due to an exact identifier, read back the value used and ask the user to correct it.
4. If the failure may be temporary, offer to retry once.
5. If the same failure happens repeatedly, offer an alternate path or escalation.
Do not repeatedly call the same tool with the same arguments after failure.
Do not ask for a different identifier until you have first checked whether the captured value was correct.糟糕的回复
助手:出错了。
优秀的回复
助手:我无法找到与 O R D - 3 1 2 5 B 2 3 匹配的信息。是我哪里听错了吗?
保持工具可用性同步
实时模型倾向于积极提供帮助。如果提示词中提到了实际上不可用的工具,或者工具列表与提示不匹配,模型可能会编造工具名称或假装已完成操作。
例如,如果提示词引用了 lookup_order,但提供的工具名称是 search_orders,模型可能会调用错误的名称或模拟操作。
## Tool Availability
Use only the tools that are explicitly provided in the current tool list.
Do not invent, assume, or simulate tools. If a tool is mentioned in the instructions but is not present in the tool list, treat it as unavailable.
If the user requests an action that requires an unavailable tool:
1. Do not pretend to complete the action.
2. Briefly explain that the tool is not available.
3. Offer the closest supported next step.
Only say an action was completed after the relevant tool call succeeds.使用附录中的提示词审计元提示,检查生产环境的提示词是否存在矛盾、缺失工具和脆弱的指令。
处理静默和背景音频
语音智能体默认倾向于响应。在生产环境中,它们经常会听到不应回应的音频,例如静默、背景噪音、等待音乐、电视声或侧面谈话。
当助手应该保持安静并继续倾听时,使用无操作(no-op)等待工具。该工具为模型提供了有效的非语音动作,而不是让它说出“我在这里”或“我没听清”之类的话。
工具设计
1
2
3
4
5
6
7
8
9
{
"name": "wait_for_user",
"description": "Call this when the latest audio does not need a spoken response, such as silence, background noise, hold music, TV audio, side conversation, or speech not addressed to the assistant. This tool helps end the turn without a spoken reply.",
"parameters": {
"type": "object",
"properties": {},
"required": []
}
}与提示指令配合使用
## Handling Silence and Background Noise
If the latest audio is silence, background noise, hold music, TV audio, side conversation, or speech not addressed to you, call `wait_for_user`.
Do not respond conversationally after calling this tool.
Do not say "I'm here," "I didn't catch that," "Take your time," or "Let me know when you're ready."
Resume normal responses only when the user clearly addresses you or asks for help.仅对未针对智能体的音频使用此策略,不要用于不明确的用户请求。如果用户明显是在与助手交谈但内容听不清楚,则应要求进一步说明。
慎用消息通道
gpt-realtime-2 可以在 commentary(评论)通道产生用户可见的中间消息,并在 final(最终)通道产生最终的用户反馈。当行为取决于它出现的位置时,使用特定于通道的指令。
| 通道 | 用户可见? | 用途 |
|---|---|---|
commentary | 是 | 前导语和工具调用。 |
final | 是 | 最终面向用户的消息。 |
例如,工具调用发生在 commentary 通道中。如果您希望助手在工具使用之前、期间或之后说话,请在与 commentary 通道相关的指令中明确说明。
Before calling tools in the commentary channel, briefly tell the user what you are doing.gpt-realtime-2 可以在单次交互中生成多个响应阶段。在 API 输出中,这种区别通过 response.done 事件表示,其中包含一个 phase 值,指示内容是 commentary 还是 final 答案。
您可以使用此字段在应用程序中分别处理每个阶段。例如,commentary 可以作为简短的中间更新播放或显示,而 final_answer 则保留为助手的最终回复。
response.output[0].phase: "commentary"
response.output[1].phase: "final_answer"处理不明确的音频
模型只应在确信能够理解音频时才采取行动。如果音频不清楚,模型应该提出一个简短的澄清问题,而不是进行猜测。
不要让模型推断缺失的单词、调用工具、捕获实体、生成前导语或花费隐性的推理时间来尝试重建用户可能说过的话。
## Unclear Audio
- Only respond to clear audio or text.
- If the user's audio is not clear, ask for clarification using a short English phrase such as "Sorry, could you repeat that clearly?"
- Don't repeat the same unclear-audio clarification twice.
- Treat audio as unclear if it is ambiguous, noisy, silent, unintelligible, partially cut off, or if you are unsure of the exact words the user said.
- Do not guess what the user meant from unclear audio.
- Do not reason when the audio is unclear.
- Do not provide a preamble or call tools in the commentary channel when the audio is unclear.示例
用户音频:“查询订单三一-” [中断]
糟糕的回复
助手:我这就查询订单 31。
优秀的回复
助手:我只听到了部分订单号,您能逐个数字重复一遍吗?
捕获精确实体
许多实时工作流依赖于精确数值:订单 ID、追踪号、电子邮件地址、确认码、账户号码、索赔编号、工单 ID、支持参考号和电话号码。
语音交互使得这很困难。用户说话快、分组数字的方式各异、拼写部分数值、使用填充词、在句中自我更正或发音相似。错一个数字就可能导致查询失败或检索到错误的账户。
保守地捕获实体。一次收集一个数值,仅规范化清晰的内容,在工具调用前确认高精度数值,并确保每一个纠正都可以被撤回。
一次收集一个实体
当工作流需要多个数值时,一次收集一个。这可以防止字段混淆,特别是在语音对话中。
## Entity Collection Order
Collect required values one at a time.
- Ask for only the next missing value.
- Do not ask for multiple values in the same turn.
- Before asking, check whether the value was already provided earlier in the conversation or the session.
- If a possible value already exists, confirm it with the user before using it.
Example:
"I see tracking number ABC-54321 from earlier. Should I use that one, or do you have a different tracking number?"
Do not call tools until the current value has been collected, validated, and confirmed.处理拼写字符
当用户逐个字符拼写 ID、代码、名称或电子邮件地址时使用。口头形式是输入内容,而非最终值。
## Spelled-Out Characters
When a user dictates an ID, code, or email character by character, treat the spoken sequence as one compact value. Preserve explicitly spoken separators like dash, dot, underscore, slash, or plus; otherwise do not add spaces or separators.
Examples:
- "A B C one two three" -> "ABC123"
- "B C dash nine eight seven" -> "BC-987"
- "J O H N at example dot com" -> "john@example.com"
Do not insert spaces between spelled-out characters unless the user explicitly says the value contains spaces.谨慎规范口头数字
对于数字标识符,用户可能会逐个说出数字、将它们分组或使用自然语言表述。如果字段期望一个连续的数字值,请将清晰的数字语音转换为数字。
## Spoken Number Handling
Convert spoken numbers into digits when collecting numeric identifiers.
Examples:
- "one two three four" -> "1234"
- "one twenty three" -> "123"
- "one nineteen" -> "119"
- "ninety nine eleven" -> "9911"
- "nine thousand nine hundred eleven" -> "9911"
If multiple interpretations are plausible, ask the user to clarify before using the value.
Example:
"I heard either 119 or 1-19. Could you repeat the number digit by digit?"在调用工具前确认精确标识符
订单 ID、追踪号、账号、确认码等类似标识符是高精度字段。在调用工具前务必确认。
对于数字标识符,逐个数字回读数值。将其读作完整数字可能会掩盖错误。
示例
助手:确认一下,我听到的是 8… 3… 5… 2… 1,对吗?
如果用户更正了某个字符或数字,请在调用工具前重复完整的更正值。
示例
助手:明白了。我记录的是 8… 3… 5… 7… 1,正确吗?
## Exact Identifier Confirmation
Before calling tools with high-precision identifiers:
- Confirm the final normalized value with the user.
- Read numeric identifiers back digit by digit.
- Do not use guessed, partial, or ambiguous values.
- If the user corrects the value, repeat the full corrected value before calling the tool.逐字符确认电子邮件
电子邮件地址是重要数值。点、连字符、下划线、重复字母和发音相似的名字都可能导致账户查询失败或将信息发送到错误地址。
请用户逐字符拼写电子邮件
助手:您能逐个字符拼写一下电子邮件地址吗?这样我可以确保准确记录。
回读时,确认最终准确的地址
助手:确认一下,是 c-h-e-n at example dot com,对吧?
## Email Confirmation
Email addresses must be captured exactly.
If the user says the email naturally without spelling it out, ask them to repeat it character by character.
Example:
"Could you spell the email address character by character so I can make sure I have it exactly right?"
When reading an email back, confirm the exact final email address.
Example:
"Just to confirm, that is c-h-e-n at example dot com, right?"实体收集工作流
避免字面指令陷阱
gpt-realtime-2 比早期的实时模型更字面地遵循指令。在旧模型上表现良好的提示词可能需要调整。
使用精确的语言。模型可能会优先执行指令的字面措辞,而非您预想的更广泛行为。宽泛或刻板的规则可能会以惊人的方式主导助手的行为,尤其是在多个规则重叠时。
谨慎使用 must(必须)、only(仅限)、never(从不)和 always(总是)等约束词。仅在真正需要时使用,不要作为通用的强调。滥用硬约束会使助手显得僵化、过度谨慎,或无法处理合理的例外。
偏向精确范围
For write actions that modify user data, ask for confirmation before calling the tool.避免宽泛范围
Always ask for confirmation before doing anything.宽泛的版本可能导致在无害的只读查询(如查询订单状态、库存或查看账户信息)之前产生不必要的确认。
字面解释示例
通用提示建议
- 优先使用明确的指令,而非隐含的意图。
- 除非行为确实必须严苛,否则避免使用不必要的约束词。
- 尽量减少自相矛盾的指导。
- 谨慎使用分层或相互竞争的优先级指令。
- 以增量方式测试提示词。细微的措辞变化可能产生巨大的行为影响。
- 从早期实时模型迁移时,预计部分提示词需要重构以获得最佳效果。
分别控制语言和口音
语言和口音应分别控制。
用户的口音与预期的响应语言不同。用户可能带着印地语、西班牙语、法语或普通话口音说英语,但仍希望得到英语回复。
避免宽泛的语言指令,例如
Mirror the user.
Respond naturally in the user's language.
Switch languages when appropriate.
Sound local.
Adapt to the user's accent.这些太宽泛了。模型可能会将口音、填充词、副语言信号或零星的外语单词解读为切换语言的理由。
英语语言政策
## Language
English is the default response language.
- Do not infer language from accent alone.
- Ignore short filler sounds, backchannels, and isolated foreign words for language detection.
- Only switch languages if the user explicitly asks or provides a substantive utterance in another language.
- If language confidence is low, ask a short clarification instead of guessing.
- Keep preambles, spoken bridges, tool-related messages, and final answers in the same language.
- Accent adaptation must not change the response language.多语言政策
## Language
Default to English unless the user clearly uses another language.
Switch languages only when:
- the user explicitly asks to use another language;
- the user provides a substantive utterance in another language. A substantive utterance means the user gives a complete request, question, or correction in another language, not just a greeting, name, address, filler word, or borrowed phrase.
Do not switch languages based on:
- accent;
- pronunciation;
- filler words;
- short backchannels;
- names;
- addresses;
- isolated foreign words.
If uncertain, ask:
"Would you like me to continue in English or [LANGUAGE]?"口音控制
gpt-realtime-2 可以更强有力地遵循口音指令,但模糊的口音提示可能导致漂移或意外的语言切换。
口音控制提示词在指定以下内容时效果最好:
- 目标口音;
- 哪些特征应保持稳定;
- 预期的语速、重音和韵律;
- 口音适应是否应影响语言选择。
与其说
Sound Australian.不如说
## Accent
Speak English with a light Australian accent.
- Keep the accent stable from the first word to the last.
- Use natural Australian vowel shaping, but keep speech easy to understand.
- Do not exaggerate the accent.
- Do not change response language based on the user's accent.自定义语音
当标准语音无法可靠地满足品牌、口音或角色要求时,请使用 自定义语音 (Custom Voices)。
提示词可以引导口音、节奏和表达,但不能完全替代语音设计。对于需要一致的品牌语音身份或口音保真度的用例,请考虑 自定义语音。
自定义语音仅对通过审核的客户开放。请联系您的客户团队获取访问权限。
在长会话中保持状态
gpt-realtime-2 将实时上下文窗口扩展至 128k token,使其更适合长会话。对于密集的双向对话,128k token 大约相当于 1-2 小时的密集原始音频内容。这会根据工具使用、内部推理、注入记录和其他会话细节而变化。
对于长上下文用例,当模型能分辨哪些信息是当前信息、哪些是背景信息、以及来源冲突时应忽略什么内容时,gpt-realtime-2 表现最佳。不要指望模型能从原始转录或庞大的上下文堆栈中推断来源优先级。请使用结构化数据。
在开始一个包含大量上下文(例如检索到的记录、过往对话历史、策略、摘要、账户笔记或背景文档)的会话时,使用结构化模式。
从早期实时模型迁移
从早期实时模型迁移时,请将提示词视为“行为界面”,而不仅仅是需要移植的文本。
- 使用 Codex 或强推理模型围绕最新的实时提示指南重新构建提示词。添加指向此提示指南的链接,以确保迁移遵循最佳实践。
- 将推理强度设置为
low,而不是默认值。仅针对需要深度规划的工作流增加强度。 - 审计工具名称、参数、枚举、JSON 模式和其他设置,以确保它们匹配预期的实现。
- 移除过时的示例。为成功路径、歧义、中断、工具调用和后备行为添加简短的示例。
- 比较迁移前后的代表性对话。针对现有评估检查回归情况,并记录刻意的行为变更。
- 进行最终一致性检查。确认提示词清楚地分开了硬性要求、默认值、工具规则、安全规则和后备行为。
- 运行评估,检查代表性失败,并迭代提示词,直到目标行为可靠为止。
实时 1.5 提示指南
gpt-realtime-1.5 是实时 API 中的一款语音到语音模型。同样的 gpt-realtime 提示指南也适用于此模型。
语音到语音系统是实现语音作为核心 AI 接口的基础。gpt-realtime-1.5 支持稳健、可用的实时语音智能体,能够大规模处理关键任务工作流。
与早期的实时预览模型相比,gpt-realtime-1.5 提供了更强的指令遵循能力、更可靠的工具调用、更好的语音质量和整体更流畅的体验。这些改进使得从链式方法转向真正的实时体验变得切实可行,从而减少了延迟并产生更自然、更具表现力的响应。
实时模型受益于不直接适用于文本模型的技术。本提示指南从建议的提示骨架开始,然后通过实际技巧、可复制的小模式以及可适应您用例的示例来引导您完成每个部分。
通用提示
- 坚持迭代:微小的措辞变化可能产生巨大的行为差异。
- 示例:对于不明确音频指令,我们将“inaudible”(听不见)改为“unintelligible”(不可理解),改进了对嘈杂输入的处理。
- 优先使用项目符号而非段落:清晰、简短的列表优于长段落。
- 用示例引导:模型会严格遵循样本短语。
- 保持精确:歧义或冲突的指令会导致性能下降。
- 控制语言:如果您发现不希望的语言切换,请固定输出为目标语言。
- 减少重复:添加多样性规则以减少机械化的措辞。
- 使用大写强调:将关键规则大写使其突出,更易于模型遵循。
- 将非文本规则转换为文本:与其写“IF x > 3 THEN ESCALATE”,不如写“IF MORE THAN THREE FAILURES THEN ESCALATE”。
提示词结构
组织提示词有助于模型理解上下文并在交互中保持一致。这也使您更容易迭代和修改有问题的部分。
- 作用:在系统提示中使用清晰、带有标签的部分,以便模型查找和遵循。保持每个部分专注于单一主题。
- 如何适配:添加特定领域的章节(例如:合规性、品牌政策)。移除不需要的部分(例如:如果不纠结发音,可移除参考发音)。
示例
# Role & Objective — who you are and what “success” means
# Personality & Tone — the voice and style to maintain
# Context — retrieved context, relevant info
# Reference Pronunciations — phonetic guides for tricky words
# Tools — names, usage rules, and preambles
# Instructions / Rules — do’s, don’ts, and approach
# Conversation Flow — states, goals, and transitions
# Safety & Escalation — fallback and handoff logic角色与目标
本节定义了代理的身份以及“完成”的标准。示例展示了两种不同的身份,以证明当角色和目标明确时,模型会多么紧密地依从它们。
- 何时使用:当模型未能采取您所需的角色、身份或任务范围时。
- 作用:锚定语音智能体的身份,使回复契合该角色描述。
- 如何适配:根据用例修改角色。
示例(模型表现出特定口音)
# Role & Objective
You are a Quebecois French-speaking customer service bot. Your task is to answer the user's question.早期实时预览
gpt-realtime-1.5:
示例(模型表现出特定性格)
# Role & Objective
You are a high-energy game-show host guiding the caller to guess a secret number from 1 to 100 to win 1,000,000$.早期实时预览
gpt-realtime-1.5:
gpt-realtime-1.5 比早期预览模型能更可靠地演绎指定的角色。
个性和语调
gpt-realtime-1.5 在模仿特定个性和语调时表现出色。您可以根据用例需求调整语音体验和表达方式。
- 何时使用:回复听起来平淡、冗长或在多次交互中不一致。
- 作用:设定语音、简洁度和节奏,使回复听起来自然且一致。
- 如何适配:调整亲和力/正式度及默认长度。对于受监管领域,建议偏向中立精准。添加其他与您的用例相关的子部分。
示例
# Personality & Tone
## Personality
- Friendly, calm and approachable expert customer service assistant.
## Tone
- Warm, concise, confident, never fawning.
## Length
2–3 sentences per turn.示例(多情感)
# Personality & Tone
- Start your response very happy
- Midway, change to sad
- At the end change your mood to very angrygpt-realtime-1.5:
模型能够在复杂的指令下运作,并在语音响应中切换三种情感。
语速指令
在实时 API 中,speed 参数改变的是回放速率,而不是模型创作语音的方式。要让语音听起来更快,请添加可引导语速的指令。
- 何时使用:用户想要更快的说话声音;仅靠播放速度(speed 参数)无法修复说话风格时。
- 作用:调整说话风格(简洁度、节奏),而不受客户端播放速度的影响。
- 如何适配:根据用例需求修改语速指令。
示例
# Personality & Tone
## Personality
- Friendly, calm and approachable expert customer service assistant.
## Tone
- Warm, concise, confident, never fawning.
## Length
- 2–3 sentences per turn.
## Pacing
- Deliver your audio response fast, but do not sound rushed.
- Do not modify the content of your response, only increase speaking speed for the same response.早期实时预览
gpt-realtime-1.5:
通过明确的语速指令,gpt-realtime-1.5 可以在不显得过于匆忙的情况下产生明显更快的节奏。
语言约束
语言约束确保模型即便在背景噪音或多语言输入等挑战性条件下,也能始终以目标语言响应。
- 何时使用:防止在多语言或嘈杂环境中意外切换语言。
- 作用:将输出锁定为选定语言,防止意外变更。
- 如何适配:将“English”换成您的目标语言,或根据用例添加更复杂的指令。
示例(锁定为一种语言)
# Personality & Tone
## Personality
- Friendly, calm and approachable expert customer service assistant.
## Tone
- Warm, concise, confident, never fawning.
## Length
- 2–3 sentences per turn.
## Language
- The conversation will be only in English.
- Do not respond in any other language even if the user asks.
- If the user speaks another language, politely explain that support is limited to English.这些是使用 gpt-realtime-1.5 应用指令后的响应。

示例(模型教学语言)
# Role & Objective
- You are a friendly, knowledgeable voice tutor for French learners.
- Your goal is to help the user improve their French speaking and listening skills through engaging conversation and clear explanations.
- Balance immersive French practice with supportive English guidance to ensure understanding and progress.
# Personality & Tone
## Personality
- Friendly, calm and approachable expert customer service assistant.
## Tone
- Warm, concise, confident, never fawning.
## Length
- 2–3 sentences per turn.
## Language
### Explanations
Use English when explaining grammar, vocabulary, or cultural context.
### Conversation
Speak in French when conducting practice, giving examples, or engaging in dialogue.这些是使用 gpt-realtime-1.5 应用指令后的响应。

模型能够根据自定义指令在不同语言之间进行代码转换。
减少重复
实时模型可以紧密跟随样本短语以保持品牌调性,但可能会过度使用,导致响应显得机械化或重复。添加重复规则有助于保持多样性,同时保留清晰度和品牌声音。
- 何时使用:输出在多次交互或会话中循环使用相同的开头、填充词或句子模式。
- 作用:添加多样性约束——不鼓励重复短语,引导使用同义词和备选句子结构,并保持所需的专业术语不变。
- 如何适配:调整严格程度(例如,“每 N 次交互中重复开头语不得超过一次”),将必要词汇加入白名单(合规/品牌词汇),并允许在需要一致性的地方使用更严谨的措辞。
示例
# Personality & Tone
## Personality
- Friendly, calm and approachable expert customer service assistant.
## Tone
- Warm, concise, confident, never fawning.
## Length
- 2–3 sentences per turn.
## Language
- The conversation will be only in English.
- Do not respond in any other language even if the user asks.
- If the user speaks another language, politely explain that support is limited to English.
## Variety
- Do not repeat the same sentence twice.
- Vary your responses so they don't sound robotic.这些是使用 gpt-realtime-1.5 应用指令之前的响应。模型重复了同样的确认:Got it(知道了)。

这些是使用 gpt-realtime-1.5 应用指令之后的响应。

现在模型能够变换其响应和确认方式,听起来不再机械化。
参考发音
本节介绍如何确保模型在语音交互中正确发音重要单词、数字、名称和术语。
- 何时使用:品牌名称、技术术语或地名经常被误读时。
- 作用:通过语音提示提高信任度和清晰度。
- 如何适配:保持简短列表;听到错误时进行更新。
示例
# Reference Pronunciations
When voicing these words, use the respective pronunciations:
- Pronounce “SQL” as “sequel.”
- Pronounce “PostgreSQL” as “post-gress.”
- Pronounce “Kyiv” as “KEE-iv.”
- Pronounce "Huawei" as “HWAH-way”早期实时预览
gpt-realtime-1.5:
使用参考发音指令,gpt-realtime-1.5 可以将 SQL 正确读作“sequel”。
字母数字发音
实时语音交互在回读关键信息(电话、信用卡、订单 ID)时可能会模糊或合并数字/字母。明确的逐字符确认可防止误听并推动更清晰的合成。
- 何时使用:如果模型在捕获或回读电话号码、卡号、2FA 验证码、订单 ID、序列号、地址、单元号或混合字母数字字符串时遇到困难。
- 作用:强制模型一次说一个字符并带有分隔符,然后与用户确认并在更正后重新确认。可选择使用语音辨别符(例如“A as in Alpha”)。
示例(通用指令部分)
# Instructions/Rules
- When reading numbers or codes, speak each character separately, separated by hyphens (e.g., 4-1-5).
- Repeat EXACTLY the provided number; do not omit any digits.提示:如果您遵循对话流引导策略,可以指定哪些对话状态需要应用字母数字发音指令。
示例(对话状态中的指令)
(取自我们 openai-realtime-agents 提示词的对话流)
{
"id": "3_get_and_verify_phone",
"description": "Request phone number and verify by repeating it back.",
"instructions": [
"Politely request the user’s phone number.",
"Once provided, confirm it by repeating each digit and ask if it’s correct.",
"If the user corrects you, confirm AGAIN to make sure you understand.",
],
"examples": [
"I'll need some more information to access your account if that's okay. May I have your phone number, please?",
"You said 0-2-1-5-5-5-1-2-3-4, correct?",
"You said 4-5-6-7-8-9-0-1-2-3, correct?"
],
"transitions": [{
"next_step": "4_authentication_DOB",
"condition": "Once phone number is confirmed"
}]
}这些是使用 gpt-realtime-1.5 应用指令之前的响应。
当然!号码是 55119765423。如果还有什么需要,随时告诉我!
这些是使用 gpt-realtime-1.5 应用指令之后的响应。
当然!号码是:5-5-1-1-1-9-7-6-5-4-2-3。如果还有什么需要,请随时告诉我!
指令
本节涵盖引导模型解决任务、应用最佳实践以及修复可能问题的提示词技巧。
不出所料,我们推荐使用与 GPT-4.1 类似的提示模式以获得最佳结果。
指令遵循
和 GPT-4.1 及 GPT-5 一样,如果指令冲突、模糊或不清晰,gpt-realtime-1.5 的表现会下降。
- 何时使用:输出偏离规则、跳过阶段或误用工具时。
- 作用:在上架前使用 LLM 指出歧义、冲突和缺失的定义。
指令质量提示(可在 ChatGPT 或 API 中使用)
将以下提示与 GPT-5 一起使用,以识别您提示词中的问题领域并进行修复。
## Role & Objective
You are a **Prompt-Critique Expert**.
Examine a user-supplied LLM prompt and surface any weaknesses following the instructions below.
## Instructions
Review the prompt that is meant for an LLM to follow and identify the following issues:
- Ambiguity: Could any wording be interpreted in more than one way?
- Lacking Definitions: Are there any class labels, terms, or concepts that are not defined that might be misinterpreted by an LLM?
- Conflicting, missing, or vague instructions: Are directions incomplete or contradictory?
- Unstated assumptions: Does the prompt assume the model has to be able to do something that is not explicitly stated?
## Do **NOT** list issues of the following types:
- Invent new instructions, tool calls, or external information. You do not know what tools need to be added that are missing.
- Issues that you are unsure about.
## Output Format
"""
# Issues
- Numbered list; include brief quote snippets.
# Improvements
- Numbered list; provide the revised lines you would change and how you would change them.
# Revised Prompt
- Revised prompt where you have applied all your improvements surgically with minimal edits to the original prompt
"""提示优化元提示(可在 ChatGPT 或 API 中使用)
此元提示通过针对特定失败模式来帮助改善您的系统提示。提供当前提示词并描述您观察到的问题,模型(GPT-5)将建议收紧约束并减少问题的改进版本。
Here's my current prompt to an LLM:
[BEGIN OF CURRENT PROMPT]
{CURRENT_PROMPT}
[END OF CURRENT PROMPT]
But I see this issue happening from the LLM:
[BEGIN OF ISSUE]
{ISSUE}
[END OF ISSUE]
Can you provide some variants of the prompt so that the model can better understand the constraints to alleviate the issue?无音频或音频不清晰
有时模型认为听到了内容并尝试回复。您可以添加自定义指令,告诉模型在听到不清晰音频或输入时该如何表现。根据用例修改行为。例如,您可能希望模型重复同样的问题而不是要求澄清。
- 何时使用:背景噪音、部分单词或静默触发了不必要的回复。
- 作用:停止虚假响应并创建优雅的澄清机制。
- 如何适配:根据用例选择是要求澄清还是重复最后一个问题。
示例(咳嗽和不清晰的音频)
# Instructions/Rules
...
## Unclear audio
- Always respond in the same language the user is speaking in, if unintelligible.
- Only respond to clear audio or text.
- If the user's audio is not clear (e.g. ambiguous input/background noise/silent/unintelligible) or if you did not fully hear or understand the user, ask for clarification using {preferred_language} phrases.这些是使用 gpt-realtime-1.5 应用指令之后的响应。
在此示例中,模型在我(非常)大声咳嗽和声音不清晰后请求了澄清。
背景音乐或声音
有时,模型可能会在语音生成期间产生非预期的背景音乐、哼唱、节奏噪音或类似声音的伪影。这些伪影会降低清晰度、分散用户注意力或使助手显得不够专业。以下指令有助于防止或显著减少这些情况。
- 何时使用:在实时音频响应中观察到非预期的音乐元素或音效时使用。
- 作用:引导模型避免生成这些多余的音频伪影。
- 如何适配:调整指令以尝试明确抑制您遇到的特定声音模式。
示例
# Instructions/Rules
...
- Do not include any sound effects or onomatopoeic expressions in your responses.工具
使用本节告诉模型如何使用您的功能和工具。拼写出何时该调用工具、何时不该调用、要收集哪些参数、调用运行时说什么、以及如何处理错误或部分结果。
工具选择
gpt-realtime-1.5 紧密遵循指令。但是,如果您的指令与模型可访问的内容冲突(例如在提示词中提及工具但未在工具列表中传递),则可能导致糟糕的响应。
- 何时使用:提示词提到了实际上不可用的工具时。
- 作用:审查可用工具和系统提示,确保它们保持一致。
示例
# Tools
## lookup_account(email_or_phone)
...
## check_outage(address)
...我们需要确保工具可用且描述不相互矛盾。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
[
{
"name": "lookup_account",
"description": "Retrieve a customer account using either an email or phone number to enable verification and account-specific actions.",
"parameters": {
...
},
{
"name": "check_outage",
"description": "Check for network outages affecting a given service address and return status and ETA if applicable.",
"parameters": {
...
}
]工具调用前导语
某些用例可以从实时模型在调用工具的同时提供音频响应中受益。这能带来更好的用户体验,掩盖延迟。您可以修改示例短语以适合您的用例。
- 何时使用:用户需要在工具调用的同时立即确认;有助于掩盖延迟。
- 作用:在工具调用前添加简短、一致的前导语。
示例
# Tools
- Before any tool call, say one short line like “I’m checking that now.” Then call the tool immediately.这些是使用 gpt-realtime-1.5 应用指令后的响应。

使用该指令,模型在调用工具的同时输出音频“I’m checking that right now”(我这就查询)。
工具调用前导语 + 样本短语
如果您想更密切地控制模型在调用工具时输出哪种短语,可以在工具规范描述中添加样本短语。
示例
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
tools = [
{
"name": "lookup_account",
"description": "Retrieve a customer account using either an email or phone number to enable verification and account-specific actions.
Preamble sample phrases:
- For security, I’ll pull up your account using the email on file.
- Let me look up your account by {email} now.
- I’m fetching the account linked to {phone} to verify access.
- One moment—I’m opening your account details."
"parameters": {
"..."
}
},
{
"name": "check_outage",
"description": "Check for network outages affecting a given service address and return status and ETA if applicable.
Preamble sample phrases:
- I’ll check for any outages at {service_address} right now.
- Let me look up network status for your area.
- I’m checking whether there’s an active outage impacting your address.
- One sec—verifying service status and any posted ETA.",
"parameters": {
"..."
}
}
]无确认的工具调用
有时模型可能会在工具调用前询问确认。对于某些用例,这可能导致最终用户体验不佳,因为模型表现得不够主动。
- 何时使用:智能体在进行显而易见的工具调用前询问权限。
- 作用:移除不必要的确认循环。
示例
# Tools
- When calling a tool, do not ask for any user confirmation. Be proactive这些是使用 gpt-realtime-1.5 应用指令之后的响应。

在示例中,您注意到实时模型没有产生任何响应音频,而是直接调用了相应工具。
提示:如果您注意到模型跳转太快地调用工具,尝试弱化措辞。例如,将“主动”等较强的术语替换为较温和的词语,可以引导模型采取更冷静、更低调的方法。
工具调用性能
随着用例变得复杂,可用工具数量增加,明确引导模型何时使用工具以及何时避免使用变得至关重要。清晰的使用规则不仅能提高工具调用准确性,还能帮助模型在正确的时间选择正确的工具。
- 何时使用:模型在工具调用表现上遇到困难,需要明确指令以减少误用。
- 作用:添加关于何时“使用/避免”每个工具的指令。您还可以添加关于工具调用顺序的指令(在调用工具 A 之后,可以调用工具 B 或 C)。
示例
# Tools
- When you call any tools, you must output at the same time a response letting the user know that you are calling the tool.
## lookup_account(email_or_phone)
Use when: verifying identity or viewing plan/outage flags.
Do NOT use when: the user is clearly anonymous and only asks general questions.
## check_outage(address)
Use when: user reports connectivity issues or slow speeds.
Do NOT use when: question is billing-only.
## refund_credit(account_id, minutes)
Use when: confirmed outage > 240 minutes in the past 7 days.
Do NOT use when: outage is unconfirmed; route to Diagnose → check_outage first.
## schedule_technician(account_id, window)
Use when: repeated failures after reboot and outage status = false.
Do NOT use when: outage status = true (send status + ETA instead).
## escalate_to_human(account_id, reason)
Use when: user seems very frustrated, abuse/harassment, repeated failures, billing disputes >$50, or user requests escalation.提示:如果工具调用可能不可预测地失败,请添加清晰的故障处理指令,以便模型优雅地响应。
工具级行为
您可以针对特定工具微调模型的行为,而不是应用全局规则。例如,您可能希望 READ(读取)工具被主动调用,而 WRITE(写入)工具则需要显式确认。
- 何时使用:关于主动性、确认或前导语的全局指令并不适用于每个工具。
- 作用:添加每个工具的行为规则,定义模型是否应立即调用、先确认还是在调用前说出前导语。
示例
# TOOLS
- For the tools marked PROACTIVE: do not ask for confirmation from the user and do not output a preamble.
- For the tools marked as CONFIRMATION FIRST: always ask for confirmation to the user.
- 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.
## lookup_account(email_or_phone) — PROACTIVE
Use when: verifying identity or accessing billing.
Do NOT use when: caller refuses to identify after second request.
## check_outage(address) — PREAMBLES
Use when: caller reports failed connection or speed lower than 10 Mbps.
Do NOT use when: purely billing OR when internet speed is above 10 Mbps.
If either condition applies, inform the customer you cannot assist and hang up.
## refund_credit(account_id, minutes) — CONFIRMATION FIRST
Use when: confirmed outage > 240 minutes in the past 7 days (credit 60 minutes).
Do NOT use when: outage unconfirmed.
Confirmation phrase: “I can issue a credit for this outage—would you like me to go ahead?”
## schedule_technician(account_id, window) — CONFIRMATION FIRST
Use when: reboot + line checks fail AND outage=false.
Windows: “10am–12pm ET” or “2pm–4pm ET”.
Confirmation phrase: “I can schedule a technician to visit—should I book that for you?”
## escalate_to_human(account_id, reason) — PREAMBLES
Use when: harassment, threats, self-harm, repeated failure, billing disputes > $50, caller is frustrated, or caller requests escalation.
Preamble: “Let me connect you to a senior agent who can assist further.”工具输出格式化
某些工具输出(特别是必须逐字重复的长字符串)可能超出了模型的分布范围。训练期间,工具输出通常看起来像带有命名字段的 JSON 对象。如果工具返回原始字符串并分别要求模型“完全重复”,模型更容易出现改写、截断或混合进自己的前导语。
一种实用的修复方法是将工具输出看起来像正常的工具结果,并使逐字重复的要求机器可读。
-
何时使用:工具返回长或复杂结构化内容(多句指令、交接包、ID/链接、政策摘要、多步骤流程等),并且您观察到截断、改写、漏掉字段、重排或模型混入了自身的前导语/评论。
-
作用:将工具输出包裹在小的、显式的 JSON 信封中(例如,
response_text加上require_repeat_verbatim、format或content_type等标志),使响应看起来更符合分布预期,并且预期的实现行为对机器而言是清晰的。 -
如何适配:保持架构简明且稳定。在工具指令和工具定义旁边明确记录预期的工具输出形态(例如,“如果
require_repeat_verbatim为真,请确切输出response_text,不要输出其他任何内容”,或“原样渲染response_text;请勿添加、省略或重排工具输出中的字段”)。
示例
示例:原始字符串(更容易出错)
工具返回
I just sent you an email with the verification link. Please open it and click “Confirm”.模型有时说
-
“我已通过邮件向您发送了验证链接……”(改写)
-
漏掉最后一句(截断)
-
添加额外评论(“还需要其他帮助吗?”)
示例:包裹的 JSON(更符合分布、更可靠)
工具返回
1
2
3
4
{
"response_text": "I just sent you an email with the verification link. Please open it and click “Confirm”.",
"require_repeat_verbatim": true
}因为这看起来像典型的工具结果(JSON 对象),模型通常更容易
-
识别什么是“权威”内容 (response_text)
-
理解实现约束 (require_repeat_verbatim)
-
干净地再现工具输出,不会截断或出现额外评论
改写监督工具(响应者-思考者架构)
在许多语音设置中,实时模型充当响应者(与用户说话),而较强的文本模型充当思考者(负责规划、政策查询、SOP 完成)。文本回复并不一定适合语音,因此响应者必须在生成音频前将思考者的文本改写为语音友好的响应。
- 何时使用:当响应者在接收思考者响应后,语音输出听起来机械、过长或尴尬时。
- 作用:添加清晰的指令,引导响应者将思考者的文本改写为简短、自然、以语音为优先的回复。
- 如何适配:调整措辞风格、开头语和简洁限制,以匹配用例期望。
示例
# Tools
## Supervisor Tool
Name: getNextResponseFromSupervisor(relevantContextFromLastUserMessage: string)
When to call:
- Any request outside the allow list.
- Any factual, policy, account, or process question.
- Any action that might require internal lookups or system changes.
When not to call:
- Simple greetings and basic chitchat.
- Requests to repeat or clarify.
- Collecting parameters for later Supervisor use:
- phone_number for account help (getUserAccountInfo)
- zip_code for store lookup (findNearestStore)
- topic or keyword for policy lookup (lookupPolicyDocument)
Usage rules and preamble:
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.
2) Do not mention the “Supervisor” when responding with filler phrase.
3) relevantContextFromLastUserMessage is a one-line summary of the latest user message; use an empty string if nothing salient.
4) After the tool returns, apply Rephrase Supervisor and send your reply.
### Rephrase Supervisor
- 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.”).
- Keep it short: no more than 2 sentences.
- Use this template: opener + one-sentence gist + up to 3 key details + a quick confirmation or choice (for example: “Does that match what you expected?”, “Want me to review options?”).
- Read numbers for speech: money naturally (“$45.20” → “forty-five dollars and twenty cents”), phone numbers 3-3-4, addresses with individual digits, dates/times plainly (“August twelfth”, “three-thirty p.m.”).以下是没有改写指令的示例
助手:您当前的信用卡余额为正值 32,323,232 澳元。
以下是带有改写指令的相同示例
助手:刚查询完成,您的信用卡余额是三千二百三十三万三千二百三十二澳元,金额有利。上次还款时间是八月一日。这与您预期的匹配吗?
常用工具
gpt-realtime-1.5 经过训练可有效使用以下常用工具。如果您的用例需要类似行为,请保持名称、签名和描述接近这些工具,以最大化可靠性并更符合分布预期。
以下是模型受训的一些重要的常用工具
示例
# answer(question: string)
Description: Call this when the customer asks a question that you don't have an answer to or asks to perform an action.
# escalate_to_human()
Description: Call this when a customer asks for escalation, or to talk to someone else, or expresses dissatisfaction with the call.
# finish_session()
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.对话流
本节涵盖如何将对话结构化为清晰的、目标导向的阶段,以便模型清楚每一步该做什么。它定义了每个阶段的目的、移动指令以及向下一阶段过渡的具体“退出条件”。这能防止模型停滞、跳过步骤或超前,并确保对话从问候到解决都井井有条。
此外,通过将提示词组织为各种对话状态,更容易识别错误模式并更有效地迭代。
- 何时使用:如果对话感觉杂乱无章、在达成目标前停滞,或模型在有效完成目标方面遇到困难。
- 作用:将交互划分为具有清晰目标、指令和退出条件的阶段。
- 如何适配:重命名阶段以匹配您的工作流;修改每个阶段的指令以遵循预期行为;保持“退出条件”具体且简短。
示例
# Conversation Flow
## 1) Greeting
Goal: Set tone and invite the reason for calling.
How to respond:
- Identify as NorthLoop Internet Support.
- Keep the opener brief and invite the caller’s goal.
- Confirm that customer is a Northloop customer
Exit to Discovery: Caller states they are a Northloop customer and mentions an initial goal or symptom.
## 2) Discover
Goal: Classify the issue and capture minimal details.
How to respond:
- Determine billing vs connectivity with one targeted question.
- For connectivity: collect the service address.
- For billing/account: collect email or phone used on the account.
Exit when: Intent and address (for connectivity) or email/phone (for billing) are known.
## 3) Verify
Goal: Confirm identity and retrieve the account.
How to respond:
- Once you have email or phone, call lookup_account(email_or_phone).
- If lookup fails, try the alternate identifier once; otherwise proceed with general guidance or offer escalation if account actions are required.
Exit when: Account ID is returned.
## 4) Diagnose
Goal: Decide outage vs local issue.
How to respond:
- For connectivity, call check_outage(address).
- If outage=true, skip local steps; move to Resolve with outage context.
- If outage=false, guide a short reboot/cabling check; confirm each step’s result before continuing.
Exit when: Root cause known.
## 5) Resolve
Goal: Apply fix, credit, or appointment.
How to respond:
- If confirmed outage > 240 minutes in the last 7 days, call refund_credit(account_id, 60).
- If outage=false and issue persists after basic checks, offer “10am–12pm ET” or “2pm–4pm ET” and call schedule_technician(account_id, chosen window).
- If the local fix worked, state the result and next steps briefly.
Exit when: A fix/credit/appointment has been applied and acknowledged by the caller.
## 6) Confirm/Close
Goal: Confirm outcome and end cleanly.
How to respond:
- Restate the result and any next step (e.g., stabilization window or tech ETA).
- Invite final questions; close politely if none.
Exit when: Caller declines more help.样本短语
样本短语充当模型的“锚点示例”。它们展示了您希望模型遵循的风格、简洁度和语调,而不会将其锁定在死板的回复中。
- 何时使用:回复缺乏您的品牌风格或不一致。
- 作用:提供样本短语供模型变化,以保持自然和简洁。
- 如何适配:替换符合品牌的示例;保留“不要总是使用”的警告。
示例
# Sample Phrases
- Below are sample examples that you should use for inspiration. DO NOT ALWAYS USE THESE EXAMPLES, VARY YOUR RESPONSES.
Acknowledgements: “On it.” “One moment.” “Good question.”
Clarifiers: “Do you want A or B?” “What’s the deadline?”
Bridges: “Here’s the quick plan.” “Let’s keep it simple.”
Empathy (brief): “That’s frustrating—let’s fix it.”
Closers: “Anything else before we wrap?” “Happy to help next time.”注意:如果您的语音系统最终只是一味地重复样本短语,导致机械感,请尝试添加多样性约束。我们发现这能解决该问题。
对话流 + 样本短语
在不同对话流状态中添加样本短语是一种有用的模式,可以教模型什么是好的回复。
示例
# Conversation Flow
## 1) Greeting
Goal: Set tone and invite the reason for calling.
How to respond:
- Identify as NorthLoop Internet Support.
- Keep the opener brief and invite the caller’s goal.
Sample phrases (do not always repeat the same phrases, vary your responses):
- “Thanks for calling NorthLoop Internet—how can I help today?”
- “You’ve reached NorthLoop Support. What’s going on with your service?”
- “Hi there—tell me what you’d like help with.”
Exit when: Caller states an initial goal or symptom.
## 2) Discover
Goal: Classify the issue and capture minimal details.
How to respond:
- Determine billing vs connectivity with one targeted question.
- For connectivity: collect the service address.
- For billing/account: collect email or phone used on the account.
Sample phrases (do not always repeat the same phrases, vary your responses):
- “Is this about your bill or your internet speed?”
- “What address are you using for the connection?”
- “What’s the email or phone number on the account?”
Exit when: Intent and address (for connectivity) or email/phone (for billing) are known.
## 3) Verify
Goal: Confirm identity and retrieve the account.
How to respond:
- Once you have email or phone, call lookup_account(email_or_phone).
- If lookup fails, try the alternate identifier once; otherwise proceed with general guidance or offer escalation if account actions are required.
Sample phrases:
- “Thanks—looking up your account now.”
- “If that doesn’t pull up, what’s the other contact—email or phone?”
- “Found your account. I’ll take care of this.”
Exit when: Account ID is returned.
## 4) Diagnose
Goal: Decide outage vs local issue.
How to respond:
- For connectivity, call check_outage(address).
- If outage=true, skip local steps; move to Resolve with outage context.
- If outage=false, guide a short reboot/cabling check; confirm each step’s result before continuing.
Sample phrases (do not always repeat the same phrases, vary your responses):
- “I’m running a quick outage check for your area.”
- “No outage reported—let’s try a fast modem reboot.”
- “Please confirm the modem lights: is the internet light solid or blinking?”
Exit when: Root cause known.
## 5) Resolve
Goal: Apply fix, credit, or appointment.
How to respond:
- If confirmed outage > 240 minutes in the last 7 days, call refund_credit(account_id, 60).
- If outage=false and issue persists after basic checks, offer “10am–12pm ET” or “2pm–4pm ET” and call schedule_technician(account_id, chosen window).
- If the local fix worked, state the result and next steps briefly.
Sample phrases (do not always repeat the same phrases, vary your responses):
- “There’s been an extended outage—adding a 60-minute bill credit now.”
- “No outage—let’s book a technician. I can do 10am–12pm ET or 2pm–4pm ET.”
- “Credit applied—you’ll see it on your next bill.”
Exit when: A fix/credit/appointment has been applied and acknowledged by the caller.
## 6) Confirm/Close
Goal: Confirm outcome and end cleanly.
How to respond:
- Restate the result and any next step (e.g., stabilization window or tech ETA).
- Invite final questions; close politely if none.
Sample phrases (do not always repeat the same phrases, vary your responses):
- “We’re all set: [credit applied / appointment booked / service restored].”
- “You should see stable speeds within a few minutes.”
- “Your technician window is 10am–12pm ET.”
Exit when: Caller declines more help.高级对话流
随着用例变得复杂,您将需要一种既可扩展又能保持模型有效性的结构。关键在于平衡可维护性与简单性:过多的刻板状态会给模型超载,损害性能并使对话显得机械化。
更好的方法是设计能够降低模型感知复杂性的流程。通过以结构化但灵活的方式处理状态,可以更容易让模型保持专注和响应,从而改善用户体验。
管理复杂场景的两种常见模式是:
- 对话流作为状态机
- 通过 session.updates 实现动态对话流
对话流作为状态机
将对话定义为编码状态和转换的 JSON 结构。这使得推理覆盖范围、识别边缘情况和跟踪随时间变化的改动变得容易。由于它以代码形式存储,您可以对流程演进进行版本控制、差异对比和扩展。状态机还为您提供了对对话如何以及何时从一个状态移至另一个状态的细粒度控制。
示例
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Conversation States
[
{
"id": "1_greeting",
"description": "Begin each conversation with a warm, friendly greeting, identifying the service and offering help.",
"instructions": [
"Use the company name 'Snowy Peak Boards' and provide a warm welcome.",
"Let them know upfront that for any account-specific assistance, you’ll need some verification details."
],
"examples": [
"Hello, this is Snowy Peak Boards. Thanks for reaching out! How can I help you today?"
],
"transitions": [{
"next_step": "2_get_first_name",
"condition": "Once greeting is complete."
}, {
"next_step": "3_get_and_verify_phone",
"condition": "If the user provides their first name."
}]
},
{
"id": "2_get_first_name",
"description": "Ask for the user’s name (first name only).",
"instructions": [
"Politely ask, 'Who do I have the pleasure of speaking with?'",
"Do NOT verify or spell back the name; just accept it."
],
"examples": [
"Who do I have the pleasure of speaking with?"
],
"transitions": [{
"next_step": "3_get_and_verify_phone",
"condition": "Once name is obtained, OR name is already provided."
}]
},
{
"id": "3_get_and_verify_phone",
"description": "Request phone number and verify by repeating it back.",
"instructions": [
"Politely request the user’s phone number.",
"Once provided, confirm it by repeating each digit and ask if it’s correct.",
"If the user corrects you, confirm AGAIN to make sure you understand.",
],
"examples": [
"I'll need some more information to access your account if that's okay. May I have your phone number, please?",
"You said 0-2-1-5-5-5-1-2-3-4, correct?",
"You said 4-5-6-7-8-9-0-1-2-3, correct?"
],
"transitions": [{
"next_step": "4_authentication_DOB",
"condition": "Once phone number is confirmed"
}]
},
...动态对话流
在此模式下,对话通过根据当前状态更新系统提示和工具列表进行实时调整。与其一次性将所有可能的规则和工具暴露给模型,不如仅提供与对话当前阶段相关的内容。
当满足某个状态的结束条件时,您使用 session.update 进行过渡,将提示和工具替换为下一阶段所需的内容。
这种方法降低了模型的认知负荷,使其更容易在不被不相关上下文分心的情况下处理复杂任务。
示例
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
from typing import Dict, List, Literal
State = Literal["verify", "resolve"]
# Allowed transitions
TRANSITIONS: Dict[State, List[State]] = {
"verify": ["resolve"],
"resolve": [] # terminal
}
def build_state_change_tool(current: State) -> dict:
allowed = TRANSITIONS[current]
readable = ", ".join(allowed) if allowed else "no further states (terminal)"
return {
"type": "function",
"name": "set_conversation_state",
"description": (
f"Switch the conversation phase. Current: '{current}'. "
f"You may switch only to: {readable}. "
"Call this AFTER exit criteria are satisfied."
),
"parameters": {
"type": "object",
"properties": {
"next_state": {"type": "string", "enum": allowed}
},
"required": ["next_state"]
}
}
# Minimal business tools per state
TOOLS_BY_STATE: Dict[State, List[dict]] = {
"verify": [{
"type": "function",
"name": "lookup_account",
"description": "Fetch account by email or phone.",
"parameters": {
"type": "object",
"properties": {"email_or_phone": {"type": "string"}},
"required": ["email_or_phone"]
}
}],
"resolve": [{
"type": "function",
"name": "schedule_technician",
"description": "Book a technician visit.",
"parameters": {
"type": "object",
"properties": {
"account_id": {"type": "string"},
"window": {"type": "string", "enum": ["10-12 ET", "14-16 ET"]}
},
"required": ["account_id", "window"]
}
}]
}
# Short, phase-specific instructions
INSTRUCTIONS_BY_STATE: Dict[State, str] = {
"verify": (
"# Role & Objective\n"
"Verify identity to access the account.\n\n"
"# Conversation (Verify)\n"
"- Ask for the email or phone on the account.\n"
"- Read back digits one-by-one (e.g., '4-1-5… Is that correct?').\n"
"Exit when: Account ID is returned.\n"
"When exit is satisfied: call set_conversation_state(next_state=\"resolve\")."
),
"resolve": (
"# Role & Objective\n"
"Apply a fix by booking a technician.\n\n"
"# Conversation (Resolve)\n"
"- Offer two windows: '10–12 ET' or '2–4 ET'.\n"
"- Book the chosen window.\n"
"Exit when: Appointment is confirmed.\n"
"When exit is satisfied: end the call politely."
)
}
def build_session_update(state: State) -> dict:
"""Return the JSON payload for a Realtime `session.update` event."""
return {
"type": "session.update",
"session": {
"instructions": INSTRUCTIONS_BY_STATE[state],
"tools": TOOLS_BY_STATE[state] + [build_state_change_tool(state)]
}
}安全与升级
在实时语音智能体中,拥有可靠的人工升级途径很重要。在本节中,您应根据用例修改“何时”升级的指令。
- 何时使用:模型难以确定何时应正确升级到人工或后备系统。
- 作用:定义快速、可靠的升级机制及对应说法。
- 如何适配:插入您自己的阈值以及模型需要说的话。
示例
# Safety & Escalation
When to escalate (no extra troubleshooting):
- Safety risk (self-harm, threats, harassment)
- User explicitly asks for a human
- Severe dissatisfaction (e.g., “extremely frustrated,” repeated complaints, profanity)
- **2** failed tool attempts on the same task **or** **3** consecutive no-match/no-input events
- Out-of-scope or restricted (e.g., real-time news, financial/legal/medical advice)
What to say at the same time as calling the escalate_to_human tool (MANDATORY):
- “Thanks for your patience—I’m connecting you with a specialist now.”
- Then call the tool: `escalate_to_human`
Examples that would require escalation:
- “This is the third time the reset didn’t work. Just get me a person.”
- “I am extremely frustrated!”第一个示例展示了使用该指令的 gpt-4o-realtime-preview-2025-06-03 的对话响应。

第二个示例展示了使用该指令的 gpt-realtime-1.5 的对话响应。

gpt-realtime-1.5 能够遵循指令并更可靠地升级到人工。