AI
AI that cites its sources: how we built Edimu
Why a plain chatbot is dangerous for contracts, how retrieval and citation checks fix it, and five questions to ask before adding AI to any product.
"Can you add AI to our product?" is now one of the most common requests we get. Sometimes the honest answer is yes. Often it is "yes, but not the way you are picturing it". This post walks through how we built Edimu, our AI contract intelligence product, and what it taught us about putting AI in front of people who need to rely on the answer.
What Edimu does
Edimu helps founders, freelancers and small businesses deal with contracts. It has four parts:
- Review: read a contract, split it into clauses, classify each one and score its risk.
- Draft: produce a first draft from a plain description of the deal.
- Negotiate: suggest alternative wording for clauses that are one-sided.
- Monitor: keep track of dates and obligations after signing.
The important word in all of that is "grounded". Every risk explanation points to the actual law it relies on, for the jurisdiction the contract is under.
The problem with a plain chatbot
If you paste a contract into a general AI chat tool and ask "is this fair?", you get a confident, well-written answer. Sometimes it is right. Sometimes it refers to a law that does not apply in Kenya, or to a section number that does not exist.
For a contract, a confident wrong answer is worse than no answer. A small business owner has no way to tell the difference. So the core design goal was simple to state and hard to build: never make a legal claim without showing where it comes from.
Retrieval first, generation second
Edimu uses retrieval-augmented generation (RAG). In plain terms, before the model writes anything, the system finds the relevant source material and gives it to the model as the only material it may rely on.
The pipeline, simplified:
- 1Parse. Turn the uploaded PDF or Word file into clean text and split it into clauses, keeping numbering and headings.
- 2Classify. Label each clause: payment terms, termination, liability, confidentiality, intellectual property, dispute resolution and so on.
- 3Retrieve. For each clause, search a curated library of legal sources for the jurisdiction and pull back the most relevant passages.
- 4Reason. Ask the model to assess the clause using only those passages, and to cite them.
- 5Check. Verify that every citation in the answer actually exists in the retrieved material. If it does not, the answer gets rejected and regenerated, or the clause is flagged for a person to look at.
Step 5 is the one most teams skip, and it is the one that makes the product trustworthy.
The library matters more than the model
We spent far more time on the source library than on prompts. Which statutes, which regulations, which versions, how they are split into passages, and how each passage is labelled by jurisdiction and topic.
A better model on a messy library gives you worse answers than a decent model on a clean one. If you take one thing from this post, take that.
Edimu runs on Azure AI Foundry, which gave us a choice of models, content filtering and data residency options without running our own GPU infrastructure. The model can be swapped. The library and the checks are the actual product.
Design for "I am not sure"
Risk scores come with reasons, and the reasons come with sources. When the system is unsure, because the clause is unusual or nothing relevant was retrieved, it says so plainly and suggests getting a lawyer to look at that clause.
Users trust a tool more when it admits its limits. They also stop trusting it completely the first time it bluffs and gets caught.
Questions we now ask before any AI project
When a client asks us to add AI, we work through these first:
- 1What decision is the user making with this answer? If a wrong answer costs money, health or legal exposure, you need grounding and checks, not just a prompt.
- 2Where does the truth live? Your documents, a database, the law, a product catalogue? If you cannot point to it, the model will make it up.
- 3How will you know it is working? We build a test set of real examples with known good answers before we write the feature, and run it every time something changes.
- 4What does it cost per use? Model calls cost money on every request. We estimate cost per user per month early so there are no surprises at scale.
- 5What happens to the data? Contracts, health records and financial documents are sensitive. Where data is processed and stored has to fit the Kenya Data Protection Act and your customers' expectations.
Where AI is worth it, and where it is not
AI earns its keep when it saves skilled people from reading, sorting and summarising large amounts of text: contracts, support tickets, reports, applications, call transcripts. It is also good at turning messy input into structured data.
It is a poor fit when a simple rule would do, when there is no reliable source of truth, or when nobody will check the output.
We use the same approach across our AI work, from Edimu to the personality-based therapist matching in MentalSynch. If you are weighing up an AI feature, our AI and machine learning service starts with a short discovery phase that answers the five questions above before anyone commits to a build. We also run an applied AI training track for engineering teams.
Have a project like this in mind?
Elom Labs is a Nairobi software studio. We have delivered 68 projects since 2023, and first-time clients get 20% off their first project.