Every Databricks primitive that matters
The system is built on the Mosaic AI stack end-to-end: Agent Framework orchestrates tool calls, Storage-Optimized Vector Search hosts the classical-text index, MLflow 3 traces every agent run, Model Serving fronts Sarvam-M via an External Models endpoint, and Unity Catalog governs tools. The frontend is a thin Next.js app on Vercel; a Docker image bundles the judge-mode fallback.
Mosaic AI Agent Framework
The four-step agent (router → retriever → synthesiser → guardrails) is defined as a MLflow 3 chain. Each tool is registered in Unity Catalog so reviewers can inspect the DAG before running it.
Storage-Optimized Vector Search
`ayurveda.texts.chunks` is a Delta table (Sanskrit + Hindi + English + keywords). We index the Hindi + English fields with BGE-M3, and query with subdomain filters from the router.
Model Serving · External Sarvam-M
We expose Sarvam-M via the Databricks External Models custom-provider option (GA March 2025). The AI Gateway adds rate-limit fallback to Llama-3-70B Foundation Model API for the live demo.
MLflow 3 · agent observability
Every consult and every scoreboard run becomes an MLflow Run under experiment ayurveda-copilot/bench-runs. Per-subdomain accuracy, retrieval score, and token usage are logged as metrics; the trace view shows every tool call in the UI.
Safety guardrails
Mosaic AI Gateway guardrails plus a custom post-processor mark unsupported claims as uncertain, surface AYUSH pharmacovigilance warnings, and block cross-recommendation of modern PPIs/anticoagulants with Rasa formulations.
Voice mode (stretch)
For ASHA workers: Sarvam Shuka ASR → our agent → Sarvam Bulbul TTS, all routed through the AI Gateway so the same key policy applies. In judge mode the browser's SpeechRecognition and SpeechSynthesis are used.
End-to-end agent trace
Matches what MLflow 3 records; mirrored in the consult sidebar.
Reproducing on Databricks
One notebook, zero manual steps. Works on the Databricks free trial.
- Run
notebooks/00_ingest_corpus.py— ingests the public-domain texts into Unity Catalogayurveda.raw. - Run
notebooks/10_build_vector_index.py— builds the Storage-Optimized Vector Search index from the chunked Delta table. - Run
notebooks/20_register_agent.py— registers the Mosaic AI Agent Framework chain + deploys the Model Serving endpoint via External Models (Sarvam-M). - Run
notebooks/30_bhashabench_eval.py— runs BhashaBench-Ayurveda against our agent + GPT-4o + vanilla Sarvam-M and logs to MLflow 3.