Provide code for an LLM orchestra
Prompt
### 1. **The LLM Orchestrator (The Central Router)** The orchestrator acts as the "brain" that coordinates user intent. When a user enters a prompt, the LLM does not hallucinate answers from raw tables; instead, it acts as an intelligent router that selects the correct backend tool: - If the user asks for a numerical forecast or risk score, it routes to **Predict and Explain**. - If the user asks for live school records or aggregate counts, it constructs a safe SQL query for **Data Query Tool**. - If the user asks about Samagra Shiksha guidelines, tax rules, or sanitation norms, it routes to **Knowledge Search (RAG)**. ### **2. The Three Core Execution Engines (Middle Tier)** These three modular tools bridge the LLM to your underlying data stores: 1. **Predict and Explain (The AI Models):** - _Backend:_ Connects directly to your saved model registry (`slippage_model.joblib`, `shap_explainer.joblib`, and your Cox survival models). - _Function:_ Runs live inference on demand and extracts SHAP values to explain _why_ a school is flagged. 2. **Data Query Tool (Safe SQL on Views):** - _Backend:_ Connects to your PostgreSQL database (`olap_db.gujarat`) containing cleaned views (`guj_facility`, `enrolment`, `gujrat_master_asset_transaction`). - _Function:_ Translates natural language into secure, read-only parameterized SQL queries to pull exact counts, UDISE codes, and financial outlays. 3. **Knowledge Search (RAG over Document Index):** - _Backend:_ Connects to a local vector database (ChromaDB/FAISS) indexing unstructured markdown files, policy manuals, district memos, and guidelines. - _Function:_ Retrieves official scheme text to support the AI's recommendations. ### **3. Local LLM Engine (Ollama)** - Powered locally via **Ollama** (running open-source models like `llama3` or `mistral`) ensuring that sensitive student enrollment and school infrastructure data never leaves your local machine or private server environment. provide all the requsite python code