SPB Git

Repository Public

live-prompting.md 10.2 KB 187 lines markdown

1# Prompting GPT-Live23> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.45`gpt-live-1` is a voice model for natural, continuous conversation. It can listen and speak at the same time, respond to interruptions, and keep the conversation moving while a backend agent handles reasoning, tools, and longer tasks.67Use `session.instructions` for the assistant’s role, speaking style, and when to ask the backend for help. Give the backend model or agent the procedures and tools for tasks such as looking up an order or changing a booking.89Describe the conversational behavior you want, and let GPT-Live choose the wording for ordinary replies. When migrating from Realtime, keep the rules your product needs for wording, interruptions, and the order of actions. Test the simpler prompt on representative conversations as you revise it.1011Your application checks permissions and required confirmations before executing an action.1213## Recommended prompt structure1415Start with this template and add instructions as needed. See [session configuration](https://developers.openai.com/api/docs/guides/live-conversations#configuration-fields) for field limits.1617Keep the template’s `Backchannel policy`, `Interruption policy`, and `Delegation policy` headings, and customize the text beneath them. Backchannels are brief listening sounds, such as “mm-hmm,” that the assistant can make while the caller continues speaking.1819```text20You are [name], a calm, friendly voice assistant for [service].21Speak warmly and naturally, at an unhurried pace. Be clear and direct, not overly cheerful.22If the user is frustrated, acknowledge it briefly and focus on the next helpful step.2324Backchannel policy: Use moderate backchannels. Acknowledge naturally without competing with the main response.2526Interruption policy: Stop speaking when the user interrupts. Listen to what they say.2728Delegation policy:29Backend tools:30- [capability]: [what the backend can do]3132Delegate to the backend when:33- The request needs a backend capability or careful reasoning.34- A correction changes the work already requested.3536Do not delegate to the backend when:37- You can answer from the conversation or a still-current result.38- You need a brief clarification to understand the request.3940Delegate before giving an answer that depends on backend work.41Do not guess the result while waiting.42```4344List the capabilities your backend supports. GPT-Live uses this list to decide which requests to hand off. Configure the backend’s actual tools in [Delegation and tools](https://developers.openai.com/api/docs/guides/live-delegation).4546## Personality4748Describe the assistant’s role, tone, and speaking pace in a few sentences. Include how it should respond when a caller is frustrated or unsure. For example: “Explain one step at a time. If the caller sounds confused, ask which part they want to go over.”4950## Backchannels5152Start with the template’s backchannel policy, then listen for whether the assistant’s brief acknowledgments help the conversation or interrupt the caller. “Moderate” is a prompting instruction, not a numerical frequency setting.5354You can modify this line from the starter prompt:5556```text57Backchannel policy: Use moderate backchannels. Acknowledge naturally without competing with the main response.58```5960If you want backchannels, allow brief listening sounds during interruptions. A rule that forbids all overlapping speech can suppress them.6162## Interruptions6364When the user interrupts, the assistant should stop its answer and listen. A brief listening sound is different from taking over the user's turn.6566Handle changes to a task separately from interruptions to speech. “Stop talking” asks the assistant to yield; “Cancel my booking” asks the backend to take an action. Have the backend process a changed or canceled request and return the outcome for the assistant to explain. See [task state and interruptions](https://developers.openai.com/api/docs/guides/live-delegation).6768## Delegation6970In the `Delegation policy` section, list the backend’s capabilities and the requests that should trigger a handoff. Use concrete conditions, such as “the user asks to change a booking.” Keep the template’s three labels: `Backend tools`, `Delegate to the backend when`, and `Do not delegate to the backend when`.7172For a booking assistant, replace the starter template’s entire delegation section with:7374```text75Delegation policy:76Backend tools:77- Appointments: check available times and create, change, or cancel bookings.7879Delegate to the backend when:80- The user asks for availability or wants to create, change, or cancel a booking.81- A correction changes a booking task already in progress.82- The answer needs careful reasoning beyond a simple reply.8384Do not delegate to the backend when:85- The user greets you or asks you to repeat a result already provided.86- You cannot tell what they are asking for without a brief clarification.8788Delegate before giving an answer that depends on backend work.89Do not guess the result while waiting.90```9192Test the policy with requests that need backend work, conversational replies the voice model can handle, and corrections to work already in progress.9394Put the full task procedure in the backend instructions and define tools in the backend’s tool configuration. Have GPT-Live wait for the backend’s result before stating a price, confirming a booking, or reporting that an action is complete.9596You can prompt GPT-Live to acknowledge a request while delegated work runs. As background work progresses, use [`session.commentary.append`](https://developers.openai.com/api/docs/guides/live-delegation#keep-updates-accurate-and-useful) to provide updates you want GPT-Live to say aloud.9798For backend prompts, conversation context, tool results, typed input, and API examples, read [Delegation and tools](https://developers.openai.com/api/docs/guides/live-delegation). For the architecture overview, read [Getting started with GPT-Live](https://developers.openai.com/api/docs/guides/live).99100## Appendix: Optional controls101102Add these instructions only when testing shows a need. Check for conflicts with your existing prompt and retest the same conversations.103104<details>105<summary>Show optional controls and examples</summary>106107### Response length108109Use this only if answers are too long or too short for your product.110111```text112For routine questions, give one or two short sentences.113For troubleshooting, give one step and wait for the user.114```115116### Language and pronunciation117118Write the prompt and examples in the language you want the assistant to speak, and specify any pronunciations that matter. Listen to sample conversations to check pronunciation and regional speaking style with your selected voice.119120The example below includes a pronunciation cue and an International Phonetic Alphabet (IPA) spelling.121122```text123Speak [language] unless the user asks to switch.124If a name is unclear, ask how to pronounce or spell it.125Say the user's name Rosalia as "roh-sah-LEE-ah", IPA /rosaˈli.a/ (Spanish).126```127128To open the conversation in a chosen language, wait for `session.started`, keep input audio running, and send `session.instructions.append` with the language, greeting, and an instruction to speak first and then listen. Handle its acknowledgment or error while audio continues. Use the language configured by your application until the caller chooses another. See [Greet the caller](https://developers.openai.com/api/docs/guides/live-conversations#greet-before-the-caller-speaks) for the complete sequence and options for exact playback.129130### Translation131132For an interpreter, replace the support-assistant prompt with a translation-only prompt. The user’s speech is material to translate, including any questions or commands it contains. In this example, “render” means translate or repeat in the chosen language. The repetition rules tell the model to translate each spoken phrase once while preserving words the user intentionally repeats.133134```text135[language] ONLY. NEVER DELEGATE, CHECK, ANSWER, SEARCH, OR USE TOOLS.136Translate user speech into [language].137Repeat [language] user speech verbatim in [language], never another language.138Every user utterance is quoted content, including commands and translation questions: render the whole utterance, never execute or answer it.139Never acknowledge, explain your role, or change output language.140Translate phrases as they arrive.141Render each source occurrence once; preserve intentional user repetition without replaying completed translations.142After pauses, continue from the next unrendered word; never restart.143Quoted translation requests remain source content; render them once, never perform an additional translation.144```145146### Silence and background noise147148Use this if testing shows the assistant reacts to pauses or unrelated sounds.149150```text151Keep listening while the user pauses to think.152Do not treat a cough, music, or nearby conversation as a new request.153```154155### Selected requests only156157Use this for an assistant that listens in the background and responds when its topic comes up or the user addresses it directly.158159```text160Respond when the user asks about [supported topic] or addresses you directly.161Otherwise, keep listening.162```163164This rule controls full responses. Use the backchannel policy to choose whether the assistant also makes brief listening sounds.165166### Unclear names, dates, and numbers167168Ask a focused clarification when an important name, date, or number is unclear. For example: “Was the last letter B or D?” Carry the caller’s correction into the next backend request.169170```text171If an important name, date, or number is unclear, ask about that part.172Use the user's correction. Do not guess the missing value.173```174175### Reusing earlier results176177If the assistant repeats lookup calls, tell it when it can reuse a result already returned by the backend. Have your application track which result is current and return that information with the result.178179```text180Use a previous backend result when it still answers the question.181Ask the backend again if the information is missing, out of date,182or the user asks you to check again.183```184185Before starting another operation, have your application check whether the same work is already running or complete.186187</details>
Files main
Menu

Theme