[Unit]
Description=RAG Bot
After=network.target

[Service]
Type=simple
WorkingDirectory=/home/sandhiya/Pubmed-Automation-Bot/V1/rag-bot
EnvironmentFile=/home/sandhiya/Pubmed-Automation-Bot/V1/rag-bot/.env
# Optional envs (you can also keep them in .env)
Environment=CUDA_VISIBLE_DEVICES=0
Environment=HF_HOME=/home/sandhiya/.cache/huggingface
Environment=TRANSFORMERS_CACHE=/home/sandhiya/.cache/huggingface/transformers
Environment=TOKENIZERS_PARALLELISM=false
User=sandhiya
Group=sandhiya

# Use THE SAME venv uvicorn your status shows
ExecStart=/home/sandhiya/Pubmed-Automation-Bot/V1/rag-bot/.venv/bin/uvicorn app.main:app --host 127.0.0.1 --port 8000 --workers 1 --log-level info

Restart=on-failure
RestartSec=5

[Install]
WantedBy=multi-user.target

Save (Ctrl+O, Enter) and exit (Ctrl+X).
Reload systemd & restart:

sudo systemctl daemon-reload
sudo systemctl restart ragbot.service
sudo systemctl status ragbot.service

