Skip to content

Docs

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

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 human

Watch 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.

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.

Follow @typesafeai