How to get chat context in entrypoint?
# ask-ai
f
How to get chat context in entrypoint?
t
Thanks for reaching out, Akshay. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To get chat context in an entrypoint, you can use the following approach:
Copy code
initial_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:
Copy code
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