Skip to content

Commit da31ceb

Browse files
committed
out of band responses
1 parent 8569953 commit da31ceb

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

articles/ai-services/openai/how-to/realtime-audio.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,37 @@ When the server responds with a [`response.done`](../realtime-audio-reference.md
172172
> [!IMPORTANT]
173173
> If you create any responses outside the default conversation, be sure to always check the `response.metadata` field to help you identify the corresponding response for the client-sent event. You should even check the `response.metadata` field for responses that are part of the default conversation. That way, you can ensure that you're handling the correct response for the client-sent event.
174174
175+
### Custom context for out-of-band responses
176+
177+
You can also construct a custom context that the model will use outside of the session's default conversation. To create a response with custom context, set the `conversation` field to `none` and provide the custom context in the `input` array. The `input` array can contain new inputs or references to existing conversation items.
178+
179+
```json
180+
{
181+
"type": "response.create",
182+
"response": {
183+
"conversation": "none",
184+
"modalities": ["text"],
185+
"prompt": "What is the capital of France?",
186+
"input": [
187+
{
188+
"type": "item_reference",
189+
"id": "existing_conversation_item_id"
190+
},
191+
{
192+
"type": "message",
193+
"role": "user",
194+
"content": [
195+
{
196+
"type": "input_text",
197+
"text": "The capital of France is Paris."
198+
},
199+
],
200+
},
201+
]
202+
}
203+
}
204+
```
205+
175206
## Voice activity detection (VAD) and the audio buffer
176207

177208
The server maintains an input audio buffer containing client-provided audio that has not yet been committed to the conversation state.

articles/ai-services/openai/realtime-audio-reference.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,11 +1100,11 @@ The server `session.updated` event is returned when a session is updated by the
11001100

11011101
| Field | Type | Description |
11021102
|-------|------|-------------|
1103-
| type | [RealtimeContentPartType](#realtimecontentparttype) | The content type (`input_text`, `input_audio`, `item_reference`, `text`).<br><br>A property of the `function` object. |
1104-
| text | string | The text content, used for `input_text` and `text` content types. |
1105-
| id | string | ID of a previous conversation item to reference (for `item_reference` content types in `response.create` events). These can reference both client and server created items. |
1106-
| audio | string | Base64-encoded audio bytes, used for `input_audio` content type. |
1107-
| transcript | string | The transcript of the audio, used for `input_audio` content type. |
1103+
| type | [RealtimeContentPartType](#realtimecontentparttype) | The content type.<br><br>A property of the `function` object.<br/><br>Allowed values: `input_text`, `input_audio`, `item_reference`, `text`. |
1104+
| text | string | The text content. This property is applicable for the `input_text` and `text` content types. |
1105+
| id | string | ID of a previous conversation item to reference in both client and server created items. This property is applicable for the `item_reference` content type in `response.create` events. |
1106+
| audio | string | The base64-encoded audio bytes. This property is applicable for the `input_audio` content type. |
1107+
| transcript | string | The transcript of the audio. This property is applicable for the `input_audio` content type. |
11081108

11091109
### RealtimeContentPartType
11101110

0 commit comments

Comments
 (0)