最便宜的供應商其實並非最便宜:我用本地 AI 開發 QuoteDiff
The Cheapest Supplier Wasn't Actually the Cheapest — So I Built QuoteDiff with Local AI
作者以本地 AI 開發 QuoteDiff,協助小型企業比較供應商報價,辨識產品規格、税項及運費差異。工具透過 Ollama + Gemma 在本機推理,預設使用 gemma2:2b;總額、折扣、税項及成本比較由確定性的 Python 邏輯計算。QuoteDiff 不需付費 AI API,目標是在個人電腦本機處理報價文件,避免將內容傳送至雲端 AI API。
This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle
What I Built
Imagine you're running a small business and need to buy materials from three different suppliers.
One sends a PDF quotation. Another sends an Excel sheet. The third sends a quotation with different product descriptions, delivery charges, and tax details.
At first glance, one supplier looks cheaper. But does that price include GST? Is delivery included? Are the products actually the same grade, size, and quantity?
Comparing quotations manually can be time-consuming, and overlooking one small detail can turn a seemingly good deal into an expensive mistake.
That's the problem I wanted to tackle with QuoteDiff.
QuoteDiff is a local-first, AI-powered supplier quotation comparison tool designed for small businesses, contractors, and procurement teams.
It aims to help users:
- Upload supplier quotations in supported document formats.
- Extract supplier details, product descriptions, prices, quantities, taxes, and delivery charges.
- Compare products while highlighting differences in specifications and units.
- Flag missing information, uncertain matches, and incompatible quotations.
- Calculate comparable costs using deterministic Python logic rather than asking an AI model to do the arithmetic.
- Export a comparison report to support purchasing decisions.
The goal isn't simply to find the lowest number. It's to help users understand whether they're comparing equivalent offers in the first place.
Demo
Code
GitHub repository:
QuoteDiff
Local-first AI app that compares supplier quotations for small businesses.
Inference runs on your machine through Ollama + Gemma. No paid APIs, no cloud database, no authentication. Document parsing, AI extraction, matching, calculations, UI, and exports are separate modules. Calculations are always deterministic Python — the model never invents prices, taxes, or specs.
Designed for an Apple Silicon Mac with 8 GB RAM using a small local model (gemma2:2b by default).
macOS setup
1. Prerequisites
- macOS on Apple Silicon
- Python 3.11+ (
python3 --version) - Ollama for local inference
Install Ollama (pick one):
# Homebrew brew install ollama # Or download the macOS app from https://ollama.com/download
2. Start Ollama and download the model
# Start the local server (leave this running)
ollama serveIn a second terminal:
# Small Gemma build suitable for ~8 GB unified memory ollama pull gemma2:2b # Confirm it is installed ollama list
…
How I Built It
QuoteDiff is designed around open-source tools and local AI inference.
The planned technology stack includes:
- Python for the application and comparison engine.
- Streamlit for the user interface.
- Ollama + Gemma for local AI-powered extraction and interpretation.
- Pydantic for validating extracted data.
- Pandas, PyMuPDF, and openpyxl for working with structured data and supported document formats.
- pytest for automated testing.
One important design decision is separating AI interpretation from financial calculations.
An AI model can help interpret inconsistent product descriptions and extract information from quotations. However, totals, discounts, tax calculations, and cost comparisons should be handled by deterministic code, with missing or uncertain values clearly flagged for human review.
The project is intended to run locally on a personal computer, without requiring a paid AI API.
Why Does Open Innovation Matter?
For a tool that processes business quotations, privacy and cost matter.
Small businesses may not want to upload supplier prices, purchasing volumes, or commercial terms to an external AI service. They may also find recurring API costs difficult to justify for an occasional task.
Using open-weight models with local inference makes a different approach possible:
- Privacy: documents can be processed locally without sending their contents to a cloud AI API.
- Cost control: there is no per-request fee from a paid AI inference API, although hardware and electricity still have costs.
- Flexibility: the model can potentially be replaced with another compatible open-weight model.
- Transparency: calculations can be implemented and tested in ordinary Python instead of relying on an AI-generated answer.
- Accessibility: the goal is to make useful procurement assistance more accessible to smaller businesses, not just large companies with enterprise software budgets.
Open innovation is valuable here because it gives developers the freedom to adapt the technology to a practical business problem while retaining control over data and costs.
My Agent Session
I used Cursor to help develop the project in stages, with an emphasis on modular code, deterministic calculations, and tests for edge cases.
Prize Categories
- Gemma: planned local inference using the Gemma family of open-weight models.
來源:DEV Community · dev.to