Configuration
Two layers:
- Environment variables: where things are (service URLs, keys, model names) and on/off switches. Put them in
.env, which is git-ignored.config/env.examplelists them without secrets (cp config/env.example .env;.envstays in the repo root, where Compose reads it). Theapiandmonitorcontainers read.envthrough Composeenv_file, and host tooling (make fleet-plan,make eval) loads it too. In Docker,docker-compose.ymlsets the service URLs (OSRM, VROOM, FHIR, NATS, scorer, IndicXlit) to their compose names; those win over.env. Restart the api after editing.env:docker compose up -d api. config/*.yaml: how the system behaves (clinical thresholds, dispatch parameters, the AI's brief, UI text). Edit these, not the code.
Environment variables
Language models
| Variable | Default | Meaning |
|---|---|---|
VAAZHVU_LLM_PROVIDER | ollama | openai = any OpenAI-compatible API (DeepSeek) as primary, with local Ollama as fallback. ollama = local only. |
VAAZHVU_LLM_URL | — | Primary base URL, e.g. https://api.deepseek.com (or the Ollama URL when the provider is ollama) |
VAAZHVU_LLM_MODEL | — | Primary model, e.g. deepseek-flash |
VAAZHVU_MCP_URL | http://127.0.0.1:8001/api/mcp | Where the stdio MCP bridge (python -m app.mcp.bridge) forwards to (AI access and the Copilot) |
VAAZHVU_MCP_UPSTREAM | http://127.0.0.1:8001/api/mcp (compose: http://host.docker.internal:8001/api/mcp) | Where the public mcp-gateway (:8790) forwards POST /mcp |
MCP_PUBLIC_URL | var/mcp-public-url (written by make mcp-public) | The public MCP URL make mcp-key prints in the setup commands |
VAAZHVU_API_KEY | — | Bridge only: API key sent as X-API-Key (scopes decide what an MCP client may do; sim.run + intake.create to simulate). Also read by .mcp.json for Claude Code |
VAAZHVU_LLM_API_KEY | — | Bearer key for the primary. Only in .env. |
VAAZHVU_OLLAMA_URL | http://127.0.0.1:11434 (Compose: http://host.docker.internal:11434, the native Ollama.app) | Local fallback endpoint |
VAAZHVU_LLM_FALLBACK_MODEL | gemma3:4b | Local fallback model |
VAAZHVU_LLM_REASON_PARAMS | — | JSON merged into accuracy-critical requests (triage). Used here: {"thinking": {"type": "disabled"}} |
VAAZHVU_LLM_FAST_PARAMS | — | JSON merged into latency-critical requests (the call-taker). Same value. |
VAAZHVU_LLM_REASONING_BUDGET | 0 | Extra max_tokens for reasoning models in reason mode |
VAAZHVU_LLM_TIMEOUT | 30 / 60 | Request timeout (s): cloud / Ollama |
VAAZHVU_LLM | 1 | 0 turns off every LLM: triage abstains (→ human + ALS), the call-taker uses its offline line |
VAAZHVU_TRIAGE_SAMPLES | 5 | Self-consistency samples per triage |
VAAZHVU_LLM_MAX_INFLIGHT | 16 | Process-wide cap on concurrent LLM sample calls (one shared pool) |
VAAZHVU_TRIAGE_DEADLINE_S | triage_deadline_s in policy.yaml (15) | Stop waiting for the model after this many seconds and abstain (0 = no deadline) |
VAAZHVU_LLM_STREAM_USAGE | 1 | LLMOps: ask OpenAI-compatible streams for token usage (stream_options.include_usage). A provider that rejects it is asked once more without it and remembered; 0 never asks |
VAAZHVU_LLM_TRACE_LOG | 1 | LLMOps: 0 drops the per-call vaazhvu.llm.trace log line (metrics and /api/ops/llm stay) |
VAAZHVU_LLM_LOG_CONTENT | 0 | 1 lets logs quote generated text (call-taker guard drops). Local debugging only; traces never hold content either way |
Speech
| Variable | Default | Meaning |
|---|---|---|
VAAZHVU_MLX_WHISPER | mlx-community/whisper-large-v3-mlx | Voice-line STT model (Apple GPU; make models fetches it). Full large-v3: turbo (fp16 and 4-bit turbo-q4) garbled real caller Tamil; ~600 ms per decode |
VAAZHVU_ASR_PROMPT | unset (no prompt) | Experiments only: a Whisper prompt for the Tamil decode. Off because Whisper echoes prompts into the transcript on short turns; must never name symptoms, places or numbers |
VAAZHVU_ASR_LOOP_MIN | 4 | A word, phrase or syllable repeated this many times in a row is a Whisper loop and is cut back to one copy |
VAAZHVU_ASR_DUMP_DIR | unset | Debugging only: save every caller utterance (WAV + decode JSON) here for offline replay. Caller audio: leave unset in real use |
VAAZHVU_WHISPER_MODEL | small | faster-whisper model for uploaded audio, and the voice line wherever MLX is unavailable (including the Docker api) |
VAAZHVU_NO_SPEECH_MAX | 0.97 | Drop Whisper segments above this no-speech probability (Silero VAD already gates speech) |
VAAZHVU_BARGE_IN_SEC | 0.5 | Caller speech must overlap the agent this long to interrupt it |
VAAZHVU_TRANSCRIPT_GRACE_SEC | 2.5 | Wait for a transcript after the caller stops before answering what is already heard |
VAAZHVU_TTS | auto | Voice-line speech engine: say (macOS host), espeak (espeak-ng, Linux and the Docker api), auto = first one installed |
VAAZHVU_TTS_TA / VAAZHVU_TTS_EN | Vani / Tara | macOS say voices (both female, so the agent keeps one voice when the caller switches language) |
VAAZHVU_TTS_RATE | 175 | Speaking rate (words/min) |
VAAZHVU_ESPEAK_TA / VAAZHVU_ESPEAK_EN / VAAZHVU_ESPEAK_RATE | ta / en-gb / 160 | espeak-ng voices and rate |
VAAZHVU_INDIC_MODEL | — | IndicConformer weights (adapter only) |
VAAZHVU_VOICE | — | 1 enables the legacy Pipecat intake-flow adapter (voice/intake.py) |
Language pipeline
| Variable | Default | Meaning |
|---|---|---|
VAAZHVU_XLIT_URL | http://127.0.0.1:8095 (Compose: http://xlit:8095) | IndicXlit service |
VAAZHVU_TANGLISH_PIPELINE | v1 | v2 = span-aware Tanglish pipeline (per-token labels, aligned transliteration, grounded citations, escalation detector). Behind a flag until the release gate is met. |
VAAZHVU_TANGLISH_VIEWS | tamil_aligned | Derived views the v2 LLM sees (comma list: tamil_aligned, translation). The ablation showed the IndicTrans2 gloss costs recall and latency. |
XLIT_BEAM | 8 | IndicXlit beam width (service side); candidates per word come from the beam |
VAAZHVU_INDICTRANS | 1 | 0 turns off IndicTrans2 translation |
VAAZHVU_TORCH_DEVICE | auto | Force the torch device for IndicTrans2 (mps, cpu) |
VAAZHVU_LID_MODEL | ~/.cache/vaazhvu-models/lid.176.ftz | fastText language-ID model path (make models downloads it) |
Services
| Variable | Default | Meaning |
|---|---|---|
VAAZHVU_OSRM_URL | — (Haversine) | OSRM. Compose: http://osrm:5000; from the host: http://127.0.0.1:5001 |
VAAZHVU_VROOM_URL | — | VROOM (evaluation baseline). Compose: http://vroom:3000; host: http://127.0.0.1:3000 |
VAAZHVU_NATS_URL | — | NATS event mirror. Compose: nats://nats:4222; host: nats://127.0.0.1:4222 |
VAAZHVU_FHIR_URL | — | HAPI FHIR base. Compose: http://fhir:8080/fhir; host: http://localhost:8090/fhir |
VAAZHVU_SCORER_URL | — | Go scorer (parity cross-check). Compose: http://scorer:8081; host: http://127.0.0.1:8081 |
VAAZHVU_RESGRID_URL / _TOKEN | — | Resgrid CAD mirror (no-op unless both are set) |
VAAZHVU_MAPPLS_KEY (_URL, _RESOURCE) | — | Mappls traffic-aware routing in front of OSRM / Haversine (routing/mappls.py; unverified against the live API) |
VAAZHVU_MAPPLS_TRAFFIC_KEY (VAAZHVU_MAPPLS_ROUTE_URL) | — | Live congestion map layer from Mappls route_eta (routing/live_traffic.py, config/live_traffic.yaml). Display only; separate from VAAZHVU_MAPPLS_KEY so it never switches dispatch routing |
VAAZHVU_MSIREN_URL / _TOKEN | — (simulated) | Junction alerts POSTed to Chennai Traffic Police mSiren (ops/traffic_police.py; payload ours, unverified) |
VAAZHVU_NOMINATIM_URL | — | Optional geocoder fallback |
VAAZHVU_NOMINATIM_CONTACT | — | Contact (email or URL) added to the Nominatim User-Agent, as its usage policy asks |
VAAZHVU_REGION_FILE | config/region.yaml | Another deployment region |
VAAZHVU_PUBLIC_URL | — | The address people reach this server at, for links it hands out (share URLs). Without it, the forwarded scheme/host from the HTTPS proxy, else the request's own. Caller SMS links (tracking, location request) are sent without a request, so they need it: unset, they are paths only |
VAAZHVU_SMS_URL / _TOKEN | — (simulated) | Outbound SMS gateway (ops/sms_out.py): POST {to, text, ref} with the token as a bearer. Unset, messages are stored in sms_outbox and announced with simulated: true |
VAAZHVU_MAP_STYLE | voyager with a CARTO key, dark_all without | CARTO basemap style; the server builds the tile URL the web maps load (/api/config map.tile_url) |
VAAZHVU_CARTO_API_KEY | — | Map tiles for the web UI (served via /api/config) |
Runtime
| Variable | Default | Meaning |
|---|---|---|
VAAZHVU_LIVE | 1 | 0 = do not start live operations (tests, legacy only) |
VAAZHVU_DB | var/vaazhvu.db | The database: a postgresql:// URL (the compose Postgres; make env-secrets writes the host URL into .env, compose gives the api container its own) or a SQLite path (:memory: in tests). Read from the environment, else .env. Database |
VAAZHVU_PG_PASSWORD | generated by make env-secrets | Password of the compose Postgres (postgres service, user and database vaazhvu); applied when its pg-data volume is first created |
VAAZHVU_TEST_PG | unset | A Postgres URL to run the test suite on (make test-pg starts a throwaway one); each test database becomes a schema |
VAAZHVU_ZONES | 16 | Number of coverage zones (k-means clusters of OSM localities) |
VAAZHVU_LEGACY | 0 | 1 mounts the legacy scenario API (/api/scenarios, /api/incidents*, /api/stream, …) for the /legacy* views and seeds VAAZHVU_SCENARIO at startup |
VAAZHVU_SCENARIO | scenario_02_als_required | Legacy (VAAZHVU_LEGACY=1 only): scenario seeded at startup |
VAAZHVU_IMAGE_EXTRAS | integrations ml voice (Compose) | Docker build: pyproject extras baked into the api image. The default is the full image (ASR, IndicTrans2, voice line); integrations = lite image without speech |
HF_CACHE / VAAZHVU_MODELS_DIR | ~/.cache/huggingface / ~/.cache/vaazhvu-models | Compose: host model caches bind-mounted into the api container |
GRAFANA_ADMIN_PASSWORD | none (required) | Compose: Grafana admin password; make env-secrets (run by make up) generates one into .env |
config/ files
| File | Controls | Read by |
|---|---|---|
llmops.yaml | LLMOps: in-memory trace buffer size and the per-trace log line; how many fallback-served operations in a row before a hand-over is announced (fallback.announce_after); token prices per model in rupees (₹ per million input / cached input / output tokens; deepseek-flash ₹0.528) for vaazhvu_llm_cost_inr_total | llm/telemetry.py |
copilot.yaml | Dispatcher Copilot and MCP server: the Copilot's brief (prompt_version on every copilot.turn trace), generation (temperature, max tokens, max_steps, timeout, history), tool result size cap, how long simulate_incident waits, simulate_deterioration vitals per level, simulation presets (caller words + place) | copilot.py, mcp/ |
calltaker.yaml | The AI call-taker's brief (prompt_version is recorded on every call-taker LLM trace with the brief's hash): role, what to ask, how to talk, allowed instructions, prohibitions; language/channel notes; per-event notes; labels for the other channel's turns; status meanings; which statuses to announce; generation settings (temperature, max tokens/sentences, first-token timeout, history length); the offline line; protocol (the call-taking checklist: universal six, key questions per condition group, paediatric card, scene-safety questions, each slot's answered_by structured fields, group_min_relative, max_next) | ops/calltaker.py |
agencies.yaml | Police / fire rule table: scene hazard (the extractor's closed list) → agency whose unit must attend (fire: fire, electrical, water, trapped, gas leak, chemical, collapse; police: violence, traffic, self-harm, sexual assault, child at risk, suspicious death), and notify rules for inform-only police notifications (medico-legal cases: road collision, burns, poisoning, assault, TN Clinical Establishments Act 2018 s.5-B [R57]; police-report hazards). Notifications never add a unit to dispatch; the controller emits agency.notified and the police portal lists the call as notification-only. Concept → agency stays in triage/ontology.py | triage/agencies.py → triage/pipeline.py, ops/controller.py |
priority.yaml | Dispatch priority P1–P4 (UK ARP categories) and its hospital colour (TAEI red / yellow / green): P1 concepts, the policy flag prefixes that count as asserted, P2 reason concepts, effective severity → level (unknown = P1, fail-safe). A label only: dispatch scoring reads the severity distribution | triage/priority.py → incident priority, incident_summary, hospital alerts, FHIR Encounter.priority, console and ER board chips |
policy.yaml | Safety thresholds (Clinical values): concept_presence (when any verified finding counts as present, shared by triage, the call-taker and dispatch), red-flag presence/doubt, critical floor mass, als_mandate_p_critical (R9 ALS mandate), split vote, max rejected share, which v2 language-review reasons need a human; the LLM-outage floor (triage_deadline_s, escalation_floor_on_abstain). Human-in-the-loop zones (Safety and dispatch): provisional_dispatch_p_critical (T_prov 0.15, from the cost ratio), red_flag_action_min_support (verified samples that send ALS now, 1), red_flag_floor_mode (overwrite floors P(critical); action keeps the distribution for J), low_confidence (mode near_threshold: band around T_prov and max_entropy; or min_confidence with min_confidence), review_priority_risk_factors, hold_timeout_sec (240: a held call is then committed), provisional_verify_sec (120, informational) | safety/policy.py, triage/pipeline.py; the thresholds a UI shows are served by /api/config policy (web reads them in platform/clientConfig.js) |
escalation_phrases.yaml | v2 escalation-only phrase detector: high-risk phrases per concept (Tanglish, Tamil, English), negation cues, window, fused negative suffixes, scope breakers. Draft, not clinician-reviewed. | safety/escalation.py |
destination.yaml | Condition model and hospital destination (Safety and dispatch): mode (shadow: logged in baselines.condition_model; active: decides), per-condition kappa (early care by CPR / AED / haemorrhage control, always on), resp_scale, theta, capable, als_hard, lambda_def, window_sec / window_penalty / window_at, dido_sec, hospital needs, in_extremis concepts, stabilise (services a stabilise-then-transfer stop must have), stroke bypass (≤ 15 min, LVO share); concept_needs, concept_stabilise, implied_services (ASV at government hospitals), ift_resp_scale, paediatric_need, need_precedence, early_care per agency; readiness (source confidence, absent / unknown priors, report half-life, restricted, load penalties, redirect, no-onward leg); candidates (nearest, per-need specialists, max km, joint unit × hospital top-N, onward targets); admissibility (government, medico-legal stabilisation duty, NK-48, CMCHIS, consent, unknown ownership); extremis (vitals thresholds, consecutive readings, minimum saving for an en-route diversion). Clinical values are tagged [EVIDENCE] / [ASSUMPTION] / [NEEDS CLINICAL VALIDATION] | dispatch/risk.py, ops/controller.py, vitals/extremis.py |
dispatch.yaml | Risk objective: hazard per minute by class, capable_for, treated-hazard factor, specialty effect (0), scene/handover times, secondary_transfer_sec (door-in-door-out, 82 min), request_delay_sec (BLS asks for ALS backup), risk aversion and risk_measure (mean_std or CVaR_α, mirrored by the Go scorer), responder cost, parameter_sources (prior, range, source and status of every objective number; eval_dispatch.py --sweep reads the ranges), coverage parameters, candidate limits; als_reserve_no_signal (ALS units kept back from calls with no clinical reading); bundle_min_p_critical (when multi-unit bundles are scored) and als_hard_min_mass (when the ALS mandate stays hard) (Clinical values); clustering (duplicate-call radius, window, shared finding); traffic (the only copy of these settings: closure threshold, the radius/factor of a new closure (new_closure), road snapping, closure/slowdown matching, alternatives, detour via points, screening caps); forecast (half-life, prior strength, 24-value hour profile in the region's local time — flat until CAD history is available, top zones); coverage_search (gaps × nearest idle units scored per redeployment check) | dispatch/risk.py, ops/controller.py, routing/traffic.py, ops/forecast.py |
fleet.yaml | The service standard (response_target_sec, busy_fraction: one source for the fleet planner and live coverage), fleet composition (ALS-cardiac/trauma, ALS, BLS counts and capabilities), first responders, the response target, MEXCLP busy fraction / k, simulation speed, demo playback multipliers, failure injection, seed; gps (device-position staleness and arrival radius) | ops/fleet.py, ops/sim.py, ops/controller.py |
region.yaml | Everything that names the deployment region: id (facility scope), name, place_names (what callers call the area itself; the geocoder never matches them, inflected or misheard, to a place in it), country code, timezone (incident ids, forecast hour, UI clocks), locale, emergency number, the generated dataset file names, the GIS build bbox, the consoles' map centre/zoom, the Nominatim query suffix and User-Agent, unit callsign prefixes | region.py → geo/gis.py, geo/geocode.py, ops/fleet.py, ops/controller.py, ops/forecast.py, scripts/build_chennai_gis.py; /api/config region → web |
geo.yaml | Location uncertainty radius by how the location was found (GPS default, locality, landmark, …) and the factor for unverified matches; gazetteer matching: verified / plausible scores, the Tamil sound-alike discount, the letter-edit limit for short Tamil words, the region-name threshold; generic street words, particles and case endings (words that never identify a place on their own) | geo/geocode.py |
locating.yaml | Caller location: the accuracy above which a device fix is a coarse network fix and up to which it counts as verified, how far a named place must be from the phone to replace its fix, the move that re-routes units, the shortest silent call kept; the caller SMS templates (Tamil + English) and their length | ops/locating.py, ops/sms_out.py |
app.yaml | Client content: emergency number, languages, quick phrases (chat), status_text (status labels), ui_text (every app label, Tamil + English), crew_next (the crew's next action per unit status and role), crew (GPS send interval, minimum move, heartbeat), sos_silence (seconds of no speech after an SOS before the citizen app counts down and before it sends police + ambulance), questionnaire (the /caller "Type answers" questions, options and form text; option ids are quoted so YAML keeps yes/no as strings) | /api/ops/app/config → web + iOS; ops/calltaker.py reads the questionnaire to give the call-taker the caller's answers |
field_ops.yaml | SOS emergency_types (known, default, hold note); silent_sos (agencies sent when an SOS caller cannot speak); traffic_police (corridor purposes / severities, junction alert distance, junction detection, mSiren timeout); call_attempts (repeat window); hotspots (cell size, minimum events, weights, refresh age, excluded dispositions, seasons) | ops/traffic_police.py, ops/call_attempts.py, ops/hotspots.py |
er_prep.yaml | ER pre-arrival checklist items (id, category: bay / equipment / team / procedure) and the capabilities / concepts / severities that trigger them. Ids are stored with the ER's statuses: never rename one | ops/er_handoff.py, ER command |
er_board.yaml | ER command interface: queue thresholds, recent_window_h, freshness (live_min), prep statuses, departments, IFT reasons, ED statuses, specialties, outreach timings (prealert_call_after_sec, referral_no_response_min, auto_advance, max_call_attempts) and call scripts | ops/er_handoff.py, ops/outreach.py |
demo.yaml | Demo storylines (cardiac_mylapore, surge): timed calls, closures, channels | OpsController.run_demo |
Other: config/integrations.yaml maps each third-party component to its adapter, environment variable and verified status.
Web platform
config/platform.yaml holds roles and permissions, rate limits, upload limits, the webhook retry schedule and the CSP sources. Env vars: VAAZHVU_DEFAULT_ROLE (anonymous role; config default viewer), VAAZHVU_RATE_LIMIT, VAAZHVU_TRUST_PROXY, VAAZHVU_CORS_ORIGINS, VAAZHVU_WEBHOOK_ALLOW_PRIVATE, VAAZHVU_UPLOAD_DIR, VAAZHVU_LOG_FORMAT. See Web platform.