#!/bin/bash # Pull required Ollama models. # Run this after Ollama is started: # ./scripts/pull_models.sh # # Models: # - bge-m3: embedding model (1024 dims, multilingual/Arabic) # - qwen2.5:7b: LLM for local dev (swap to 14b/32b for production) # # Upgrade path (production): # OLLAMA_LLM_MODEL=qwen2.5:14b — 10GB VRAM, better Arabic reasoning # OLLAMA_LLM_MODEL=qwen2.5:32b — 20GB VRAM, best quality # OLLAMA_LLM_MODEL=aya-expanse:32b — Arabic-first alternative set -e OLLAMA_HOST="${OLLAMA_BASE_URL:-http://localhost:11434}" EMBED_MODEL="${OLLAMA_EMBED_MODEL:-bge-m3}" LLM_MODEL="${OLLAMA_LLM_MODEL:-qwen2.5:7b}" echo "Waiting for Ollama at ${OLLAMA_HOST}..." until curl -sf "${OLLAMA_HOST}/api/tags" > /dev/null 2>&1; do sleep 2 done echo "Ollama is ready." echo "Pulling embedding model: ${EMBED_MODEL}..." curl -sf "${OLLAMA_HOST}/api/pull" -d "{\"name\": \"${EMBED_MODEL}\"}" | while read -r line; do status=$(echo "$line" | grep -o '"status":"[^"]*"' | head -1) [ -n "$status" ] && echo " $status" done echo "✓ ${EMBED_MODEL} ready" echo "Pulling LLM model: ${LLM_MODEL}..." curl -sf "${OLLAMA_HOST}/api/pull" -d "{\"name\": \"${LLM_MODEL}\"}" | while read -r line; do status=$(echo "$line" | grep -o '"status":"[^"]*"' | head -1) [ -n "$status" ] && echo " $status" done echo "✓ ${LLM_MODEL} ready" echo "All models pulled successfully."