Guide to preserving context from previous Chat sessions.

EVI supports reconnecting to an ongoing chat session, preserving all prior conversation context. This is especially useful in cases of unexpected network failures or when a user wishes to pick up the conversation at a later time, enabling continuity without losing progress.

If data retention is disabled, the ability to resume chats will not be supported.

Resuming a chat

See steps below for how to resume a chat:

  1. Establish initial connection: Make the initial handshake request to establish the WebSocket connection. Upon successful connection, you will receive a ChatMetadata message:

    Chat metadata
    1{
    2 "type": "chat_metadata",
    3 "chat_group_id": "8859a139-d98a-4e2f-af54-9dd66d8c96e1",
    4 "chat_id": "2c3a8636-2dde-47f1-8f9e-cea27791fd2e"
    5}
  2. Store the ChatGroup reference: Save the chat_group_id from the ChatMetadata message for future use.

  3. Resume chat: To resume a chat, include the stored chat_group_id in the resumed_chat_group_id query parameter of subsequent handshake requests.

    1"use client";
    2import { VoiceProvider } from "@humeai/voice-react";
    3
    4export default function ClientComponent({
    5 accessToken,
    6}: {
    7 accessToken: string;
    8}) {
    9 return (
    10 <VoiceProvider
    11 auth={{ type: "accessToken", value: accessToken }}
    12 resumedChatGroupId='<YOUR_CHAT_GROUP_ID>'
    13 >
    14 // ...etc.
    15 </VoiceProvider>
    16 );
    17}

    When resuming a chat, you can specify a different EVI configuration than the one used in the previous session. However, changing the system prompt or supplemental LLM may result in unexpected behavior from EVI.


Built with