Files
Joseph CostaandClaude Opus 4.8 5bd8142d30 Document and preflight all dependencies
- README: explicit install commands for Ollama (macOS/Linux/Windows) and Python
  3.12 per OS; note curl as a run.sh dependency
- setup.sh / setup.ps1: preflight checks that Ollama is installed and reachable
  (with install hints if missing); setup.sh also warns if curl is absent

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-05 02:15:22 -05:00

52 lines
2.1 KiB
PowerShell

# One-time setup on Windows: create the Python 3.12 venv and install LiteLLM + Pillow.
# The router itself is stdlib-only; this is for the LiteLLM backend.
# Run: powershell -ExecutionPolicy Bypass -File .\scripts\setup.ps1
$ErrorActionPreference = "Stop"
Set-Location (Split-Path $PSScriptRoot -Parent) # repo root
function Find-Py312 {
if (Get-Command py -ErrorAction SilentlyContinue) {
try { if ((& py -3.12 --version 2>&1) -match "3\.12") { return @("py", "-3.12") } } catch {}
}
foreach ($c in @("python3.12", "python")) {
if (Get-Command $c -ErrorAction SilentlyContinue) {
try { if ((& $c --version 2>&1) -match "3\.12") { return @($c) } } catch {}
}
}
return $null
}
$py = Find-Py312
if (-not $py) {
Write-Error "Python 3.12 not found. Install it: winget install Python.Python.3.12 (or python.org)"
exit 1
}
$exe = $py[0]
$baseArgs = if ($py.Count -gt 1) { $py[1..($py.Count - 1)] } else { @() }
Write-Host ">> using Python 3.12 via '$($py -join ' ')'"
if (-not (Test-Path ".venv")) { & $exe @baseArgs -m venv .venv }
$vpy = ".\.venv\Scripts\python.exe"
& $vpy -m pip install -q --upgrade pip
& $vpy -m pip install -q -r requirements.txt
& $vpy -c "import litellm, PIL; print('>> deps OK (litellm, pillow)')"
# preflight: Ollama (the model backend)
if (Get-Command ollama -ErrorAction SilentlyContinue) {
Write-Host ">> ollama: $((ollama --version 2>$null | Select-Object -First 1))"
$base = if ($env:ROUTER_OLLAMA) { $env:ROUTER_OLLAMA } else { "http://127.0.0.1:11434" }
try {
Invoke-WebRequest "$base/api/version" -TimeoutSec 3 -UseBasicParsing | Out-Null
Write-Host ">> ollama server: reachable"
} catch {
Write-Host "!! ollama installed but not responding — start the Ollama app first."
}
} else {
Write-Host "!! ollama NOT installed (required backend). Install: winget install Ollama.Ollama"
}
Write-Host ""
Write-Host "Next:"
Write-Host " .\scripts\pull-models.ps1 # pull a model fleet (edit the list first)"
Write-Host " .\run.ps1 # start LiteLLM + router"