This project demonstrates how to:
- Retrieve all chat events for a specified Chat ID from Hume's Empathic Voice Interface (EVI) using the TypeScript SDK.
- Parse user and assistant messages to produce a formatted chat transcript.
- Compute the top three average emotion scores from user messages.
Key Features:
- Transcript generation: Outputs a human-readable
.txt
file capturing the conversation between user and assistant. - Top 3 emotions: Identifies the three emotions with the highest average scores across all user messages.
Ensure your environment meets the following requirements:
- Poetry: Version
1.7.1
or higher
Check versions on macOS:
poetry --version
If you need to update or install Poetry, visit the official Poetry website.
- Obtain Your API Key: Follow the instructions in the Hume documentation to acquire your API key.
- Create a
.env
File: In the project's root directory, create a.env
file if it doesn't exist. Add your API key:
HUME_API_KEY="<YOUR_API_KEY>"
Refer to .env.example
as a template.
In the main function within main.oy
, set the CHAT_ID
variable to the target conversation ID:
async def main():
# Replace with your actual Chat ID
CHAT_ID = "<YOUR_CHAT_ID>"
# ...
This determines which Chat's events to fetch and process.
- Install dependencies:
poetry install
- Run the project:
poetry run python main.py
- The script fetches all events for the specified
CHAT_ID
. - It generates a
transcript_<CHAT_ID>.txt
file containing the user and assistant messages with timestamps. - It logs the top 3 average emotions to the console:
Top 3 Emotions: {'Joy': 0.7419108072916666, 'Interest': 0.63111979166666666, 'Amusement': 0.63061116536458334}
(These keys and scores are just examples; the actual output depends on the Chat's content.)