From Messy WhatsApp Chits to GST Invoices in 15s — Local AI with Ollama & Qwen 2.5 A developer built BahiPilot, an open-source, local-first AI back office for Indian wholesalers that converts messy WhatsApp order chits, voice notes and PDF invoices into structured line items using local models like Qwen 2.5:7b and Llama 3.2 via Ollama, or Google Gemini as an alternative. The system pairs LLM extraction with Pydantic schema validation, a tiered deterministic product-matching algorithm, and Decimal-based arithmetic so the model never generates financial figures, with stock deduction and ledger posting gated behind a human review approval step. The developer claims the workflow cuts the 2-3 hours distributors spend nightly on transcription by roughly 80%. This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle https://dev.to/challenges/hacktoberfest-week2-2026-10-12 Across India's wholesale markets mandis , billions of dollars in daily trade move not through ERP software, but through informal WhatsApp photos of handwritten paper chits parchis , voice notes, and loose text messages. A small grain distributor or FMCG stockist in a tier-2 trade hub typically spends 2 to 3 hours every evening performing tedious, error-prone transcription: deciphering scribbled product abbreviations, checking physical warehouse stock, typing quantities into software, balancing running Khatabook customer ledgers, and printing GST-compliant tax invoices. BahiPilot बही पायलट is an open-source, local-first AI back office built specifically to eliminate this bottleneck for small Indian wholesalers, distributors, and stockists. Qwen 2.5:7b / Llama 3.2 via Ollama to parse messy colloquial text into structured JSON line items—with zero marginal token cost and complete data privacy. Decimal paise precision . The LLM is never allowed to hallucinate financial figures. Small and medium distributors, grain wholesalers Arhatiyas , and FMCG stockists handling 30 to 200 orders a day. They operate on thin 2%–5% gross margins and currently either hire data entry clerks costing ₹15,000–₹25,000/month or lose hours of their own family time every night balancing paper Bahi Khata ledgers. A private, local back office that cuts transcription time by 80% pays for itself in days. BahiPilot streamlines wholesale and distribution operations across Bharat: ingest messy handwritten chits, WhatsApp order screenshots, and PDF invoices; convert them into structured line items using local open-weight AI Ollama or Gemini API; reconcile against catalogue and available stock; and execute transactional inventory deduction, customer ledger posting, and GST-ready invoice printing. Dual AI Order Ingestion Flagship 4-Stage Guided Workflow : qwen2.5:7b / llama3.2 or Google Gemini gemini-2.5-flash , strictly adhering to structured JSON schemas. Repository: https://github.com/srijan-0-7/hacktoberfest-dev-2 https://github.com/srijan-0-7/hacktoberfest-dev-2 PRAGMA foreign keys = ON . gemini-3.8-flash fitz for native PDF stream extraction, Pillow for preprocessing, and optional Tesseract OCR. Dockerfile multi-stage build and render.yaml for 1-click cloud deployment. BahiPilot implements an extensible BaseAIProvider interface. The prompt strictly limits the LLM's task to linguistic extraction, injecting the business's real catalogue and customer list as context: class ExtractionRawLLMOutput BaseModel : customer name: Optional str = None items: List RawItemExtraction = Field default factory=list notes: List str = Field default factory=list overall needs review: bool = True By requesting structured JSON output and validating via Pydantic schemas, we eliminate hallucinated formats while handling diverse vernacular inputs Hinglish, mixed English/Hindi names, informal units . In Indian trade, the same product is called ten different names: "Chawal" , "Basmati 25kg" , "Rice bag" , or "India Gate Classic" . Instead of trusting an LLM to guess database foreign keys, BahiPilot uses a tiered deterministic matching algorithm: Query coverage: what percentage of the requested item's words exist in this product? overlap = query tokens.intersection prod tokens query coverage = len overlap / len query tokens jaccard = len overlap / len query tokens.union prod tokens score = max query coverage 0.82, jaccard Unmatched or low-confidence items are surfaced with visual warning badges on the review screen, forcing human-in-the-loop resolution before committing to stock. To guarantee financial trust: DRAFT or PENDING REVIEW . Stock deduction and ledger postings execute APPROVE action in an atomic database transaction. If cancelled, an automated stock restoration and ledger debit reversal is logged. Open-source and open-weight AI are not just philosophical preferences for Bharat's MSMEs— they are economic and operational necessities : Zero Marginal Inference Cost: Proprietary cloud APIs charging per token or per image are economically unfeasible for small businesses operating on 2%–4% margins. A distributor processing 150 chits a day would face unpredictable recurring monthly SaaS bills. With open-weight models like Qwen 2.5 running on a basic local shop desktop via Ollama, marginal inference cost is exactly ₹0.00 . Absolute Data Sovereignty & Confidentiality: Indian wholesalers guard their customer directories, negotiated volume discounts, and turnover numbers as core trade secrets. Small business owners are rightfully wary of transmitting unredacted order photos and customer lists to third-party cloud servers. Local open weights keep 100% of the data inside the four walls of the shop. Offline Continuity in Trade Mandis: Wholesale grain and spice markets often suffer from spotty mobile networks and intermittent broadband. Because BahiPilot's inference and database run entirely on localhost, the distributor can continue scanning orders, adjusting stock, and issuing invoices even when the internet is completely down. Open Vocabulary & Model Independence: Open weights can be fine-tuned or prompt-engineered for regional Indian languages Hindi, Marathi, Gujarati, Tamil and unique market jargon without vendor lock-in or fear of arbitrary API deprecation. This entire project was architected, implemented, and debugged through an end-to-end AI pair programming session using Antigravity. Key milestones accomplished during the agent session: customers , products , orders , order items , ledger entries with strict foreign keys and transactional consistency. BaseAIProvider abstraction supporting local Ollama To ground BahiPilot in reality, I tested the order import pipeline with Ramesh Gupta , who operates a wholesale grocery and provisions store Gupta Kirana & Provisions supplying 45 retail kirana shops in Maharashtra. Ramesh pasted a typical evening WhatsApp order list sent by one of his regular buyers: "10 bori Basmati Rice 25kg, 5 carton Fortune Oil 1L, 20 pkt Tata Salt, 15 packet Maggi. Urgent delivery by 4 PM." "Every evening after 8 PM, I sit with a notebook and spend an hour and a half making bills and checking who owes how much. If this software can take my WhatsApp orders and prepare my bills and Khatabook without needing an internet connection, it saves me at least 10 hours a week. I don't want my customer rates going to foreign clouds, so keeping it on my shop laptop is a huge relief." Built with ❤️ for Indian MSMEs and the open-source AI community.