This guide will help you get the Clinical ChatBot up and running in 10 minutes.
Make sure you have:
- Python 3.10+ installed
- Node.js 18+ installed
- OpenAI API key (Get one here)
- Pinecone account (Sign up here)
cd Clinical-ChatBotcd backend
python -m venv venv
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activatepip install -r requirements.txtCreate .env file:
# On Windows:
copy .env.example .env
# On macOS/Linux:
cp .env.example .envEdit .env and add your credentials:
# OpenAI Configuration
OPENAI_API_KEY=sk-your-openai-api-key-here
# Pinecone Configuration
PINECONE_API_KEY=your-pinecone-api-key-here
PINECONE_ENVIRONMENT=us-east-1-aws
PINECONE_INDEX_NAME=clinical-chatbot
# Security (generate a random string)
SECRET_KEY=your-secret-key-here-change-in-productionpython -m app.mainYou should see:
INFO: Uvicorn running on http://0.0.0.0:8000
Open a new terminal window:
cd frontendnpm installCreate .env.local file:
# On Windows:
copy .env.local.example .env.local
# On macOS/Linux:
cp .env.local.example .env.localThe default configuration should work:
NEXT_PUBLIC_API_URL=http://localhost:8000npm run devYou should see:
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
-
Open your browser and navigate to:
http://localhost:3000 -
You should see the Clinical AI Assistant interface
-
Try asking a question:
What are the common symptoms of hypertension? -
The AI will respond (without RAG if no documents are uploaded yet)
To enable RAG with clinical documents:
-
Prepare a PDF file with clinical content (e.g., medical guidelines)
-
Click the upload button in the interface
-
Select your PDF file
-
Wait for processing (you'll see chunk count)
-
Now ask questions related to the document content
-
Toggle "Use RAG" to enable document-based responses
Visit: http://localhost:8000/api/health
You should see:
{
"status": "healthy",
"version": "1.0.0",
"pinecone_connected": true,
"openai_connected": true
}Visit: http://localhost:8000/api/docs
You'll see the interactive Swagger UI documentation.
Solution:
- Verify your Pinecone API key is correct
- Check the environment/region matches your Pinecone account
- Ensure the index name doesn't conflict with existing indexes
Solution:
- Verify your OpenAI API key is correct
- Check you have sufficient credits in your OpenAI account
- Ensure you have access to GPT-4 (or change to GPT-3.5 in code)
Solution:
- Verify backend is running on port 8000
- Check NEXT_PUBLIC_API_URL in
.env.local - Verify CORS settings in backend allow
http://localhost:3000
Solution:
- Ensure virtual environment is activated (backend)
- Run
pip install -r requirements.txtagain - For frontend, run
npm installagain
Now that your application is running:
- Upload Documents: Add clinical guidelines and reference materials
- Test RAG: Ask questions related to uploaded documents
- Explore API: Check out the API documentation
- Run Tests: Execute
pytestin backend,npm testin frontend - Customize: Modify the theme, prompts, or add features
cd backend
pytestExpected output:
===== test session starts =====
collected 20 items
tests/test_rag_engine.py ............ [60%]
tests/test_document_processor.py .... [80%]
tests/test_api_chat.py .... [100%]
===== 20 passed in 5.23s =====
cd frontend
npm testIf you prefer Docker:
# From project root
docker-compose upThis will start both backend and frontend in containers.
Before deploying to production:
-
Security:
- Change SECRET_KEY to a strong random value
- Use HTTPS
- Implement authentication
- Set up rate limiting
-
Environment:
- Set
APP_ENV=production - Configure proper CORS origins
- Set up logging
- Set
-
Performance:
- Use production build for frontend (
npm run build) - Consider Redis for conversation memory
- Set up CDN for static assets
- Use production build for frontend (
-
Monitoring:
- Set up error tracking (e.g., Sentry)
- Configure logging
- Monitor API usage
- Check the README.md for detailed documentation
- Review ARCHITECTURE.md for system design
- Check API docs at
http://localhost:8000/api/docs - Review error logs for debugging
You now have a fully functional Clinical AI ChatBot running locally! 🎉
Start chatting with the AI assistant and explore its capabilities.