Resuming Chats | Hume API
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:
- Establish initial connection: Make the initial handshake request to establish the WebSocket connection. Upon successful connection, you will receive a ChatMetadata message:
{
"type": "chat_metadata",
"chat_group_id": "8859a139-d98a-4e2f-af54-9dd66d8c96e1",
"chat_id": "2c3a8636-2dde-47f1-8f9e-cea27791fd2e"
}
Store the ChatGroup reference: Save the chat_group_id from the
ChatMetadatamessage for future use.Resume chat: To resume a chat, include the stored
chat_group_idin the resumed_chat_group_id query parameter of subsequent handshake requests.
"use client";
import { VoiceProvider } from "@humeai/voice-react";
export default function ClientComponent({
accessToken,
}: {
accessToken: string;
}) {
return (
<VoiceProvider
auth={{ type: "accessToken", value: accessToken }}
resumedChatGroupId='<YOUR_CHAT_GROUP_ID>'
>
// ...etc.
</VoiceProvider>
);
}
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.