Skip to content
Jev Hub

[ Use case · Data ]

Can Jev extract dates, emails and amounts from text?

Find the right value in messy text without letting a model make one up.

Published By Jev Hub

[ TLDR ]Good fit
  • Yes, in a specific way: Jev chooses, and code does the rest.
  • For values such as emails, phone numbers and amounts, a pattern match finds the candidates and Jev picks the one the question asks for, so it cannot invent a value.
  • For dates, Jev reads the parts the text names (month, day, year or 'next Thursday') and code builds and checks the date.
  • Both are TypeSafe cookbooks.

Is Jev a fit for documents?

Use Jev when:

  • Documents contain several values of the same kind and the right one depends on the words around it.
  • A wrong digit is costly, so the value must be copied exactly from the text.
  • Dates appear in mixed forms, including relative ones such as 'tomorrow'.

Skip it when:

  • The document has a fixed layout. A parser is cheaper and exact.
  • You need free-form text extracted (a summary, a reason). Jev picks from options; it does not write.

Which questions does Jev answer?

One request per document, 2 questions. Jev answers them in parallel.

  • Which address should the receipt be sent to? (choice. Options: billing@acme.io, dana.lee@gmail.com, none)
  • Which amount is the total due? (choice. Options: $1,315.50, -$84.50, none)
ONE DOCUMENTJEV ANSWERSWhich candidate?Which date parts?YOUR CODECopy the valueBuild the dateUnsure: review
One document, 2 questions, then your code. Jev answers the questions about each document in one request. Your own code reads the answers and their probabilities and decides what happens next.

What does it cost?

About 86¢ a month for 30,000 documents of about 380 words each: 2.9¢ per 1,000 at list price, billed by TypeSafe AI. Adjust the numbers in the calculator.

What does TypeSafe's worked example show?

Two TypeSafe cookbooks. In the first, a pattern finds candidate emails, phone numbers and amounts, Jev picks the one asked for, and code copies it. In the second, Jev answers seven Choice questions about a date in one call and code turns the answers into a date.

  • The receipt goes to the personal address on the Reply-To line, because the body asks for it; a pattern alone could not tell.
  • A phone number with no country code comes back as +14155550177: Jev picks the mobile and reads the country from the words around it.
  • An invoice total comes back as 1315.50 USD, flagged as a charge rather than a credit.
  • Because Jev only chooses among the spans the pattern found, it cannot invent a value or swap a digit.

Source: TypeSafe's cookbook Pre-parsed value extraction and date extraction (opens in a new tab). These are the maker's own results on its chosen data; test on yours.

How do you get started?

  1. Test it in the playground. No code needed. Paste a real document into TypeSafe's playground and ask: “Which address should the receipt be sent to?” with the options billing@acme.io, dana.lee@gmail.com, none. You'll see the answer and its probability. Open the playground (opens in a new tab).
  2. Use an existing tool. We haven't found a ready-made tool for this workload yet. Browse what people have built with Jev.
  3. Integrate it. To run it on every document automatically, call Jev from the system where your documents live. The developer details below include the full request.

Common questions

How do developers set it up?

The request

One request per document with all 2 questions batched over the same state, so Jev reads the state once. Keys below are the names you'll see in the response.

POST api.typesafe.ai/v1/systemone
{
  "model": "jev-latest",
  "state": "From: Billing <billing@acme.io>\nReply-To: dana.lee@gmail.com\nBody: Please send the receipt to my personal address, not the billing alias. Total due: $1,315.50. Credit applied: -$84.50.",
  "questions": {
    "receipt_address": {
      "type": "choice",
      "instructions": "Which address should the receipt be sent to?",
      "criteria": [
        "billing@acme.io",
        "dana.lee@gmail.com",
        "none"
      ]
    },
    "total_due": {
      "type": "choice",
      "instructions": "Which amount is the total due?",
      "criteria": [
        "$1,315.50",
        "-$84.50",
        "none"
      ]
    }
  }
}

How to wire it up

  1. Find every candidate value with a pattern match tuned to over-find, and remove duplicates.
  2. Ask Jev a Choice whose options are those candidates, plus 'none'.
  3. Copy the chosen value exactly and normalise it in code (for example a phone number to international format).
  4. For dates, ask for the parts the text names and let code build the date, counting from today for relative dates.

Watch out for

  • Jev can only pick what the pattern found. If a value is missing from the options, widen the pattern.
  • Never let Jev do calendar arithmetic. TypeSafe lists date comparison as a known weak spot.

New to writing Jev questions? Read the question design guide.