Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎙️ Guftagu

AI Voice Receptionist Infrastructure for Pakistani Businesses

One conversational engine. Any business. Zero per-vertical code.

Python FastAPI Alibaba Cloud License Hackathon


The Problem

Millions of small Pakistani businesses — clinics, restaurants, salons, home-based sellers — lose bookings and orders every day simply because there's no one to answer the phone. Hiring a full-time receptionist isn't feasible for most of them, and every generic chatbot on the market is built for one narrow use case, in English, with a form-like feel that doesn't match how people actually speak.

The Solution

Guftagu is not a chatbot for one business — it's voice infrastructure for any business.

A business owner defines a simple schema: what information do I need from a caller? (a name, an appointment time, an order, a delivery address — whatever applies to them). Guftagu's single, generic AI agent takes it from there: it answers the call, speaks natural Roman Urdu, asks only for what's missing, confirms every detail back to the customer, and saves a clean, structured booking — with a warm, human closing.

No business-specific code. No hardcoded prompts per industry. The same engine that runs a dental clinic's appointment desk runs a restaurant's order line.


Proof, Not a Mockup

We built and tested this end-to-end for two genuinely different business types on the same codebase:

🦷 Dental Clinic 🍔 Restaurant
Booking model Structured day + time-slot scheduling Free-form item & delivery collection
Fields collected Name, day, slot, visit reason Name, order items, delivery address
Conversation flow Presents only available slots, rejects double-bookings Confirms items and price, captures address
Code changes needed — —

Zero lines of business-specific logic separate these two flows. A third business — a tailor, a salon, a home bakery — needs only a new schema entry in the database, not new code.


How It Works

flowchart LR
    A[🎤 Customer Speaks] --> B[Groq Whisper<br/>Speech-to-Text]
    B --> C[Urdu Script →<br/>Roman Transliteration]
    C --> D[Custom Roman Urdu<br/>Normalization Engine]
    D --> E[Qwen LLM Agent<br/>Tool-Calling]
    E -->|missing info| F[Ask Follow-up<br/>Question]
    E -->|all confirmed| G[Save Booking<br/>to Database]
    F --> H[🔊 Text-to-Speech<br/>Response]
    G --> H
    H -->|conversation continues| A
Loading

Every turn runs through this same pipeline regardless of business type — the LLM's behavior is shaped entirely by the calling business's schema, retrieved fresh from the database on every turn.


Key Engineering Highlights

  • 🗣️ Real, continuous voice conversation — not push-to-talk. Browser-side voice activity detection (Web Audio API) automatically detects when the customer starts and stops speaking, so the call feels like an actual phone call.
  • 🧩 Schema-driven, multi-tenant architecture — one Business table with a JSON config drives everything: required fields, available slots or menu items, branding, and conversation rules. One tool (submit_entry), no per-vertical branching, anywhere in the codebase.
  • 🔤 Custom Roman Urdu normalization engine — a hand-built fuzzy-matching dictionary that cleans up the wildly inconsistent way Roman Urdu gets transcribed ("mjhe", "chahye", "kal" vs "kl") before it ever reaches the LLM.
  • ✅ Field validation, not blind trust — before any field is accepted (a name, a phone number, a time), it's validated against expected patterns. A name that's actually a phone number, or gibberish, triggers a polite re-ask instead of corrupting the booking.
  • ☁️ Alibaba Cloud native — conversation and reasoning run on Qwen (via an OpenAI-compatible DashScope integration), architected so switching LLM providers is a one-line environment variable change.

Tech Stack

Layer Technology
Backend FastAPI, SQLAlchemy, SQLite
LLM (reasoning & tool-calling) Alibaba Cloud Qwen (qwen-plus), via DashScope
Speech-to-Text Groq Whisper (whisper-large-v3-turbo)
Text-to-Speech Browser Web Speech API
Frontend Vanilla JS, Web Audio API, MediaRecorder

Getting Started

git clone https://github.com/shafbutt/guftagu
cd guftagu

python -m venv venv
venv\Scripts\activate            # Windows
# source venv/bin/activate       # macOS/Linux

pip install -r requirements.txt

cp .env.example .env             # add your Groq + Qwen/DashScope API keys

uvicorn app.main:app --reload --port 8000
# Demo businesses auto-seed on first run — no manual step needed!

Open http://127.0.0.1:8000/app, pick a business, and press Start Call.


Project Structure

app/
├── main.py                # FastAPI app & endpoints (/call/turn, /transcribe, /transactions)
├── agent.py                # Schema-driven conversational agent — LLM tool-calling core
├── models.py                # Business, Transaction, Conversation, CallLog (SQLAlchemy)
├── normalization.py         # Custom Roman Urdu fuzzy-matching normalizer
├── transliteration.py       # Urdu script → Roman Urdu conversion
├── seed.py                  # Demo business configs (clinic + restaurant)
├── schemas.py                # Pydantic request/response models
└── static/
    └── index.html            # Voice call frontend (per-business themed UI)

Roadmap

  • Schema-driven multi-tenant conversational agent
  • Real-time voice conversation (no push-to-talk)
  • Alibaba Cloud Qwen integration
  • Deploy on Alibaba Cloud (Simple Application Server)
  • Real telephony integration (inbound phone numbers)
  • Alibaba CosyVoice for native Urdu text-to-speech
  • Business owner self-service schema builder

Team

Built for the Alibaba Cloud AI Hackathon Pakistan 2026, hosted by Alkhidmat Foundation Pakistan's Bano Qabil platform.

License

MIT

About

AI voice receptionist infrastructure for Pakistani businesses — schema-driven, multi-tenant, built on Alibaba Cloud Qwen

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages