chapter ten
10 Building a Voice-Enabled AI Chat Application
This chapter covers
- The architecture of a voice AI pipeline: microphone to LLM response
- Connecting MLX Whisper to Streamlit using st.audio_input()
- Refactoring the app into clean, reusable functions
- Adding a text fallback so the app works with keyboard input too
- Testing the full voice conversation loop end to end
- Understanding what makes this application challenging and how to extend it
This is the chapter where everything comes together. Over the previous chapters, you learned how to use the terminal, install Ollama, pull AI models, write Python, call the Ollama API, build web interfaces with Streamlit, and transcribe speech with MLX Whisper. In this chapter, you combine all of those skills into a voice-enabled AI chat application: speak into your microphone, watch your words become text, and receive a streaming AI response -- all running locally on your Mac, with complete privacy. Continue working in the same my-ai-chatbot folder you used earlier; this chapter adds voice_chat.py beside the voice_input.py file from Chapter 9.