Welcome to the Chatbot Application project, a complete AI-powered chatbot solution featuring a robust backend and multiple user interfaces. This project demonstrates the seamless integration of machine learning capabilities and user-friendly interfaces, making it an excellent addition to any portfolio.
This project consists of two main components and interfaces:
Backend (Chatbot folder):
User Interfaces:
config.py and .env filesBackend:
Frontend:
Development Tools:
The easiest way to get started is using our PowerShell automation script:
Clone the repository:
git clone https://github.com/miracle5284/dash-fastapi-chatbot-llamaindex.git cd dash-fastapi-chatbot-llamaindex
Run the automation script:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser .\run_chatbot.ps1
The script will automatically:
To stop the application:
Ctrl+C in the terminal running the serversIf you prefer manual setup or are using a different operating system:
Install Python 3.12:
python --version
Create and activate a virtual environment:
# Create virtual environment python -m venv venv # Activate virtual environment # On Windows: .\venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
Set up environment variables:
.env file with:
OPENAI_API_KEY=your_api_key_here
OPENAI_MODEL_NAME=gpt-3.5-turbo
Start the servers:
# Start FastAPI server uvicorn chatbot.server:app --reload # Start Dash UI (in another terminal) python chatbot-ui/dash-chat-ui.py
Access the interfaces:
http://127.0.0.1:5500
http://127.0.0.1:8050
Choose your interaction mode:
Enter your queries and receive intelligent responses
To stop the application:
Ctrl+C on both terminal running the serversNote: The PowerShell automation script (run_chatbot.ps1) is configured to launch the ChatGPT-only interface by default. To use the RAG-powered FAQ interface, you'll need to run:
python chatbot/dash-ui.py
chatbot/
├── chatbot/ # Backend code
│ ├── config.py # Configuration settings
│ ├── server.py # Main server script
│ ├── indexing.py # Document indexing utilities
│ ├── schemas.py # Data models
│ ├── utils.py # Helper functions
│ └── documents/ # Input documents (e.g., PDFs)
├── chatbot-ui/ # Frontend code
│ ├── dash-chat-ui.py # ChatGPT interface
│ ├── styles.py # UI styling
│ └── config.py # Frontend configuration
├── run_chatbot.ps1 # Windows automation script
├── .env # Environment variables
├── README.md # Project documentation
└── requirements.txt # Python dependencies
Below is an example of the Chatbot UI in action:
The application can be configured through several files:
Environment Variables (.env file):
OPENAI_API_KEY=your_api_key_here
OPENAI_MODEL_NAME=gpt-3.5-turbo
Server Configuration (chatbot-ui/config.py):
System Prompt (system_prompt.txt):