Project 02 / Trash2Cash
Trash2Cash
An AI-powered recycling platform for Nigeria — estimate a cash reward for recyclables, find where to drop them off, and ask a grounded assistant that understands how Nigerians actually talk about waste.
- Type
- AI product · Recycling platform
- Year
- 2025
- Focus
- AI · NLP · Full Stack
- 01
User message
Free text, Nigerian terms
- 02
Intent extraction
OpenAI → structured JSON
- 03
Schema validation
Malformed output rejected
- 04
Deterministic tools
Rewards · locations · materials
- 05
Grounded phrasing
Numbers checked against facts
- 06
Local NLP fallback
If any step fails
Contents · 8 sections
Trash2Cash is a recycling platform built for Nigeria. A user can identify a recyclable material, get an estimated cash reward for it, find where to drop it off, and ask an AI recycling assistant questions in their own words.
01
Problem
Plastic bottles, nylon sachets and aluminium cans fill streets and drains across Nigeria. Recycling has a motivation gap: there is little structure, little awareness and no obvious reward for the person holding the waste.
An assistant for that problem has to be trustworthy with numbers. If it invents a payout rate or a drop-off point, the product fails the person using it.
02
What I built
A full-stack Flask application with:
- Material identification against a structured recyclable-material taxonomy that understands Nigerian recycling terminology.
- Reward estimation from material and weight.
- Drop-off and location guidance.
- A grounded AI recycling assistant that answers questions about rewards, materials and locations using the platform’s own verified data.
03
Technical approach
The assistant is a tool-using pipeline rather than a free-form chatbot. OpenAI extracts a structured intent from the user’s message. That intent is validated, routed to a deterministic Python tool, and the tool’s result becomes the only fact the model is allowed to restate. Follow-up questions such as “what about 10 kg?” are resolved from session context in plain Python.
If any step fails — no API key, a timeout, malformed JSON — the request falls back to a local NLP assistant, and every response reports which mode answered.
04
Challenge
An early version of the phrasing step hedged on numbers it should have stated plainly. Asked for the rates, the model replied that it couldn’t provide them — even though it had just been handed the verified figures.
A regression test caught it. The phrasing prompt was rewritten to treat the supplied fact as authoritative and to restate every number exactly, and the numeric safety net was added so a phrasing that introduces an unverified number is never shown to the user.
05
Engineering decisions
- D01
The model never computes the numbers
OpenAI only works out what the user is asking — intent and arguments. Deterministic Python tools compute the reward or look up the location, and the model is shown only that verified fact to phrase.
- D02
Validate model output before it touches business logic
Extracted intents are parsed against a structured schema. Anything malformed is rejected instead of being passed to a business function.
- D03
A numeric safety net
After phrasing, every number in the reply must already appear in the verified fact. If not, the phrasing is discarded and the exact deterministic answer is sent instead.
- D04
A structured material taxonomy with local terms
Materials are modelled as a structured taxonomy that includes the terminology people in Nigeria actually use, so questions are matched to the right material and rate.
- D05
Fail over, not fail closed
A missing key, timeout, rate limit or malformed response falls back to a local NLP assistant, so the product keeps answering.
06
Evaluation
The assistant is measured, not assumed. Alongside 69 automated tests, a 64-case live AI evaluation runs against the real OpenAI API and scores each stage of the pipeline separately — tool selection, argument extraction, grounded-answer accuracy and raw hallucination rate — so a failure can be traced to the stage that caused it.
07
Results
- Automated tests
- 69
- Live AI evaluation cases
- 64
- Tool selection
- 96.9%
- Argument extraction
- 100%
- Grounded-answer accuracy
- 96.9%
- Raw hallucination rate
- 1.6%
08
Limitations
- The numeric safety net catches numeric hallucinations only; non-numeric fabrication is guarded by prompt instructions alone.
- A 1.6% raw hallucination rate is low, not zero — the guards reduce risk rather than eliminate it.
- The local NLP fallback is less capable than the OpenAI-assisted path.
Stack
- Python
- Flask
- OpenAI API
- NLP
- pytest
- JavaScript
Related work
All work- Project 01
MeetingBot
Transcript or audio → Whisper → Speaker-turn chunking → Embeddings + FAISS → OpenAI or local QA → Meeting intelligence
Project 012025AI · NLP · Full StackMeetingBot
An AI meeting assistant that turns a transcript or audio recording into a summary, action items, decisions and participants — with a question-answering chat grounded in what was actually said.
Available for opportunitiesNigeria · Open to remote work