faint-insurance-26243
05/08/2025, 11:01 AMtall-airline-16756
05/08/2025, 11:01 AMtall-airline-16756
05/08/2025, 11:01 AMinitial_ctx = llm.ChatContext().append(
role="system",
text=(
"You are a voice assistant created by LiveKit. Your interface with users will be voice. "
"You should use short and concise responses, and avoiding usage of unpronouncable punctuation."
),
)
This creates a new ChatContext object and appends a system message to it. The ChatContext can then be passed to a VoicePipelineAgent or other agent types when initializing them. Alternatively, you can create an empty context and add messages to it:
chat_ctx = llm.ChatContext.empty()
for item in chat_history:
chat_ctx.add_message(role=item["role"], content=item["content"])
Let me know if you need further assistance! Sources: Tree View: | dse-workbench | Tree View: | dse-workbench