Chat History
Guide to accessing chat history with the EVI.
EVI captures detailed histories of conversations, allowing developers to review and analyze past interactions. This guide provides an overview of Chats and Chat Groups, instructions for retrieving chat transcripts and expression measurements, and steps to access reconstructed audio.
If data retention is disabled, Chat history will not be recorded, and previous Chat data and audio reconstruction will not be retrievable.
Chats vs Chat Groups
EVI organizes conversation history into Chats and Chat Groups.
- Chats: Represents a single session from the moment a WebSocket connection is established until it disconnects. Each Chat contains messages and events recorded during that specific session.
- Chat Groups: Links related chats to provide continuity across interactions. A group can contain one or more chats, allowing ongoing conversations to be tracked even when users reconnect to continue from a previous interaction.
When a new Chat session begins, it creates a new Chat Group by default. However, if the Chat resumes a previous session, it is added to the existing Chat Group, ensuring the conversation’s history and context are preserved across multiple Chats.
Fetching Chats and Chat Groups
Each Chat has a unique ID and a chat_group_id
field that links it to its associated Chat Group. Similarly,
each Chat Group has its own unique ID, enabling the retrieval of individual sessions or entire groups of related
sessions.
-
Chat ID: To obtain a Chat ID, use the list Chats endpoint. This ID allows you to retrieve details of individual sessions or resume a previous Chat. See sample code for fetching Chats below:
-
Chat Group ID: Each Chat includes a
chat_group_id
field, which identifies the Chat Group it belongs to. To obtain a Chat Group ID directly, use the list Chat Groups endpoint. This ID is useful for accessing all Chats linked to a single conversation that spans multiple sessions. See sample code for fetching Chats below:
While you can retrieve these IDs using the API, the Chat and Chat Group IDs are also included at the start of every Chat session in a chat_metadata message. This is particularly useful if your integration needs to associate data or actions with Chats as they are initiated.
Viewing Chats in the Platform UI
You can also view chat history and obtain Chat IDs through the Platform UI:
-
Go to the Chat history page for a paginated list of past Chats, each displaying key details like the Chat ID, datetime, event count, and duration.
-
Click “Open” on any Chat to view its details. The details page includes information such as status, start and end timestamps, duration, the Chat ID, Chat Group ID, associated Config ID (if any), and a paginated list of Chat Events.
Chat Events
During each Chat session, EVI records events that detail interactions between the user and the system. These events provide a complete record of user input, assistant responses, tool usage, and system commands, enabling developers to review transcripts, analyze activity, and extract expression measurements. Below is the complete list of WebSocket messages recorded as Chat Events:
- user_message: Transcriptions of the user’s spoken input, with expression measures of the user’s voice.
- user_interruption: Instances where the user interrupts EVI’s speech.
- assistant_message: Transcriptions of EVI’s responses.
- tool_call_message: Records when a tool is invoked during the conversation.
- tool_response_message: Responses from tools that were invoked during the session.
- pause_assistant_message: Commands to pause EVI’s responses.
- resume_assistant_message: Commands to resume EVI’s responses after a pause.
These events cannot be modified and represent an immutable record of the conversation for transcription and analysis purposes.
Fetching Chat Events
The Chat Events API provides endpoints to fetch events for a specific Chat or a Chat Group, allowing developers to retrieve detailed session data. Below are examples of how to use these endpoints:
Fetching chat events for a specific Chat
Use the /chats/{chat_id}/events endpoint to fetch events for a single Chat:
Fetching events for a specific Chat Group
Use the /chat_groups/{chat_group_id}/events endpoint to fetch events from all Chats within a specific Chat Group:
Parsing Chat Events
Chat Events provide a detailed record of interactions during a Chat session, capturing both transcriptions and expression measurement predictions. This section demonstrates how to process these events to generate readable transcripts and analyze emotional trends.
For sample code demonstrating how to fetch and parse Chat Events, explore our example projects in TypeScript and Python.
Chat transcription
Transcriptions of a conversation are stored in user_message
and assistant_message
events. These events include the
speaker’s role and the corresponding text, allowing you to reconstruct the dialogue into a readable format.
For instance, you may need to create a transcript of a conversation for documentation or analysis. Transcripts can help review user intent, evaluate system responses, or provide written records for compliance or training purposes.
The following example demonstrates how to extract the Chat transcription from a list of Chat Events and save
it as a text file named transcription_<CHAT_ID>.txt
:
Expression measurement
Expression measurement predictions are stored in the user_message
events under the models.prosody.scores
property.
These predictions provide confidence levels for various emotions detected in the user’s speech.
For example, you might want to gauge the emotional tone of a conversation to better understand user sentiment. This information can guide customer support strategies or highlight trends in the expression measurement predictions over time.
The following example calculates the top 3 emotions from the user_messages
by averaging their emotion scores across
the Chat session: