Docs
OfficialJev Cookbooks
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 pairWatch 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.
The cookbook routes by rounding the Score to the nearest of three levels, so the middle level's wording is the policy. Of 450 beer pairs, 40 assert sameAs, 50 go to a curator, and 360 stay unlinked.
Localization. Three Nouls about name, brewery, and style ride along to show where a disagreement comes from, while ABV comparisons stay in arithmetic rather than the model.
Because merging two entities inappropriately is the more expensive mistake: every fact about either entity then describes the merged one, and anything linked to either comes along too, with undo meaning working out which fact came from where. Missing a match only leaves a duplicate. So the judgment needs an option for pairs that are neither safe to merge nor safe to drop.
One level per outcome: different product, leave the two entities unlinked; related but possibly not the same, hand it to a curator; same product, merge them. Score is used so the semantic label attaches directly to each outcome including the middle one. A Noul could do it indirectly by thresholding its output, and a Choice would lose the ordering between the three.
The Beer data from the Magellan collection: two beer catalogues scraped from different websites, already cut to 450 candidate pairs by a cheap rough first pass. Each entity carries name, brewery, style and alcohol content, and the text is left exactly as published, with unconverted HTML entities, apostrophes split off as separate words and a few characters decoded wrongly, so no pre-processing flatters the model.
pip install matplotlib ipython 'cooksafe>=0.2.0,<0.3.0' and set TYPESAFE_API_KEY; the published numbers came from jev-1.12 on 2026-08-11. One request goes out per pair, so spend follows the number of pairs you were handed rather than the size of either source. The example uses a small pool of 6 workers because the public endpoint rate-limits above roughly eight.
No. The caveat describes a rounded three-level score as a routing policy rather than a calibrated match probability, which is why the middle level keeps a curator path. The three companion Nouls only localize which field disagrees, and ABV comparisons stay in arithmetic rather than the model.
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.