shwetangisingh commited on
Commit
035798d
Β·
1 Parent(s): fd77577

added a setup script

Browse files
Files changed (2) hide show
  1. .env.example +1 -1
  2. setup.sh +73 -0
.env.example CHANGED
@@ -18,7 +18,7 @@ FALLBACK_BASE_URL=http://<GCP_IP>:8000/v1
18
 
19
  # ── Local Ollama (dev) ────────────────────────────────────────────────────────
20
  LOCAL_BASE_URL=http://localhost:11434/v1
21
- LOCAL_MODEL=gemma4:31b-cloud # qwen3:8b qwen3.5:397b-cloud
22
 
23
  # ── MLflow ────────────────────────────────────────────────────────────────────
24
  MLFLOW_TRACKING_URI=mlruns
 
18
 
19
  # ── Local Ollama (dev) ────────────────────────────────────────────────────────
20
  LOCAL_BASE_URL=http://localhost:11434/v1
21
+ LOCAL_MODEL=gemma4:31b-cloud
22
 
23
  # ── MLflow ────────────────────────────────────────────────────────────────────
24
  MLFLOW_TRACKING_URI=mlruns
setup.sh ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ CONDA_ENV="aac-chatbot"
5
+ ENV_FILE=".env"
6
+ ENV_EXAMPLE=".env.example"
7
+
8
+ info() { printf "\033[1;34m==> %s\033[0m\n" "$1"; }
9
+ ok() { printf "\033[1;32m==> %s\033[0m\n" "$1"; }
10
+ warn() { printf "\033[1;33m==> %s\033[0m\n" "$1"; }
11
+ fail() { printf "\033[1;31mERROR: %s\033[0m\n" "$1"; exit 1; }
12
+
13
+ # ── Pre-flight: conda ────────────────────────────────────────────────────────
14
+ command -v conda >/dev/null 2>&1 || fail "conda not found. Install Miniconda/Anaconda first."
15
+
16
+ # ── Conda environment ────────────────────────────────────────────────────────
17
+ if conda info --envs | grep -q "^${CONDA_ENV} "; then
18
+ info "Conda env '$CONDA_ENV' already exists β€” reusing it"
19
+ else
20
+ info "Creating conda env '$CONDA_ENV' (Python 3.12)..."
21
+ conda create -n "$CONDA_ENV" python=3.12 -y --quiet
22
+ ok "Conda env created"
23
+ fi
24
+
25
+ # Activate inside this script
26
+ eval "$(conda shell.bash hook)"
27
+ conda activate "$CONDA_ENV"
28
+
29
+ # ── Install dependencies ─────────────────────────────────────────────────────
30
+ info "Installing Python dependencies..."
31
+ pip install --upgrade pip --quiet
32
+ pip install -r requirements.txt --quiet
33
+ ok "Dependencies installed"
34
+
35
+ # ── Environment file ─────────────────────────────────────────────────────────
36
+ if [ -f "$ENV_FILE" ]; then
37
+ warn ".env already exists β€” skipping copy (review $ENV_EXAMPLE for new vars)"
38
+ else
39
+ info "Copying $ENV_EXAMPLE β†’ $ENV_FILE..."
40
+ cp "$ENV_EXAMPLE" "$ENV_FILE"
41
+ ok ".env created β€” edit it to configure LLM tiers and endpoints"
42
+ fi
43
+
44
+ # ── FAISS index build ────────────────────────────────────────────────────────
45
+ info "Building FAISS indexes (downloads BGE embedder + reranker on first run)..."
46
+ python -m retrieval.vector_store
47
+ ok "FAISS indexes built in data/faiss_store/"
48
+
49
+ # ── Ollama model pull ────────────────────────────────────────────────────────
50
+ if ! command -v ollama >/dev/null 2>&1; then
51
+ warn "Ollama not installed β€” install it from https://ollama.com then re-run this script"
52
+ else
53
+ LOCAL_MODEL=$(grep -E '^LOCAL_MODEL=' "$ENV_FILE" 2>/dev/null | cut -d= -f2 | sed 's/#.*//' | tr -d ' ' || echo "qwen3:8b")
54
+ [ -z "$LOCAL_MODEL" ] && LOCAL_MODEL="qwen3:8b"
55
+ info "Pulling Ollama model: $LOCAL_MODEL (skips if already pulled)..."
56
+ ollama pull "$LOCAL_MODEL"
57
+ ok "Ollama model $LOCAL_MODEL ready"
58
+ fi
59
+
60
+ # ── Done ──────────────────────────────────────────────────────────────────────
61
+ echo ""
62
+ ok "Setup complete!"
63
+ echo ""
64
+ echo " Activate the environment:"
65
+ echo " conda activate $CONDA_ENV"
66
+ echo ""
67
+ echo " Run the CLI:"
68
+ echo " python main.py --debug"
69
+ echo ""
70
+ echo " Or start the full stack:"
71
+ echo " uvicorn api.main:app --reload # FastAPI on :8000"
72
+ echo " streamlit run ui/app.py # Streamlit on :8501"
73
+ echo ""