“How much mango should I stock before the season ends?”
That was the question a vegetable stockist asked our sales team during an ERP demonstration.
If you’re unfamiliar with ERP systems, think of them as the backbone of a business. Sales, stock, accounting, HR — everything flows through it.
The question seemed simple. Expected, even. Any good ERP should answer that, right?
Our team responded with the traditional method:
“Check sales reports from the last two or three years, review leftover stock, calculate growth trends, then estimate how much to reorder.”
Logical. Standard. But not good enough.
The owner shook his head and said:
“Are you guys still living in the age before AI? Haven’t you grown in the last 20 years?”
That hit hard — and he was right.
At that moment, we realized: Businesses don’t need more reports. They need real answers.
And that’s when we set out to build something more than a reporting tool — an AI assistant that answers questions with clarity, context, and true insight.
From Reports to Responses
We’re leaving behind the era of Excel-based decision-making and entering a new age:
Ask AI → Get the answer.
Two generations ago, we moved from mental math to calculators.
The next generation moved from calculators to Excel.
Now the transition is from Excel to AI.
Whether we like it or not, this evolution is happening — and ERP providers must adapt.
So we began building an AI that works seamlessly with Frappe ERPNext, the open-source ERP trusted by businesses worldwide.
We haven’t built the perfect business AI — but we’ve begun.
And every day, we get closer.
Meet #Changai — AI for ERPNext
At ERPGulf, we’re building ChangAI, a retrieval-based AI chatbot for ERPNext users.
The goal is simple:
Stop making business owners dig through reports to get simple answers.
Ask something like:
“Show me Blanket Orders expiring next month.”
A simple question on the surface — but under the hood, dozens of components work together to generate a clean, accurate answer.
How ChangAI Works
For curious programmers, here’s an overview.
If you want to understand the foundations of AI (datasets, models, embeddings), this video explains everything starting at 42 minutes:
https://youtu.be/WBMae6luW8o?t=2552
(We break down the iconic research paper “Attention Is All You Need.”)
And for the complete #Changai Demo Video, watch here:
https://youtu.be/ZA2ICtI12-M?list=PLPVaNoNlHfNmX21YnjS6-VNUHVCq0ZLi0
ChangAI works in two major phases:
PHASE 1 — Understanding and Generating the Query
Not every message deserves a full response.
Some are greetings, follow-ups, or incomplete thoughts.
So first, ChangAI has to classify what the user is really saying.

Step 1 — RoBERTa: Understanding the User Intent
ChangAI uses RoBERTa to classify inputs:
Is it small talk?
A clear question?
A follow-up to a previous question?
An incomplete thought?
RoBERTa gives ChangAI the “common sense” it needs to respond intelligently.
If it’s a proper question, four AI models work together across three stages.
Stage 1 — Identify the Doctype (RoBERTa)
Ask:
“How many invoices were unpaid last month?”
RoBERTa identifies the correct doctype → Sales Invoice.
No matter how the question is phrased, the model figures out the correct business object.
Stage 2 — Understanding Fields (sBERT + Flan T5-Base)
Two models work together:
sBERT
Matches parts of the question to ERPNext fields:
“unpaid” → status
“last month” → posting_date
Flan T5-Base
Decides which fields to fetch:
Output fields: name, customer, amount
Filters: status = Unpaid, posting_date = last month
Now the system has a structured understanding of the question.
Stage 3 — Query Generation (Flan Query Generator)
The final model converts everything into a real ERPNext query:
frappe.get_list()
or
frappe.db.get_all()
By the end of Phase 1, the AI has produced a clean, ready-to-run Frappe query.
PHASE 2 — Executing the Query & Giving a Human Answer
Once the query is generated and executed, ChangAI doesn’t just dump raw data.
It replies like a human:
“You have 18 unpaid invoices totaling SAR 52,300 for June.”
This human-like answer is created using Flan-T5, which converts structured data into natural language — the reverse of how it’s used in Phase 1.
Where We’re Headed — Making ChangAI Smarter Daily
Memory Through Vector Search
Every clear question is converted into a vector fingerprint using sBERT.
This vector is stored in a semantic store (yes — a Frappe doctype).
If a similar question is asked later:
ChangAI finds the match
Reuses the previous solution
Responds instantly
If not, it runs the full pipeline — and remembers the new answer for next time.
Redis handles short-term memory.
The semantic store logs long-term knowledge.
Handling Small Talk, Follow-ups, and Incomplete Questions
Not every message is perfect.
ChangAI handles them all:
Small Talk
Handled by DialoGPT → friendly, lightweight chatting.
Follow-ups
ChangAI checks the Redis cache for active threads.
Unclear Questions
If context is missing:
It searches previous threads
Tries to reconstruct meaning
If still unclear → politely asks for clarification

Privacy First — Your Data Never Leaves Your ERP
A stockist asking:
“How many mangoes were sold last year?”
isn’t just expecting an answer — he’s trusting that his business data stays private.
Your sales history, margins, and stock levels are trade secrets.
And ChangAI treats them that way.
We deliberately avoided using ChatGPT or similar APIs because:
They require sending your data
They expose metadata about custom doctypes
They could compromise privacy
ChangAI runs fully inside your ERP environment.
No data is sent out.
No training happens outside your server.
Your data stays yours.
What’s Coming Next — MCP (Model Context Protocol)
Business data is messy — spreadsheets, databases, APIs, files.
AI models can't naturally connect to all of them.
That’s where MCP comes in.
MCP is a standard that lets ChangAI connect to any dataset:
Relational databases
NoSQL stores
APIs
Local files
How MCP works

Host → where ChangAI lives
Client → the brain that selects the right tool
Server → knows where your data sits
Ask:
“Fetch me the purchase invoices from last month.”
The pipeline:
Client asks server what tools are available
Server lists databases/APIs
LLM selects the appropriate tool
Data is fetched locally
LLM converts it into a human answer
ChangAI will use MCP to handle messy data quietly — so you don’t have to.

Synthetic Dataset — Scaling Smarter
Hand-building datasets is exhausting.
So we used GPT-4 to generate synthetic training data with strict controls.
Process:
Take real, messy business questions
Generate 100 variations
Cover 50+ base questions per doctype
Validate fields
Remove assumptions
Deduplicate everything
Result:
Larger dataset
More robust training
Better real-world accuracy
We’re Early — But Learning Fast
Our mission isn’t to replace reports or people.
It’s to make everyday business operations faster, simpler, and more intuitive.
If an answer can be instant, why not?
ChangAI is open-source, transparent, and growing every day.
We welcome:
Developers
Researchers
ERPNext enthusiasts
Let’s build AI-powered ERP — one simple question at a time.

