An AI-powered voice and text customer service assistant built with Streamlit, OpenAI, and LangChain.
- 🎤 Voice Input - Record audio or upload audio files (WAV/MP3)
- ⌨️ Text Input - Type messages directly
- 🔊 Text-to-Speech - AI responses are converted to audio
- 💬 Conversation History - Full chat history with context awareness
- 📊 Conversation Analysis - AI-powered analysis of customer interactions
- 🎯 Multiple Modes - Customer Service and Lead Generation personas
- Python 3.10+
- Poetry (recommended) or pip
- OpenAI API key
- PortAudio (for microphone recording on Linux)
-
Clone the repository
git clone <repository-url> cd conversational-audio-bot
-
Install system dependencies (Linux only - for microphone support)
sudo apt-get update && sudo apt-get install -y portaudio19-dev python3-dev -
Install Python dependencies
Using Poetry:
poetry install poetry shell
Or using pip:
python -m venv .venv source .venv/bin/activate # Linux/Mac # .venv\Scripts\activate # Windows pip install -e .
-
Configure environment variables
Create a
.envfile in the project root:OPENAI_API_KEY=your-openai-api-key-here SAMPLE_RATE=16000 LLM_MODEL=gpt-4
-
Run the application
streamlit run app.py
The app will open at
http://localhost:8501
- Go to the Voice Interaction tab
- Click Start Recording to record from your microphone (requires audio device)
- Or use Upload audio file to upload a WAV/MP3 file
- The audio is transcribed and the AI responds with text and audio
- Go to the Text Interaction tab
- Type your message and press Enter
- The AI responds with text and audio
- Have a conversation first
- Go to the Conversation Analysis tab
- Click Analyze Conversation to get AI insights
- Recording Duration - Adjust recording length (5-20 seconds)
- TTS Language - Choose English or Chinese
- Mode - Switch between Customer Service and Lead Generation
- Clear History - Reset conversation
This means no microphone is available. Common in WSL or remote environments.
- Solution: Use the file upload feature or text input instead
Run poetry install or pip install -e . to install dependencies.
Ensure your .env file has OPENAI_API_KEY (not OPEN_AI_KEY).
conversational-audio-bot/
├── app.py # Main Streamlit application
├── utils/
│ ├── audio_utils.py # Audio recording, processing, TTS
│ └── llm_utils.py # LLM integration with LangChain
├── pyproject.toml # Project dependencies (Poetry)
├── .env # Environment variables (create this)
├── README.md # This file
└── ARCHITECTURE.md # Detailed architecture documentation
See ARCHITECTURE.md for detailed technical documentation including:
- System architecture diagram
- Component details
- Data flow
- Configuration options
See LICENSE for details.