Skip to content

Latest commit

 

History

History
166 lines (136 loc) · 5.5 KB

File metadata and controls

166 lines (136 loc) · 5.5 KB

Dhwani

AI-assisted voice intelligence for Karnataka 1092 helpline workflows.

Dhwani helps an operator turn caller speech into a safer action path: transcribe, scrub PII, retrieve dialect context, interpret intent, detect distress, verify when confidence is medium, escalate when risk is high, and preserve an audit trail.

License: Apache 2.0 Stack Status Home

Demo Quick Start

cd backend
pip install -r requirements.txt
cp .env.example .env
pytest -q

cd ../frontend
npm install
npm run dev

For the Compose demo path, set HF_TOKEN in backend/.env, then run:

docker compose up --build
  • Frontend: http://localhost:5173
  • Backend health: http://localhost:8000/api/health
  • Prometheus: http://localhost:9090
  • Grafana: http://localhost:3000

Demo Script

  1. Open the product site and click Launch Demo.
  2. Start with Routine Support Call in Agent view and send the first sample turn.
  3. Open Dialect Verification to show that Dhwani verifies instead of guessing.
  4. Open Distress Handover to show sentiment-triggered escalation.
  5. Switch the persona control between Agent, Supervisor, and Judge to show demo role behavior. This is not production authentication.
  6. Point judges to the audit trail, confidence card, verification prompt, and summary learning action.

Architecture Overview

flowchart LR
    UI[React product site<br/>and operator console]:::ui
    WS[FastAPI WebSocket<br/>call adapter]:::api
    UC[CallSessionUseCases<br/>application core]:::core
    Ports[Hexagonal ports<br/>STT TTS LLM RAG State Queue]:::core
    STT[VoicERA / AI4Bharat<br/>speech adapters]:::adapter
    LLM[HF default<br/>Anthropic / demo fallback]:::adapter
    RAG[Dialect RAG<br/>local or Chroma]:::adapter
    Redis[(Redis<br/>sessions + learning queue)]:::state
    Metrics[Prometheus + Grafana]:::ops

    UI --> WS --> UC --> Ports
    Ports --> STT
    Ports --> LLM
    Ports --> RAG
    Ports --> Redis
    WS --> Metrics

    classDef ui fill:#e0f2fe,stroke:#0284c7,color:#0f172a
    classDef api fill:#dcfce7,stroke:#16a34a,color:#052e16
    classDef core fill:#fef3c7,stroke:#d97706,color:#422006
    classDef adapter fill:#fce7f3,stroke:#db2777,color:#500724
    classDef state fill:#ede9fe,stroke:#7c3aed,color:#2e1065
    classDef ops fill:#fee2e2,stroke:#dc2626,color:#450a0a
Loading

User Flow

flowchart TD
    Home[Professional product website]:::site
    Demo[Launch Demo]:::site
    Scenario[Choose scenario<br/>routine verify distress]:::demo
    Agent[Agent operates call]:::agent
    Supervisor[Supervisor reviews risk]:::supervisor
    Judge[Judge read-only view]:::judge
    Outcome[Confidence decision<br/>summary audit trail]:::result

    Home --> Demo --> Scenario --> Agent --> Outcome
    Scenario --> Supervisor --> Outcome
    Scenario --> Judge --> Outcome

    classDef site fill:#e0f2fe,stroke:#0284c7,color:#082f49
    classDef demo fill:#fef9c3,stroke:#ca8a04,color:#422006
    classDef agent fill:#dcfce7,stroke:#16a34a,color:#052e16
    classDef supervisor fill:#ede9fe,stroke:#7c3aed,color:#2e1065
    classDef judge fill:#fee2e2,stroke:#dc2626,color:#450a0a
    classDef result fill:#f8fafc,stroke:#64748b,color:#0f172a
Loading

AI Pipeline

flowchart LR
    Input[Caller audio or text]:::input
    STT[STT confidence]:::stage
    PII[PII scrubber]:::safe
    RAG[Dialect retrieval]:::stage
    NLU[LLM interpretation]:::stage
    Sentiment[Sentiment detector]:::risk
    Decision[Composite decision]:::decision
    Verify[Verify]:::verify
    Confirm[Auto-confirm]:::confirm
    Handover[Handover]:::handover

    Input --> STT --> PII --> RAG --> NLU --> Decision
    Input --> Sentiment --> Decision
    Decision --> Verify
    Decision --> Confirm
    Decision --> Handover

    classDef input fill:#e0f2fe,stroke:#0284c7,color:#082f49
    classDef stage fill:#f8fafc,stroke:#64748b,color:#0f172a
    classDef safe fill:#dcfce7,stroke:#16a34a,color:#052e16
    classDef risk fill:#fee2e2,stroke:#dc2626,color:#450a0a
    classDef decision fill:#fef3c7,stroke:#d97706,color:#422006
    classDef verify fill:#ffedd5,stroke:#ea580c,color:#431407
    classDef confirm fill:#dcfce7,stroke:#16a34a,color:#052e16
    classDef handover fill:#fee2e2,stroke:#dc2626,color:#450a0a
Loading

Redis Session Flow

sequenceDiagram
    participant UI as React console
    participant WS as FastAPI WebSocket
    participant UC as Call use case
    participant R as Redis
    participant Q as Learning queue

    UI->>WS: text_input or audio_chunk
    WS->>UC: process turn
    UC->>R: save active session
    UC-->>WS: turn_result
    WS-->>UI: confidence, action, summary
    UI->>WS: save_summary learn=true
    WS->>UC: save agent summary
    UC->>R: update session
    UC->>Q: enqueue correction
Loading

Configuration

Key demo settings:

LLM_PROVIDER=hf
HF_TOKEN=your_huggingface_token_here
HF_BASE_URL=https://router.huggingface.co/v1
HF_MODEL=Qwen/Qwen2.5-7B-Instruct
STATE_BACKEND=redis
REDIS_URL=redis://redis:6379/0
SESSION_TTL_SECONDS=86400
DEMO_MODE=true

LLM_PROVIDER=demo keeps the demo deterministic when external model calls are unavailable. Real auth is intentionally deferred; the frontend persona switch demonstrates role behavior without claiming production access control.