Inspiration

Small bakery owners often discover ingredient shortages too late. Traditional inventory systems may show low stock, but owners still need to manually compare suppliers, estimate purchase quantities, consider delivery delays, and explain why a procurement decision should be made.

TingHao was created to turn inventory data into safer and more understandable procurement decisions.

What it does

TingHao is a bakery inventory and procurement platform. For OpenAI Build Week, I extended the existing platform with a new GPT-5.6 Procurement Review inside the Stock Planner.

The review uses:

  • current stock
  • minimum stock levels
  • stock movement history
  • pending purchase orders
  • supplier prices
  • supplier lead times
  • stock prediction context

GPT-5.6 then produces a structured recommendation containing:

  • recommended supplier
  • recommended purchase quantity
  • risk level
  • cost observation
  • delivery risk
  • stockout risk
  • confidence
  • concise reasoning summary

The system never allows the AI to directly approve a purchase order, send an email, or modify stock. Human approval is always required.

How I built it

The project uses Laravel, PHP, Blade, MySQL, Codex, and GPT-5.6.

Codex first inspected the existing repository and identified reusable procurement services, supplier comparison logic, audit components, routes, controllers, and tests.

I then used Codex to build:

  • a provider-neutral structured AI interface
  • an OpenAI client
  • configurable Qwen/OpenAI provider resolution
  • a GPT procurement review service
  • server-side validation and safe fallback behavior
  • a GPT-5.6 Review interface inside the Stock Planner
  • unit and feature tests

The existing deterministic SupplierComparisonService is reused to ground the GPT-5.6 review instead of asking the model to invent supplier rankings.

Challenges I faced

One challenge was extending an existing AI procurement system without breaking its original workflow.

To solve this, I kept the existing Qwen workflow unchanged and added the GPT-5.6 review as a separate, provider-neutral feature.

Another challenge was handling unreliable or malformed model output. The Laravel backend validates supplier IDs, purchase quantities, confidence values, and required fields. Invalid output returns a safe fallback instead of creating a procurement action.

What I learned

I learned that AI systems for business operations should not rely only on model output. Deterministic business logic, server-side validation, auditability, and human approval are essential when recommendations may affect purchasing decisions.

I also learned how Codex can accelerate work on an existing codebase by inspecting architecture, identifying reusable components, implementing focused changes, and generating tests without requiring a full rewrite.

What's next

Next, I plan to add scenario comparison, stronger demand forecasting, receiving-discrepancy review, supplier performance history, and clearer audit visualization for every AI-assisted procurement decision.

Built With

Share this project:

Updates