Skip to content

Commit 4e46e36

Browse files
added prompt migration notebook (openai#1919)
1 parent 2ee99be commit 4e46e36

File tree

4 files changed

+915
-4
lines changed

4 files changed

+915
-4
lines changed

examples/Context_summarization_with_realtime_api.ipynb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,14 @@
333333
" return resp.choices[0].message.content.strip()"
334334
]
335335
},
336+
{
337+
"cell_type": "markdown",
338+
"metadata": {},
339+
"source": [
340+
"Important implementation detail:\n",
341+
"- The summary is appended as a SYSTEM message rather than an ASSISTANT message. Testing revealed that, during extended conversations, using ASSISTANT messages for summaries can cause the model to mistakenly switch from audio responses to text responses. By using SYSTEM messages for summaries (which can also include additional custom instructions), we clearly signal to the model that these are context-setting instructions, preventing it from incorrectly adopting the modality of the ongoing user-assistant interaction."
342+
]
343+
},
336344
{
337345
"cell_type": "code",
338346
"execution_count": 11,
@@ -367,8 +375,8 @@
367375
" \"item\": {\n",
368376
" \"id\": summary_id,\n",
369377
" \"type\": \"message\",\n",
370-
" \"role\": \"assistant\",\n",
371-
" \"content\": [{\"type\": \"text\", \"text\": summary_text}],\n",
378+
" \"role\": \"system\",\n",
379+
" \"content\": [{\"type\": \"input_text\", \"text\": summary_text}],\n",
372380
" },\n",
373381
" }))\n",
374382
"\n",

0 commit comments

Comments
 (0)