Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions examples/Context_summarization_with_realtime_api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,14 @@
" return resp.choices[0].message.content.strip()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Important implementation detail:\n",
"- 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."
]
},
{
"cell_type": "code",
"execution_count": 11,
Expand Down Expand Up @@ -367,8 +375,8 @@
" \"item\": {\n",
" \"id\": summary_id,\n",
" \"type\": \"message\",\n",
" \"role\": \"assistant\",\n",
" \"content\": [{\"type\": \"text\", \"text\": summary_text}],\n",
" \"role\": \"system\",\n",
" \"content\": [{\"type\": \"input_text\", \"text\": summary_text}],\n",
" },\n",
" }))\n",
"\n",
Expand Down
Loading