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:
- Is it a daily timesheet with weekly sections?
- Is it a Payment Request, and if so, does it use a
Unit Itemcolumn, period tokens, or summary rows? - Are there weekly line items per employee?
- Are there multiple service-period blocks?
- Is there an explicit day-level date range, and if so, do similar employee names need to be kept separate?
- 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-01but showedNov 2025because 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, asNov 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, ornot_applicable. The result is repeatable.
The setup that made the comparison fair
- GPT-5.2 received the exact exported Dataworkz
InvoiceClassifiersystem 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.

Step 2: Understand what the real workflow does
Our live agent does not call the classifier directly. It calls a workflow tool, ExtractInvoiceComposite, which:
- reads the uploaded documents;
- calls
InvoiceClassifier; - stops with a message if the file is not a valid invoice;
- looks up an extraction prompt for the returned category;
- extracts the invoice data; and
- 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)
JevInvoiceSignalsis a REST tool that asks Jev the 14 questions using the saved credential.InvoiceClassifierJevis a workflow tool with the same input asInvoiceClassifier. 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, andsupport_tags, with areasonwhen a document is not valid. It uses the same nine category tags.ExtractInvoiceCompositeJevis an exact copy ofExtractInvoiceCompositein which one reference changed, from the GPT classifier toInvoiceClassifierJev. 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.


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": []
}

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
- Resolve the prompt conflicts and define one authoritative precedence order.
- 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.
- Repeat each test to measure stability, not just one answer per file.
- Compare per-category accuracy, human-review rate, latency, tokens, cost, and reliability.
- 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.