Building an AI-Powered Diet Tool
- ciciodonnell
- Dec 9, 2025
- 4 min read
Updated: 7 days ago
For the last 20 years, I have been the designated cook when the family gets together for the holidays. Some of my relatives are vegetarian or vegan, some are diabetic, and some are low-carb or Paleo. This Thanksgiving I had to cook a meal that accommodated all of these requirements simultaneously.
I realized that I had accumulated a vast amount of knowledge in which substitutions work. For example, I can tell you when to use almond flour versus lentil flour as a substitute for wheat flour. I’ve built these substitution rules over years of trial and error.
This realization inspired me to turn my tribal knowledge into a repeatable diet tool. I’m building a prototype “Diet Bot” designed to help people follow diets by automatically adapting recipes.
Behind this seemingly simple idea is a full LLM product architecture that touches on retrieval-augmented generation (RAG), custom rule engines, domain adaptation, and instruction tuning. This project is still in progress, but here’s a look at my product roadmap.
Why This Project?
People following the development of the AI industry have long known that investor dollars are seriously subsidizing the cost of AI usage. Eventually, the time will come when the major AI players start to reduce those subsidies and drive up the cost of token usage to reflect reality. At this point, most companies will either be forced to ration usage, create hybrid systems, or build on-premise and tailor-made AI helpers.
For my money, I’m betting that many companies will want to create air-gapped, on-premise, in-context AI and AI+ML systems. For example, instead of a general enterprise subscription to ChatGPT, companies will have an internal tool connected to their own RAG where users can retrieve the right documents and have them summarized according to their industry-specific needs.
To this end, I wanted a hobby project that gave me hands-on experience building a small prototype of a tailor-made AI bot that would give me the foundational knowledge I would need to build a larger system at an enterprise scale. This is the first of three custom AI bots that I plan to develop. The second is an AI Arbiter (see upcoming article soon) and the third is an AI Interrogator (see article here).
System Architecture Overview
The user starts at a simple chat interface, pastes in a recipe and specifies the dietary constraints. Let’s take a concrete example of converting conventional brownies into a SCD-safe recipe.
The system first calls a rule-based algorithm that defines what type of recipe it is (e.g., “dessert” versus “side dish”), what is allowable versus forbidden in that specific dietary setting (e.g., SCD vs vegan vs diabetic), and parses the ingredients of the recipe from their aliases into their designated name (e.g., “flour” is “wheat flour”) and into their functional roles (e.g., flour is acting as a base for the brownies rather than as a thickener in a sauce).
Next, the RAG system is called. The vector database looks at the substitution patterns and cooking technique snippets and retrieves the relevant markdown files. Finally, the LLM receives the prompt, rule-based analysis, and RAG files. This is then converted into a final recipe that shows the compliance notes and the re-written recipe.
Going back to our brownie example, the system identifies three compliance issues: wheat flour and granulated sugar are forbidden, and conventional chocolate chips contain refined sugar. It retrieves the almond flour markdown noting that a 1:1 substitution works well in dense baked goods, it retrieves the coconut sugar substitution note, and it retrieves the chocolate markdown recommending a specific brand of chocolate chips as a compliant alternative.
Three Iterations of Model Maturity
A key part of this project is intentionally designing the learning curve for the model. Instead of jumping straight into fine-tuning, I’m building in three stages. This follows the typical Agile method of creating a smooth glide path from crawl to walk to run. In particular, the end goal is a system that can be run completely on-premise with only open-source tooling. The only thing required is the hardware.
Conclusion
This project is the first of three custom AI tools I'm building to develop hands-on fluency with enterprise-scale AI architecture. The Diet Bot establishes the foundation; from a working pipeline that combines deterministic rule logic, retrieval-augmented generation, and LLM orchestration to solve a real, bounded problem.
The second project, the AI Arbiter, tackles a different challenge: when multiple valid substitutions exist, how does a system learn your preferences over time and surface the right tradeoff for you to decide?
The third, the AI Interrogator, addresses the hardest problem in any knowledge system: getting the knowledge in. Rather than hand-authoring rules, the Interrogator extracts tacit expertise through example-driven conversation, turning what you already know into structured, reusable system knowledge.
I'll be publishing a follow-up article on what building the Diet Bot actually taught me: where the architecture held up, where it didn't, and what I'd do differently. Stay tuned.
'''
Architecture
'''
1. A rule-based domain engine
A lightweight, YAML-driven rule system that defines:
allowed / illegal / conditional ingredients
aliases (e.g., “flour” to “wheat_flour”)
functional roles (binder, thickener, sweetener)
compliance notes
2. Retrieval-Augmented Generation
A vector database (FAISS to start, then possibly Pinecone) stores:
substitution patterns
cooking technique snippets
verified diet-safe recipe transformations
3. LLM orchestration layer (FastAPI + function calling)
The model receives:
user text
rule-based analysis
relevant retrieved context
Outputs are structured into:
Compliance notes
Rewritten recipe
4. Streamlit front-end
A simple, fast UI to:
paste recipes
view diff-style rewrites
explore substitutions
'''
Product Roadmap
'''
Iteration 1: Prompting + RAG (MVP)
Goal: Validate the workflow using commercial APIs (OpenAI).
Basic recipe parsing
Rule engine + compliance detection
Substitution retrieval
Single-call recipe rewrite with structured output
Iteration 2: Domain Adaptation
Goal: Teach the model deeper knowledge of cooking chemistry + SCD.
Switch to Llama-3 or Mistral for local control
Continue pretraining on curated recipe + technique corpus
Embed substitution reasoning (roles, hydration, acidity, fat ratios)
Iteration 3: Instruction Tuning
Goal: Lock in predictable, structured responses.
Fine-tune on prompt to response pairs for:
diff-style rewrites
substitution rationales
ingredient role detection
7-day meal plans