This project features a sample implementation of Hume's Empathic Voice Interface using Hume's Typescript SDK.
To run this project locally, ensure your development environment meets the following requirements:
To check the versions of pnpm
and Node.js
installed on a Mac via the terminal, you can use the following commands:
- For Node.js, enter the following command and press Enter:
node -v
This command will display the version of Node.js currently installed on your system, for example, v21.6.1
.
- For pnpm, type the following command and press Enter:
pnpm -v
This command will show the version of pnpm
that is installed, like 8.10.0
.
If you haven't installed these tools yet, running these commands will result in a message indicating that the command was not found. In that case, you would need to install them first. Node.js can be installed from its official website or via a package manager like Homebrew, and pnpm
can be installed via npm (which comes with Node.js) by running npm install -g pnpm
in the terminal.
Next you'll need to set your environment variables necessary for authentication. You'll need your API key and Secret key which are accessible from the portal. See our documentation on getting your api keys.
After obtaining your API keys, you need to set them as environment variables. A quick way to do this is to run the following commands, however the variables will be lost when the terminal window is closed or the computer is rebooted.
Note the VITE
prefix to the environment variables. This prefix is required for vite to expose the environment variable to the client. For more information, see the vite documentation on environment variables and modes.
VITE_HUME_API_KEY="<YOUR_API_KEY>"
VITE_HUME_SECRET_KEY="<YOUR_SECRET_KEY>"
VITE_HUME_CONFIG_ID="<YOUR_CONFIG_ID>" // optional
You can make these environment variables persistent by adding them to a file named .env
in the root folder of the repo.
There is an example file called
.env.example
. Create a.env
file, copy/paste the contents of the.env.example
file, and fill in your environment variables. The config ID is optional, however if a config is not specified EVI will be configured with the default configuration options.
Below are the steps to run the project locally:
- Run
pnpm i
to install required dependencies. - Run
pnpm build
to build the project. - Run
pnpm dev
to serve the project atlocalhost:5173
.
This implementation of Hume's Empathic User Interface (EVI) is minimal, using default configurations for the interface and a basic UI to authenticate, connect to, and disconnect from the interface.
- Click the
Start
button to establish an authenticated connection and to begin capturing audio. - Upon clicking
Start
, you will be prompted for permissions to use your microphone. Grant the permission to the application to continue. - Once permission is granted, you can begin speaking with the interface. The transcript of the conversation will be displayed on the webpage in realtime.
- Click
Stop
when finished speaking with the interface to stop audio capture and to disconnect the Web Socket.