Agentic AI

Jev vs GPT-5.2 for Invoice Classification: Building a TypeSafe Jev Agent in Dataworkz

We replaced the GPT-5.2 classifier in a Dataworkz invoice-processing agent with TypeSafe Jev, and here is what improved, what broke, and where Jev still lags.

Key takeaways

  • On a six-document development set, TypeSafe Jev matched the reviewed labels on 6 of 6 documents, versus 4 of 6 for GPT-5.2.
  • Jev averaged 1.50 seconds per classification versus 4.45 seconds for GPT-5.2, making it about three times faster.
  • Both GPT-5.2 misses came from overriding the decision tree's stop-at-first-match order, which Jev avoided because the routing order lives in code.
  • When you replace one component in a working Dataworkz workflow, keep its inputs, output fields and category tags identical, because a different category selects a different extraction prompt.
  • These are early results on a small sample: cost, run-to-run stability and an end-to-end agent comparison have not yet been measured.
On this pagesections

    TL;DR: We replaced the GPT-5.2 classifier inside a Dataworkz invoice-processing agent with TypeSafe Jev, changing nothing else. On a six-document development set, Jev matched our reviewed labels on 6 of 6 documents versus 4 of 6 for GPT-5.2, and answered in about 1.5 seconds versus 4.5 seconds. This post explains how we built it, what we learned, where Jev is ahead, and where it still lags. It is an early result on a small set, not a production benchmark, and we say so throughout.

    Why invoice classification is harder than it looks

    Contractors send invoices in many shapes: payment requests with no hours, standard invoices with explicit date ranges, weekly billing rows, daily timesheets grouped into weeks, workbooks that pair an invoice with a timesheet, and more. Before a system can pull out employee names, service dates, and billed hours, it needs to know which layout it is looking at.

    That is what our Dataworkz invoice agent’s InvoiceClassifier does. It classifies each submission into one of nine categories. The category is not a quality grade. It is a routing instruction that tells the next step which extraction prompt to use. Get the category wrong, and the extractor asks the wrong questions of the document, which often shows up downstream as “missing fields” that were never actually missing.

    The classifier uses an ordered decision tree:

    1. Is it a daily timesheet with weekly sections?
    2. Is it a Payment Request, and if so, does it use a Unit Item column, period tokens, or summary rows?
    3. Are there weekly line items per employee?
    4. Are there multiple service-period blocks?
    5. Is there an explicit day-level date range, and if so, do similar employee names need to be kept separate?
    6. Otherwise, is it a single month label?

    The rule that makes it tricky: the tree stops at the first match.

    What is TypeSafe Jev?

    Jev is TypeSafe AI’s model, called through a typed-question API. Instead of asking a model to write free text and then parsing it, you define questions with a declared answer type. For our classifier the questions are yes/no questions, and Jev returns a probability between 0 and 1 for each one.

    That design maps neatly onto a decision tree. Each branch becomes a question (“Does the document header say Payment Request rather than Invoice?”), Jev scores it, and ordinary code applies the branches in order.

    For readers searching for the Jev model or Jev AI: in this experiment we called jev-latest through TypeSafe’s API, and every call returned typed answers rather than prose.

    The experiment: Jev vs GPT-5.2

    We built a local Python framework that extracts text from PDFs and Excel workbooks, treats multiple files as one submission, and sends the same document to both models. It records category, latency, and errors, flags uncertain cases for human review, and ships with 22 automated tests.

    Two details mattered more than we expected:

    • Excel display values. One workbook stored 2025-11-01 but showed Nov 2025 because of the cell format. A model that sees only the stored value may read it as a single date instead of a month label. We preserved both, as Nov 2025 [stored=2025-11-01].
    • Arithmetic in code, not in the model. When an invoice comes with a timesheet, Python compares invoice quantity with the sum of daily hours and returns match, mismatch, not_comparable, or not_applicable. The result is repeatable.

    The setup that made the comparison fair

    • GPT-5.2 received the exact exported Dataworkz InvoiceClassifier system prompt and the extracted document as raw input.
    • Jev received 14 typed yes/no questions representing the same Q0–Q10 decision tree. Python then applied Jev’s answers in the exact tree order.
    • Both saw the same extracted content and were scored against the same reviewed labels.

    One early lesson: our first benchmark used folder names as the expected category, and the results looked strange. When we applied the exported decision tree by hand, the documents did not follow the folder names. Folder labels are not gold labels. We created a reviewed label file and kept the original folder name in every result for auditability.

    Results

    Sample Expected category Jev GPT-5.2
    Sample 1 3 3 3
    Sample 2 9 9 6
    Sample 3 6 6 6
    Sample 4 6 6 6
    Sample 5 6 6 4
    Sample 6 3 3 3
    Metric Jev (jev-latest) GPT-5.2
    Exact matches 6 / 6 4 / 6
    Exact-match rate 100% 66.7%
    Average latency 1.50 s 4.45 s
    API errors 0 0

    Jev was about three times faster and matched the reviewed label on every document.

    Why GPT-5.2 disagreed on two files

    Neither miss was random. Both were reasonable readings that broke the tree’s stop-at-first-match rule.

    • Invoice plus timesheet workbook. The timesheet sheet had the exact first pattern in the tree: employee name in the header, daily hour rows, weekly sections, weekly subtotals. The tree stops there, at Category 9. GPT-5.2 looked at the whole workbook as an invoice with a month label and chose Category 6.
    • Contract-summary workbook. It had one month label and many overlapping employee-name variants. The tree reaches the single-month check before the name-ambiguity check, so the expected answer is Category 6. GPT-5.2 favored the duplicate-name definition and chose Category 4.

    Our production prompt contains four places where the written category descriptions and the tree order can point in different directions. A model that weighs the whole description can land on a sensible answer that is still wrong by the routing rules. Jev did not have that problem here, because the order lives in code, not in prose.

    Putting Jev inside a real Dataworkz agent

    A benchmark only goes so far. The practical question was whether Jev could sit in the live agent and replace only the classifier.

    Step 1: Call Jev from Dataworkz as a REST tool

    Dataworkz lets you expose any HTTP endpoint as an agent tool. We pointed a REST tool at TypeSafe’s POST /v1/systemone endpoint.

    Our first instinct was to paste the API key into the tool’s Authorization header. That works, but the header is stored as plain text in the tool definition, so anyone who can open or export the tool can read the key.

    Dataworkz has a credential vault for this: Configuration → Integrations → API Credentials. We saved a credential named typesafe_jev with the base URL and the key sent as an Authorization header. The tool now references the connection, and Dataworkz adds the header automatically.

    Add New API Credentials form in Dataworkz with endpoint name typesafe_jev, base URL api.typesafe.ai, and the API key sent as an Authorization request header
    The Dataworkz API Credentials form. The key is entered by a person and is never stored in the tool definition.

    Step 2: Understand what the real workflow does

    Our live agent does not call the classifier directly. It calls a workflow tool, ExtractInvoiceComposite, which:

    1. reads the uploaded documents;
    2. calls InvoiceClassifier;
    3. stops with a message if the file is not a valid invoice;
    4. looks up an extraction prompt for the returned category;
    5. extracts the invoice data; and
    6. runs a human-in-the-loop check for missing fields.

    Step 3: Our first attempt broke, and that taught us the most

    Our first Jev replacement scored six fixed categories and picked the highest. When we ran a real invoice through the agent, it asked for missing fields that the GPT version had not.

    Our best diagnosis is a contract mismatch. The live classifier returns nine category tags and the extraction step picks its prompt from that tag. Our first Jev tool used a different six-category scheme built for an earlier benchmark, and it returned a field the real classifier does not. A different category means a different extraction prompt, and a different prompt looks for different fields. We did not capture the failing run in detail, so this is our diagnosis rather than a proven root cause.

    The lesson: when you replace one component in a working pipeline, keep its contract identical. Only the method should change.

    Step 4: The design that worked

    We rebuilt the replacement around the method we had already validated:

    Uploaded documents
          |
          v
     Read documents (unchanged)
          |
          v
     InvoiceClassifierJev   <-- the only step that changed
       +- JevInvoiceSignals  (Jev answers 14 typed yes/no questions)
       +- Q0-Q10 routing     (applied in the exact tree order)
          |
          v
     Category prompt lookup -> extraction -> human-in-the-loop check (all unchanged)
    • JevInvoiceSignals is a REST tool that asks Jev the 14 questions using the saved credential.
    • InvoiceClassifierJev is a workflow tool with the same input as InvoiceClassifier. It applies the routing order and returns the same fields: success, invoice_category, category_number, category_label, layout_family, service_period_status, expected_extraction_outcome, classification_signals, hitl_flags, and support_tags, with a reason when a document is not valid. It uses the same nine category tags.
    • ExtractInvoiceCompositeJev is an exact copy of ExtractInvoiceComposite in which one reference changed, from the GPT classifier to InvoiceClassifierJev. We verified programmatically that the saved workflow is otherwise identical.
    • The agent is a copy of the live invoice agent with the same scenarios and settings, pointing at the Jev workflow.
    Dataworkz tool list showing JevInvoiceSignals, InvoiceClassifierJev, ExtractInvoiceCompositeJev and other Jev tools
    The Jev tools in the Dataworkz tool list.
    InvoiceClassifierJev tool settings in Dataworkz, described as the same input and output as InvoiceClassifier with classification done by TypeSafe Jev
    InvoiceClassifierJev: same input and output contract as the GPT classifier, different classification method.

    We tested the classifier tool directly with one development sample. It returned the expected category and the same output fields as the production classifier:

    {
      "success": true,
      "invoice_category": "standard_invoice_explicit_range_with_hours",
      "category_number": 3,
      "category_label": "Explicit date range with employee hours",
      "layout_family": "Standard Invoice",
      "service_period_status": "explicit_range",
      "expected_extraction_outcome": "SUCCESS",
      "classification_signals": [
        "Dataworkz Q0-Q10 decision tree (Jev signals) selected: Explicit date range with employee hours"
      ],
      "hitl_flags": [],
      "support_tags": []
    }
    InvoiceProcessingAgentJev overview in Dataworkz with four scenarios, noting classification uses TypeSafe Jev via ExtractInvoiceCompositeJev
    The Jev variant of the invoice agent: same scenarios, same structure, one changed classifier.

    Why we are considering replacing the GPT classifier with Jev

    On this early evidence, four things stand out.

    1. It followed the rules we wrote down. The stop-at-first-match order is enforced by code, and Jev’s only job is to answer each question. On the two files where GPT-5.2 overrode the order, Jev did not.

    2. It was about three times faster. 1.50 seconds versus 4.45 seconds on average. For an agent that classifies before it extracts, that time is paid on every submission.

    3. Its answers are auditable. Each decision is a set of per-question probabilities. When a result looks wrong, you can see which question tipped it, and you can put a threshold on any of them for human review.

    4. It fits how the workflow already works. Because the output is a set of typed signals, wiring it into a Dataworkz workflow and into the human-in-the-loop path is straightforward.

    Where Jev lags, and what we have not shown

    We want this post to be useful to people evaluating Jev, so here is the other side.

    • Six documents is a small sample. The labels are ours, produced by applying the decision tree, and are still provisional until a domain expert reviews them. We are not claiming production accuracy.
    • Jev needs the task designed for it. It does not read a long prompt and decide. We had to break the classifier into 14 typed questions and write the routing code. That is engineering effort GPT-5.2 did not need. The payoff is control, but it is a real cost.
    • Jev returns scores, not explanations. GPT-5.2 can write a rationale in plain language. With Jev you get probabilities and reconstruct the story from them.
    • Scores move a little between runs. In two runs of the same sample, one runner-up score came back as 0.07 and then 0.09. It did not change any decision here, but we have not yet measured stability across many runs.
    • We have not measured cost. We do not claim Jev is cheaper. Latency and accuracy are the only metrics we can support today.
    • The end-to-end agent comparison is still to do. We have shown that the classifier matches the production contract and works on a sample. The final test, running the same uploaded invoices through the GPT agent and the Jev agent and comparing the extracted fields, is next.
    • A few production details are approximated. The wording of the classification signals differs from GPT’s, the low-confidence flag is simplified, and the exact hours-mismatch check is not included in the workflow version yet.
    • Our GPT setup is not a perfect production replica. The live classifier references an LLM configuration we could not resolve in the tenant, so our GPT-5.2 run used the exported prompt with the model directly.

    What we plan to do next

    1. Resolve the prompt conflicts and define one authoritative precedence order.
    2. Build a domain-expert-reviewed gold set with multiple unseen examples for all nine categories, including invalid documents, split submissions, and invoice-plus-timesheet combinations.
    3. Repeat each test to measure stability, not just one answer per file.
    4. Compare per-category accuracy, human-review rate, latency, tokens, cost, and reliability.
    5. Run the same uploaded invoices through both agents and review every disagreement by hand.

    Takeaways for anyone building an AI invoice processing agent

    • Keep business-rule order in code. Models tend to weigh the whole description, and that is exactly when they override an ordered rule.
    • Do arithmetic outside the model. Sum hours in code.
    • Preserve what a person sees in Excel. Store both the displayed value and the stored value.
    • When you swap a component, keep its contract identical. Same inputs, same outputs, same tags.

    Want to build your own agent? Explore the Dataworkz platform and the Dataworkz AI agents documentation. To learn more about Jev, read the TypeSafe AI documentation.

    Frequently asked questions

    What is TypeSafe Jev?

    Jev is TypeSafe's model, accessed through an API that takes typed questions and returns typed answers. In this experiment we used yes/no questions that return a probability between 0 and 1.

    Is Jev better than GPT-5.2 for invoice classification?

    On our six-document development set, Jev matched the reviewed labels on 6 of 6 documents versus 4 of 6 for GPT-5.2, and was about three times faster. That is an encouraging early result, not a production benchmark. We have not measured cost or stability across many runs.

    How do you use Jev in a Dataworkz agent?

    Expose Jev's API as a REST tool, keep the API key in the Dataworkz credential vault, and wrap the routing logic in a workflow tool that returns the same output as your existing classifier. Then point your existing workflow at the new tool.

    Where does Jev lag behind GPT-5.2?

    It needs the task broken into typed questions plus routing code, it returns scores rather than written explanations, its scores vary slightly between runs, and we have not yet measured its cost.

    Should I switch production classification to Jev today?

    We are not doing that yet. We are running a larger, reviewed, repeated test and an end-to-end agent comparison first, and we suggest anyone evaluating Jev do the same on their own documents.

    See what your engineers can ship in production

    Dataworkz is the agentic AI platform enterprises trust to put AI agents into production. Teams build production-ready agents in days, every decision stays traceable, and every agent has ROI attached.

    Explore the platform