Back to Templates

Voice AI

AI
Free for Pro

A helpful template for building voice assistant apps with Groq and cool & creative UI. Built with expo-audio, react-native-reanimated, and Groq APIs.

Project structure

Where things live

All details included in the app readme with deeper details.

voice-assistant/ in detail

  • VoiceAssistant.tsx — Main component. Flow states: idlestartinglisteningpost_recordingwaiting_for_aiai_responding. Uses hooks from hooks/, constants from constants/, and formatTime from utils/voice-recording.
  • Visuals: IdleFourCircles, ListeningMetering, ThoughtBubbleAnimation, RespondingMeteringCircle.

Groq integration

Three Groq APIs are used; all share one API key (EXPO_PUBLIC_GROQ_API_KEY).

1. Transcription (Speech-to-Text)

  • Model: whisper-large-v3-turbo (default)
  • Flow: After recording, the audio URI is sent via transcribe(uri)FormData with file and model; response is verbose_json. The returned text is passed to chat.

2. Chat (LLM reply)

  • Model: llama-3.1-8b-instant (default)
  • Flow: Transcribed text is sent with complete(userMessage). System prompt asks for short, conversational replies (1–3 sentences for voice). max_tokens: 150, temperature: 0.7. The returned text is passed to TTS.

3. Text-to-Speech (TTS)

  • Model: canopylabs/orpheus-v1-english (default), voice hannah
  • Flow: Chat reply text is sent with speak(text) → response is binary (WAV). It’s base64-encoded and written to cache with expo-file-system; the file path is passed to the expo-audio player.

Setup and run

  1. Install dependencies:

    bash
    npm install
  2. Groq API key:

    bash
    cp .env.example .env

    In .env:

    EXPO_PUBLIC_GROQ_API_KEY=your_key_here
  3. Start the dev server (restart after changing .env):

    bash
    npx expo start

A detailed readme included in the zip file.

Tags

audio
ai
groq