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:idle→starting→listening→post_recording→waiting_for_ai→ai_responding. Uses hooks fromhooks/, constants fromconstants/, andformatTimefromutils/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)→FormDatawithfileandmodel; response isverbose_json. The returnedtextis 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), voicehannah - Flow: Chat reply text is sent with
speak(text)→ response is binary (WAV). It’s base64-encoded and written to cache withexpo-file-system; the file path is passed to theexpo-audioplayer.
Setup and run
-
Install dependencies:
bashnpm install -
Groq API key:
- Get a key from console.groq.com.
- Copy
.env.exampleto.envand set the key:
bashcp .env.example .envIn
.env:EXPO_PUBLIC_GROQ_API_KEY=your_key_here -
Start the dev server (restart after changing
.env):bashnpx expo start
A detailed readme included in the zip file.