How sanjay-adtani/ai-healthbot-voice-agent works
Project type and purpose
• This is a single‐page, voice-enabled frontend application built with React, TypeScript, and Vite.
• It serves as a virtual “General Physician AI” chat interface, using speech‐to‐text (AssemblyAI) and AI responses (Google Gemini) via Vapi.ai.
File structure
• Top-level files:
• package.json / package-lock.json → npm dependencies
• vite.config.ts, tsconfig*.json → build & TypeScript config
• index.html → application entry point
• env.example → environment variables for API keys
• public/ → static assets (e.g., favicon, images)
• src/ → application source
• main.tsx → React app bootstrap
• App.tsx / App.css → root component & styles
• components/AiCall.tsx → handles the voice API integration
• assets/ → images/fonts, etc.
• index.css → global styles
Extract insights from the README
• Core tech: React + TypeScript + Vite
• External services: Vapi.ai (voice agent), AssemblyAI (STT), Google Gemini (LLM)
• Flow: user speaks → AssemblyAI transcribes → Vapi.ai routes to Google Gemini → response back to user
a. Main components
1. Browser / React SPA
2. Audio‐capture & UI module
3. AssemblyAI Speech-to-Text service
4. Vapi.ai Voice Agent Platform
5. Google Gemini LLM
6. Environment Variable Store (VITE_VAPI_API_KEY, VITE_VAPI_ASSISTANT_ID)
7. Vite Dev/Build Server (for local development)
b. Relationships & data flows
• User speaks into microphone → React Audio Module
• Audio Blob → AssemblyAI API → returns transcript
• Transcript + context → Vapi.ai REST/WebSocket → Vapi routes to Google Gemini
• Google Gemini returns text response → Vapi.ai → React UI
• (Optional) Text response → Browser TTS engine → user hears reply
c. Architectural patterns & design principles
• Single‐Page Application (SPA) pattern
• Separation of concerns: UI vs. external AI services
• Config via environment variables (no secrets in code)
• Lightweight, API‐driven micro‐service integration
d. Key technologies & libraries
• React, TypeScript, Vite (frontend framework & build tool)
• AssemblyAI SDK / REST API (speech‐to‐text)
• Vapi.ai SDK / REST or WebSocket (voice agent orchestration)
• Google Gemini API (LLM responses)