Skip to content

Docs

Cookbook: Knowledge Graph Entity Alignment

Decide which of 450 candidate product pairs from two beer catalogues describe the same entity: one three-level Score per pair splits 40 merges, 50 curator reviews, and 360 non-matches.
Format
Docs
Reading time
3 min
Published by
TypeSafe AI
Last verified
Sep 2026

Highlights

  • 450 Magellan beer pairs scored in one request each: 40 assert sameAs (8.9%), 50 go to a curator (11.1%), and 360 stay unlinked.
  • No fitted threshold: route() rounds the Score to the nearest of three levels, so the middle level's wording drives behavior.
  • Three Noul questions about name, brewery, and style ride along to localize disagreements, while ABV stays in arithmetic.

Quickstart

python
response = client.system_one(
    state={"entity_a": pair["entity_a"], "entity_b": pair["entity_b"]},
    questions={
        "link_state": Score(instructions="How do the two products relate?",
                            criteria=LEVELS),  # different / related / same
        "same_name": Noul(instructions="Same beer name?"),
        "same_brewery": Noul(instructions="Same brewery?"),
        "same_style": Noul(instructions="Same beer style?"),
    },
    model="jev-1.12",
)
score = response.answers["link_state"].score
outcome = OUTCOME[min(int(score + 0.5), len(LEVELS) - 1)]  # nearest level routes the pair

Watch out

A rounded three-level score is a routing policy rather than a calibrated match probability, so keep a curator path for the middle.

Questions about this entry

Short answers drawn from the linked project or page.

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