Skip to content

Commit c89083e

Browse files
committed
Improve 20e example to ask the bot to give a recap when loading a previous conversation from disk
1 parent 6fa797c commit c89083e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

examples/foundational/20e-persistent-context-aws-nova-sonic.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@ async def _reset():
114114
# "content": f"{AWSNovaSonicLLMService.AWAIT_TRIGGER_ASSISTANT_RESPONSE_INSTRUCTION}",
115115
# }
116116
# )
117+
# If the last message isn't from the user, add a message asking for a recap
118+
if messages and messages[-1].get("role") != "user":
119+
messages.append(
120+
{
121+
"role": "user",
122+
"content": "Can you catch me up on what we were talking about?",
123+
}
124+
)
117125
params.context.set_messages(messages)
118126
await params.llm.reset_conversation()
119127
# await params.llm.trigger_assistant_response()

0 commit comments

Comments
 (0)