This project builds a chatbot that takes text or voice inputs. It uses OpenAI Whisper for transcribing audio, and OpenAI gpt-4o-mini for providing LLM responses in the chat. It uses Django REST Framework as the backend API, Streamlit for the UI, and the audio_recorder_streamlit
plugin for voice recording.
- Python 3.11 or higher
- Poetry (package manager)
- Git
The vt_demo
folder is the root folder for the Django project, the chatbot_app
is a Django app folder containing the core AI logic and related views, and the ui
folder contains the Streamlit frontend.
-
Clone the repository
git clone <repository-url> cd <project-directory>
-
Install Poetry (if not already installed)
curl -sSL https://install.python-poetry.org | python3 -
-
Install dependencies
poetry install
-
Set up environment variables: Create a
.env
file, add your OpenAI API key, and Django dev secret key.OPENAI_API_KEY="sk-..." DJANGO_SECRET_KEY="django-..."
-
Database Setup
poetry run python manage.py migrate
-
Split terminal: You can then run the backend in one, and the frontend in another.
-
Start the development backend server in one terminal
poetry run python manage.py runserver
The application will be available at
http://localhost:8000
-
Start the UI in the other terminal
poetry run streamlit run ui/streamlit_app.py
Navigate to
http://localhost:8501/admin
or whatever the link in the terminal suggests for the UI.
-
Create new migrations
poetry run python manage.py makemigrations
-
Run tests
poetry run python manage.py test
-
Install new dependencies
poetry add package-name
- Tests need updating mocking OpenAI is broken from latest changes.