Docs
OfficialJev Cookbooks
Cookbook: Date Extraction
Extract dates by asking seven Choice questions about a date's shape and parts, then resolving them in code: five of six examples auto-accepted and missing dates flagged at 0.46 confidence.
- Format
- Docs
- Reading time
- 2 min
- Published by
- TypeSafe AI
- Last verified
- Sep 2026
Works forJev for Extraction
Used inJev for Software & DevTools
Highlights
- Seven Choice questions read the date's shape and parts, month, day, year 1900 to 2050, and weekday, while the model does no math.
- Code resolves the parts against a pinned TODAY and infers missing years; five of six examples were auto-accepted.
- An absent kickoff date returned none with 0.46 confidence and the note that the absolute date was incomplete.
- Bare weekdays mean the next occurrence on or after today; next means the following calendar week.
Quickstart
python
def read_parts(document: str, role: str) -> dict:
answers = client.system_one(
state=document, questions=date_questions(role), model=TYPESAFE_MODEL
).answers # seven Choice questions: mode, month, day, year, day_anchor, ...
return {part: {"choice": a.choice, "confidence": a.confidence}
for part, a in answers.items()}
result = assemble(read_parts(FORM, "the deadline to return the form"))
print(result["date"], result["confidence"], result["needs_review"])
# code resolves the parts; REVIEW_BELOW = 0.60 flags low confidence for a humanWatch out
Phrases like next Thursday are ambiguous, so the code fixes a convention and sends anything under 0.60 confidence to review.
Questions about this entry
Short answers drawn from the linked project or page.
So the model does no math. Seven Choice questions read the date's shape and parts — mode, month, day, year, weekday — and code resolves them against a pinned TODAY, which is the standing guardrail for dates as text.
With fixed conventions plus review: bare weekdays mean the next occurrence on or after today and 'next' means the following calendar week, while anything under 0.60 confidence goes to a person.
mode says how the date is written, absolute, relative or none; month, day and year cover an absolute date; and day_anchor covers a relative one with today, tomorrow, the day after tomorrow or a named weekday. When a weekday is named, weekday and week_offset say which one and which week. Code then reads only the pieces that mode actually calls for.
The year question lists every year from 1900 to 2050 plus two escapes. none means the text states no year and code fills one in; out_of_range means a year is stated but falls outside the list, and code flags that instead of guessing. If a list that long bothers you, the page suggests pulling year-like numbers out of the text first and offering the model only those.
Five of six examples were auto-accepted. The failure case is the instructive one: a form with no kickoff date returned none at 0.46 confidence along with the note that the absolute date was incomplete, so it went below the 0.60 review gate rather than being resolved into a date.
So relative dates resolve reproducibly. TODAY is set to a fixed date so the notebook's numbers replay identically, and the resolve and assemble code is written as pure functions that stay importable, which lets the calendar math be unit-tested on its own without any API call.
pip install ipython 'cooksafe>=0.2.0,<0.3.0' and set TYPESAFE_API_KEY. Calls cache to json_cache.json so a re-render spends nothing until you delete it, and the review gate is REVIEW_BELOW at 0.60. The model is jev-1.12.
Reactions & coverage
Posts, threads, and videos about this entry from around the web.
X: A 26-sheet plan set in 2.9 seconds
X: Which exam questions come back
X: 900 images in 40 seconds
From the Jev guides
Original write-ups on what this entry is for.
From the Jev AI model community
Posts from builders shipping with Jev right now.