跳到正文
DEV Community· miaoduitw-creator·· 53 分鐘前AI 評分51

發票 BigInt 校驗器及表格感知 RAG 分塊器附免費工作流範本

Stop LLMs From Hallucinating Invoice Math in n8n: A Free Deterministic BigInt Guardrail Blueprint

AI 導讀

miaoduitw-creator 提供兩款 Apify 確定性工具,分別用於發票及採購單校驗、表格感知 Markdown/HTML 分塊,並附 MIT 授權的 n8n 與 Make.com 工作流 JSON 範本。

正文

miaoduitw-creator

If you have built an automated Accounts Payable workflow in n8n or Make.com (Email PDF → OpenAI/Claude/Mistral OCR → Google Sheets / ERP), you have probably run into the quietest bug in production AI automation:

LLMs are great at reading unstructured invoices, and terrible at exact arithmetic.

In real B2B invoices, an LLM will confidently output JSON like:

  • quantity: 3, unit_price: 19.99, line_total: 65.00 (Actual math: $59.97 — a +$5.03 hallucination that cascades into wrong tax and wrong grand total)
  • Silently dropping the minus sign on accounting credit notes like (50.00), turning a -$50 discount into +$50 (a $100 overpayment error)
  • Tripping over IEEE-754 floating-point drift (0.1 + 0.2 = 0.30000000000000004) or mixing 0-decimal currencies (JPY, TWD) with 2-decimal currencies (USD, EUR)

Asking a second LLM prompt to "double-check the math" burns tokens and still hallucinates.


The Fix: Put a Zero-Scraping Deterministic Guardrail Node Between Your LLM and Your ERP

Instead of maintaining fragile custom JS Code nodes for every client workflow, we packaged two stateless, pure-compute, zero-scraping MCP / API tools on Apify Store—plus free MIT-licensed n8n & Make.com workflow JSON blueprints you can import in 10 seconds:

  1. Structured Invoice & PO Deterministic Validator ($0.004 / invoice Pay-Per-Event, zero proxy cost)

  2. RAG Table-Aware Markdown & HTML Chunker ($0.002 / document Pay-Per-Event)


Free Ready-to-Import n8n & Make Blueprints (MIT License)

All templates are open-source with zero hardcoded credentials:


Use Directly Inside Claude Desktop or Cursor via MCP

Both tools also work natively as MCP tools through @apify/actors-mcp-server:

{
  "mcpServers": {
    "miaodui-pure-compute": {
      "command": "npx",
      "args": [
        "-y",
        "@apify/actors-mcp-server",
        "--actors",
        "snowy_divide_r1t/structured-invoice-line-validator,snowy_divide_r1t/rag-table-aware-chunker"
      ],
      "env": {
        "APIFY_TOKEN": "<apify-api-token>"
      }
    }
  }
}

Try Both Algorithms Live in Your Browser (Zero Login, Zero Data Uploaded)

Before wiring anything into n8n or Make, you can test messy invoice JSON or complex Markdown/HTML tables 100% client-side in our interactive sandbox:

https://mcp.miaodui.workers.dev/

If you run AI automation workflows for finance or RAG pipelines, what other "messy LLM output → strict deterministic JSON" edge cases keep breaking your automations?

來源:DEV Community · dev.to