A voice-enabled AI assistant that helps track daily food consumption and nutrition information. Built using LiveKit's Agents Framework and Node.js.
This is a slightly modified version of the Node Multimodal Agent example.
- Voice-based interaction for natural conversation
- Track food consumption with nutritional information
- Record calories, protein, carbohydrates, and fats
- Get daily nutrition totals
- Persistent storage of food consumption data using SQLite
- Per-user data tracking based on LiveKit identity
Clone the repository and install dependencies:
pnpm install
Set up the environment by copying .env.example
to .env.local
and filling in the required values:
LIVEKIT_URL
LIVEKIT_API_KEY
LIVEKIT_API_SECRET
OPENAI_API_KEY
You can set up LiveKit-specific environment variables automatically using the LiveKit CLI:
lk app env
The application uses SQLite for data storage. To set up the database:
- Generate the Prisma client:
pnpm prisma generate
- Create and initialize the database with the schema:
pnpm prisma migrate dev
This will create a food_tracker.db
file in your project root.
To run the agent:
pnpm build
node dist/agent.js dev
Connect to the agent using a LiveKit-compatible frontend. You can:
- Tell the assistant what food you've eaten
- Include nutritional information if known (calories, protein, carbs, fats)
- Ask for your daily nutrition totals
The assistant will respond via voice and maintain a record of your food consumption.
Example interactions:
- "I just ate a banana, go ahead and guess the nutrition and add it"
- "I had a chicken breast with 200 calories and 30 grams of protein"
- "How much protein have I eaten today?"
- "How many calories have I eaten today?"
Nutrition data is stored and retrieved based on the user's LiveKit identity. To maintain persistent records:
- Use a consistent identity when connecting to LiveKit
- Ideally, use a verified token
- Different identities will track separate nutrition histories
This allows multiple users to maintain their own food tracking history in the same instance of the application.
- LiveKit Agents Framework
- OpenAI Realtime API
- Prisma ORM
- SQLite database
- TypeScript/Node.js