Natural language ordering: converting to a structured shopping cart
💡 One-sentence summary: use Jev to turn a one-sentence order into a structured shopping cart — a Choice narrowing-options loop finds every item, then a batched request per item fills in the fields, and finally code assembles it into your order system.
A customer will say "Can I get a large oat milk latte and a blueberry muffin please", but your checkout system needs a structured shopping cart with items separated and every field in place. The official Shopping cart cookbook solution uses only the Choice question question type, completing natural language to structured data in two stages:
- Find items: the number of items is unknown in advance, so use a narrowing-options loop — each round asks "which remaining item is mentioned first in the order", and once an item is chosen it is removed from the next round's options, until the model picks the sentinel option
nothing_else. - Fill fields: once you know each item, you also know which fields it has (a latte has size and milk), and for each item one batched request asks all the field questions in parallel.
Official testing (jev-1.14.0, 2026-10-29): 3 requests found 2 items (latte 0.99, blueberry muffin 1.00, sentinel 1.00), plus 1 more request filled in the latte's two fields (large 1.00, oat 1.00) — a total of 4 requests to build the whole shopping cart. This lesson takes about 15 minutes to run end to end, and after downloading the official cache you can reproduce all the official numbers without setting an API Key (verified on this page).
What you'll be able to do
- Write
find_items(order): given a natural-language order, no matter how many items she ordered, loop to find each item with its own confidence, withnothing_elseas the sentinel catching "that's everything" - Write
fill_fields(order, item): one request per item fills in all known fields in parallel, and fields the customer didn't mention are explicitly answeredunspecifiedinstead of hallucinating a value - Write the menu as pure data (description + field schema): adding items or fields is just a dictionary edit, not a single word of the questions changes
- Reproduce the official numbers without spending a cent: replay the official
json_cache.jsoncache, rerun with zero requests
Why use Jev instead of letting the LLM generate shopping cart JSON directly?
"Have the LLM parse this sentence into a JSON shopping cart" is many people's first instinct — it runs, but what you get is a piece of text you have to pray over.
| Capability | LLM generates JSON | Jev narrowing-options loop |
|---|---|---|
| Number of items | ❌ "how many she ordered" relies on the model counting; a miscount means missing or extra items | ✅ the loop finds one at a time and stops automatically; the code does the counting |
| Field value validity | ❌ may generate venti, 燕麦奶 — not on your menu | ✅ options are the valid values (size ∈ small/medium/large), answers always land within the options |
| Unmentioned fields | ❌ tends to fill in a "default medium" for the customer | ✅ the unspecified option explicitly reports "the order didn't say", leaving it to your default rules |
| Downstream parsing | ❌ JSON parse failures, hallucinated fields, layers of validation | ✅ typed answers + probability distributions, code can use them directly |
| Confidence | ❌ you have to ask "are you sure" | ✅ every decision carries its own confidence; low-confidence ones go to a staff member for manual confirmation |
In one sentence: an LLM will rewrite the order for you, while Jev only reads the order for you — every item and every field is a calibratable multiple-choice question.
Your current predicament
- "Have the LLM output shopping cart JSON — right nine times out of ten, and the one miss is a customer ordering three items while it spits out two — when complaints come in you can't even find which line of code is at fault"
- "The customer says 'a latte' without a size, and the model confidently makes up a medium and writes it into the order every time"
- "Every time the menu gets a new item, the parsing prompt has to be revised, followed by a full regression test"
When to use this technique
When you need to:
- Turn a natural-language sentence into structured data: ordering, configuration options, form filling, product attribute selection
- The candidate set is a known closed set — the menu is defined by you, and the valid field values are defined by you
- Variable quantity: she might order 1 item, she might order 5, unknown in advance
And you don't want to:
- Parse JSON spat out by an LLM and then write another layer of "did it make things up again" validation
- Have a generative model do the counting — the official pitfall guide explicitly says counting is unreliable, with errors growing with scale
- Retune the prompt every time the menu changes
🎒 Preparation before starting
- completed Choice questions: can write a
criteriaoptions map, can readchoiceandconfidence, and knows a question has at most 255 options - Recommended to have read Confidence: know how low-confidence answers get routed to human review
- [] installation and the first request:
.venvis available. This lesson can run entirely without a Key (official cache replay); to run live, setTYPESAFE_API_KEY - [] A cup of water ☕——this lesson is one complete mini-project: one loop plus a set of questions, turning "one sentence" into a "shopping cart"
Follow along
First, let's agree on how to run it: create cart.py, and paste each step's code block below in order into the same file, running python cart.py once after each step. All API calls go through the json_cache.json cache, so repeated runs cost nothing.
Step 1: Set up the environment, download the official cache, and prepare the menu and orders
Why: the officials recorded an answer cache for all 4 requests in this case json_cache.json; put it in the right place and you can reproduce every official number without calling the API; without it, set TYPESAFE_API_KEY and run for real.
Install dependencies (the official cookbook's original command; cooksafe is the official companion helper library, described on PyPI as "Shared helpers for the TypeSafe cookbooks"; its dependency declaration includes typesafe-sdk<0.8.0,>=0.7.0, so the SDK doesn't need to be listed separately):
pip install ipython 'cooksafe>=0.2.0,<0.3.0'Download the official cache (raw direct link; reproducing the official numbers without a Key depends entirely on it):
curl -sL -o json_cache.json https://raw.githubusercontent.com/typesafe-ai/typesafe-public-examples/main/cookbooks/cart_from_primitives/json_cache.jsonCreate cart.py and paste in the file header——client, cache, constants:
import os
from pathlib import Path
from cooksafe import JsonCache, make_playground_link
from IPython.display import Markdown, display
from typesafe_sdk import Choice, TypeSafeClient
TYPESAFE_MODEL = "jev-1.14.0" # 官方数字的录制版本
NOTHING_ELSE = "nothing_else" # the sentinel option that ends the item loop
MAX_ITEM_REQUESTS = 6 # a hard stop, so a bad answer can never loop forever
client = TypeSafeClient(
api_key=os.environ.get("TYPESAFE_API_KEY", "cache-only"), # cached re-renders need no key
model=TYPESAFE_MODEL,
timeout=30.0,
)
json_cache = JsonCache(Path("json_cache.json"))
def fmt_confidence(confidence: float | None) -> str:
"""A confidence for printing. The API can return None, so never format it blind."""
return f"{confidence:.2f}" if confidence is not None else "n/a"
print("setup ok")Run python cart.py.
You should see: setup ok——no requests sent yet.
Remember three names first: NOTHING_ELSE is the sentinel option that ends the loop; MAX_ITEM_REQUESTS = 6 is the hard cap——the official comment is very clear: it guards against one bad answer keeping the loop from ever stopping; fmt_confidence reminds you that confidence may be None, so don't format blindly.
- []
setup okwas printed out,json_cache.jsonis right in the working directory
Step 2: write the menu as data——descriptions for Jev to see, fields are the options
Why: where does the "structure" of natural-language-to-structured conversion live? The official answer is a dictionary: each item's description states how a customer would order it (a latte also gets called a flat white or milky coffee), and fields is its own schema——field names map to lists of legal values, and those values are the criteria options for that field question. The menu is data, not a prompt; to add new items just edit the dictionary.
Paste in the menu and orders:
MENU = {
"latte": {
"description": "Espresso with steamed milk. Also ordered as a flat white or a milky coffee.",
"fields": {
"size": ["small", "medium", "large"],
"milk": ["whole", "oat", "almond"],
},
},
"filter_coffee": {
"description": "Plain brewed drip coffee, sometimes ordered as a black coffee.",
"fields": {},
},
"blueberry_muffin": {
"description": "A blueberry muffin.",
"fields": {},
},
"almond_croissant": {
"description": "An almond croissant, sometimes ordered as a pastry.",
"fields": {},
},
}
ORDER = "Can I get a large oat milk latte and a blueberry muffin please"Two design points:
- Descriptions carry the ordering language: Jev matches the order against these descriptions——when the customer says "a milky coffee", what matches is the latte's description, not the literal word. That's why descriptions should say "how customers will say it" rather than "what this is"
- Only the latte has fields: size and milk are each a closed set; the other three items have no fields, and step 4 will simply skip their requests
Run python cart.py.
You should see: still only setup ok——the menu is just a data definition; not a single request is sent.
- [] I can state the respective roles of description and fields in
MENU, and why descriptions should include ordering synonyms
Step 3: the narrowing-options loop——the first stage of natural language to structured, finding each item
Why: how many items a customer orders isn't known in advance. Directly asking "how many did she order" makes the model count——the official pitfall guide (Jev 1.13 edition, 9 failure modes, see Jev 1.13 pitfall guide) states plainly: Jev counts unreliably, with error growing with the size of the set being counted; the alternative is code iterating over candidates, one question each. The shrinking-options loop is exactly that approach: each round one Choice question asks "which remaining item is mentioned first in the order"; once selected, it's stored and removed from the next round's options, and the whole sentence is sent again verbatim. This is also a true dependency under the official criterion——in the officials' own words: the second request is a true dependency only when code needs the previous answer to construct the next request (for example, to decide the next question's options).
First look at the loop as a whole, then paste the code:
Round 1 options = latte / filter_coffee / blueberry_muffin / almond_croissant + nothing_else
→ latte (0.99) stored, removed from next round's options
Round 2 options = filter_coffee / blueberry_muffin / almond_croissant + nothing_else
→ blueberry_muffin (1.00) stored, removed from next round's options
Round 3 options = filter_coffee / almond_croissant + nothing_else
→ nothing_else (1.00) ← sentinel selected, loop stopsPaste in the question builder, the single-request function, and the main loop:
def item_question(remaining: dict[str, dict], found: list[str]) -> Choice:
"""Build one request's question from the items not found yet."""
already = ", ".join(found) if found else "nothing yet"
criteria = {name: item["description"] for name, item in remaining.items()}
criteria[NOTHING_ELSE] = (
"The order mentions no menu item other than the ones already accounted for."
)
return Choice(
instructions=(
f"This is a cafe order. Items already accounted for: {already}. "
"Which remaining menu item does the order mention? If the order mentions more "
"than one remaining item, choose the one mentioned first."
),
criteria=criteria,
)
@json_cache
def ask_item(order: str, question: dict) -> dict:
"""One item request. The question arrives as its API JSON, which also keys the cache."""
answer = client.system_one(state=order, questions={"item": question}).choices["item"]
return {"choice": answer.choice, "confidence": answer.confidence}
def find_items(order: str) -> list[dict]:
remaining = list(MENU)
found: list[dict] = []
item_requests = 0
for _ in range(MAX_ITEM_REQUESTS):
if not remaining:
break
question = item_question(
{name: MENU[name] for name in remaining},
[item["name"] for item in found],
)
result = ask_item(order, question.model_dump(mode="json", exclude_none=True))
item_requests += 1
print(
f"item request {item_requests}: {len(remaining)} items + sentinel "
f"-> {result['choice']} (confidence {fmt_confidence(result['confidence'])})"
)
if result["choice"] == NOTHING_ELSE:
break
remaining.remove(result["choice"])
found.append({"name": result["choice"], "confidence": result["confidence"]})
return found
items = find_items(ORDER)
print(f"\nfound {len(items)} items: {[item['name'] for item in items]}")Run python cart.py——everything hits the official cache; not a single request is sent.
You should see (recorded by the official jev-1.14.0; reproduced verbatim in this page's live test):
item request 1: 4 items + sentinel -> latte (confidence 0.99)
item request 2: 3 items + sentinel -> blueberry_muffin (confidence 1.00)
item request 3: 2 items + sentinel -> nothing_else (confidence 1.00)
found 2 items: ['latte', 'blueberry_muffin']Four design points are worth pausing on:
- The sentinel is the loop's brake: a Choice must select an option; there's no "select none"——so every round includes
nothing_else, whose description states clearly "no items other than those already counted are mentioned in the order". When it's selected, the loop stops - instructions report progress: "Items already accounted for: nothing yet → latte → latte, blueberry_muffin"——each round tells the model what has been found so far, preventing it from re-reporting already-found items
- "Pick the first mentioned" disambiguates: when the order mentions more than one remaining item, select only the first-mentioned one——a deterministic rule, not the model improvising
- A triple-safeguard exit: sentinel selected, menu emptied,
MAX_ITEM_REQUESTScap——the loop is guaranteed to stop
💡 This is the unique value of Jev
This is a software loop, not an agent loop——the official building guide says plainly: "whatever can be expressed as a software workflow, don't use an agent's while loop." Control flow, exit conditions, and deduplication are all in your code; each round the model does only one extremely narrow thing: pick one from that round's options. If it picks wrong, the code's hard cap is the backstop; if it picks right, confidence tells you how solid that pick was.
- [] With zero Keys, produce 3 lines of item request and found 2 items; I can state the loop's three exit conditions and the role of the sentinel option
Step 4: one batch of requests per item to fill in fields
Why: Once all the items are found, the fields to ask about for each item are settled—the latte has size and milk, the muffin has no fields. The official approach is to send one request per item carrying all of its field questions (fan-out pattern: multiple questions evaluated in parallel against the same state), rather than one request per field. Each field question also includes the unspecified option—fields the customer didn't mention are explicitly answered as "the order didn't say," instead of being forced to pick a specific value.
Paste in the field-question construction and fill-in code:
UNSPECIFIED = "unspecified"
def field_questions(item_name: str) -> dict[str, Choice]:
questions = {}
for field, values in MENU[item_name]["fields"].items():
criteria = {value: None for value in values}
criteria[UNSPECIFIED] = (
f"The order does not say which {field} for the {item_name}."
)
questions[field] = Choice(
instructions=f"Which {field} did the order ask for, for the {item_name}?",
criteria=criteria,
)
return questions
@json_cache
def ask_fields(order: str, questions: dict[str, dict]) -> dict:
"""One field request. The questions arrive as their API JSON, which also keys the cache."""
response = client.system_one(state=order, questions=questions)
return {
field: {"choice": answer.choice, "confidence": answer.confidence}
for field, answer in response.choices.items()
}
def fill_fields(order: str, item_name: str) -> dict:
if not MENU[item_name]["fields"]:
return {}
questions = {
field: question.model_dump(mode="json", exclude_none=True)
for field, question in field_questions(item_name).items()
}
return ask_fields(order, questions)
cart = []
for item in items:
fields = fill_fields(ORDER, item["name"])
cart.append(
{"name": item["name"], "confidence": item["confidence"], "fields": fields}
)Run. The latte sends 1 request (the size + milk questions in parallel), and the blueberry muffin's fields is empty—the request is skipped entirely. Adding the 3 requests from step 3, the full case totals 4 requests.
You should see: no new output—this step only assembles the cart list in memory (the latte carries its two field answers, the muffin has an empty fields dictionary); step 5 does the printing.
- I can explain why the muffin sends no request, and which kind of "hallucinated default value" problem the
unspecifiedoption solves
Step 5: Code assembles the structured shopping cart
Why: Assembly is pure code work—no API calls at all. Each item carries its own confidence, and each field does too—which judgment is dragging things down is clear at a glance.
Paste in the printing code:
print(f'order: "{ORDER}"\n')
for line in cart:
print(f"{line['name']} (item confidence {fmt_confidence(line['confidence'])})")
for field, answer in line["fields"].items():
conf = fmt_confidence(answer["confidence"])
print(f" {field:<6} {answer['choice']:<12} confidence {conf}")Run.
You should see (recorded by the official jev-1.14.0; reproduced verbatim in this page's live test):
order: "Can I get a large oat milk latte and a blueberry muffin please"
latte (item confidence 0.99)
size large confidence 1.00
milk oat confidence 1.00
blueberry_muffin (item confidence 1.00)Check against the menu schema from step 2: the items are valid keys in the menu, size is large (one of the legal values), milk is oat (one of the legal values)—it's impossible for an item or field value outside the menu to appear, because answers can only be chosen from the options. That's the confidence behind "structured": the downstream order system always receives data within the schema.
- My output matches the official numbers verbatim: latte 0.99 / large 1.00 / oat 1.00 / blueberry_muffin 1.00
📋 Magic Prompts
The "Prompts" on this page are question templates for the API—copy them, replace the 【】 placeholders (those with ? are optional), and you can hook them up to your own menu or product catalog. The three-piece set: the item-finding question, the field-filling question, and the loop skeleton.
📝 Item-finding question (Choice narrowing version)
Expected effect: any need of the form "find all matching known entries from a single sentence"—ordering, picking configuration options, checking off services—fits this one question; put it in a loop to find them one by one.
from typesafe_sdk import Choice
# 必填项:remaining 传还没找到的商品(名字 -> 顾客会怎么点它的描述)
criteria = {【name】: 【商品描述,写顾客的同义叫法】 for name in 【remaining】}
criteria[【哨兵名】] = "【订单里没有提到已算过之外的商品】"
item_q = Choice(
instructions=(
f"【这是什么场景的一句话。已算过的:{【found 或 'nothing yet'】}。】"
"【订单里最先提到的剩余商品是哪样?提到多件时选最先说的】"
),
criteria=criteria,
)
# 选填项:场景词换掉 cafe order——配置单、服务预约、商品咨询?
# 输出规范:answer.choice 是商品名或哨兵名;answer.confidence 接复核线
# 约束条件:
# ✅ 描述写「顾客会怎么点它」,同义词写进去(flat white 也是 latte)
# ✅ 每轮把已找到的报进 instructions,防止重复报
# ❌ 别问「她点了几样」——计数交给循环,模型只做挑选✅ Field-filling question (field schema version)
Expected effect: turn each item's legal field values into one Choice question after another, asked in parallel in a single request; fields the customer didn't mention are explicitly reported as unspecified.
# 必填项:fields 是该商品的 schema:字段名 -> 合法值列表
questions = {}
for field, values in 【商品["fields"]】.items():
criteria = {value: None for value in values}
criteria[【"unspecified"】] = f"The order does not say which {field} for the {【商品名】}."
questions[field] = Choice(
instructions=f"【订单为这个商品点了哪个 {field}?】",
criteria=criteria,
)
# 选填项:unspecified 的下游处理——按你的默认值规则补,或转人工确认?
# 输出规范:每字段 answer.choice ∈ 合法值 ∪ {unspecified},各带 confidence
# 约束条件:
# ✅ 选项就是函数/系统接受的合法值——答案不可能越界
# ✅ 没有字段的商品跳过请求,别发空请求
# ❌ 不给 unspecified = 逼模型编一个值🔧 Loop skeleton (code version)
Expected effect: find an indeterminate number of entries, prevent infinite loops, cache to save money—one piece of pure code, unit-testable.
MAX_REQUESTS = 【6:硬上限,防坏答案死循环】
remaining, found = list(【MENU】), []
for _ in range(MAX_REQUESTS):
if not remaining:
break
result = ask(【order】, build_question(remaining, found))
if result["choice"] == 【哨兵名】:
break
remaining.remove(result["choice"])
found.append(result)
# 输出规范:found 是 [{name, confidence}, ...];件数 = len(found),由代码数
# 约束条件:
# ✅ 三个出口缺一不可:哨兵、候选清空、硬上限
# ✅ 请求函数挂 @json_cache——改菜单/改问题会换缓存键自动真跑,重跑零花费
# ❌ 别把循环交给模型自己「决定何时结束」——退出条件是代码的事Checkpoint ✅
- Without setting
TYPESAFE_API_KEYand with the officialjson_cache.jsonin place, I reproduced all the official numbers verbatim: latte 0.99 / blueberry_muffin 1.00 / nothing_else 1.00 / size large 1.00 / milk oat 1.00 - The full case totals 4 requests: 3 for finding items (including 1 sentinel) + 1 for filling the latte's fields; the muffin sent no request
- I can explain why a loop is used instead of asking "how many items were ordered": counts are unreliable; code iteration + one question per item is the official alternative approach
- I can explain that this is a "true dependency": the next round's options can only be constructed after the previous round's answers—this is exactly the situation the official criteria endorse for a second request
- I know the division of labor between
unspecifiedandnothing_else: the former means a field wasn't specified, the latter means all items have been found
Pitfall warnings
❌ Making the model output the entire shopping cart JSON
Generating everything in one shot tangles three things together—counting, field legality, and format: wrong item counts, invented values like venti that aren't on the menu, JSON parse failures—and when something goes wrong you don't know which link failed. The official decomposition makes each thing independently testable: item count comes from the loop count, legality is guaranteed by the options, and assembly is done by code. A generative model can't make this guarantee, because every character it outputs is typed fresh.
❌ Forgetting the sentinel option or the hard cap
Without nothing_else, the Choice is forced to pick one of the remaining items—an already-completed order will "grow" an extra item. Without MAX_ITEM_REQUESTS, a single bad answer can make the loop never stop. Write in both, and the loop is both correct and guaranteed to terminate.
❌ The model picks a field the customer never mentioned for her
Without an unspecified escape hatch, the model can only pick a specific value—"a latte, please" will confidently become a medium whole milk latte. The official solution is to include unspecified in every field question, and let downstream fill in per your default-value rules or hand off to a clerk for confirmation. For another official approach to the same scenario, see Agent decisions: the function-calling cookbook uses a separate yes/no question to determine "did the user mention this parameter," choosing between two exits.
❌ Taking Chinese-language orders straight to production
Official note: Jev is trained primarily in English and is most accurate in English; other languages (including Chinese) work but with lower accuracy—before going live, run a batch of your own Chinese-language orders and look at the probability distribution, paying special attention to confidence; see the language support notes in Models and pricing. Also note that changing the menu or the questions changes the cache key: cooksafe's cache key is built from the function name and arguments, so after changing MENU a rerun automatically makes real requests (it only succeeds if a Key is set); to force a rerun, delete json_cache.json.
Advanced tips (optional)
Quantity: add a quantity field. The official docs state this example's limitation explicitly: the shopping cart has no quantity field, so "two flat whites" still yields just one latte. The official fix: add a quantity field to each item's schema, with legal values like one / two / three—the batch request in step 4 will automatically ask for it as well.
Large menus: chunk first, then pick. A single Choice holds at most 255 options (see Choice questions for full details). For bigger menus, first pick the chunk (which category), then pick the item within the chunk—keeping each round within 255. The line-by-line search in Search and matching is the same idea in practice: label each of the 218 lines with an ID and let the Choice point to the matching line.
Try it code-free first. The official cookbook page has a ready-made Playground share link at the bottom—a complete order + the first round of the item-finding question (four items plus the sentinel); open it (https://console.typesafe.ai/playground), reword the order, and watch the answers change. To generate your own link:
playground_link = make_playground_link(ORDER, {"item": item_question(MENU, [])})
# Print a usable URL in a script; render a clickable link in a notebook.
if __name__ == "__main__" and "__file__" in globals():
print(f"Open in the TypeSafe playground:\n{playground_link}")
else:
display(Markdown(f"🔗 [Open the first item-finding request in the TypeSafe playground]({playground_link})"))Link generation happens offline and needs no API Key; the URL carries the complete state and questions, so don't put sensitive data in it. Watch the official recording: TypeSafe shopping cart demo.
into your ordering flow. Replace ORDER with chat messages, voice transcriptions, or form notes, and MENU with your product catalog; the answer structure stays the same, and the downstream order system accepts it as-is. More fields mean higher cost? Parallel Questions and Speculative Fan-out has measured the gains from batched questions: 13 questions in a single request are 12.2 times cheaper and 10.0 times faster than asking one by one, with unchanged answers.
Lesson Recap
✅ Natural language to structured data, officially split into two stages: a narrowing option loop to find products (quantities counted by code, nothing_else sentinel brake), then one batched request per product to fill in fields (valid values are the options, unspecified reports "not specified").
✅ Every judgment is calibratable: items 0.99 / 1.00, fields 1.00 / 1.00 — low-confidence judgments go to a clerk for manual confirmation instead of going straight into the order.
✅ Official numbers reproduced with zero keys: all 4 requests (3 finding items + 1 filling fields) hit the official cache, and this page replays them verbatim.
✅ The menu is data, not a prompt: adding a new item changes the MENU dictionary while the question templates stay untouched; any change automatically swaps the cache key and triggers a real run.
Key configuration fields at a glance:
| Field | Value on this page | Description |
|---|---|---|
TYPESAFE_MODEL | "jev-1.14.0" | Official numbers recorded on version (2026-10-29); live runs pin the version ID, don't use the drifting jev-latest |
NOTHING_ELSE | "nothing_else" | Sentinel option: selected when no items remain in the order, stopping the loop |
MAX_ITEM_REQUESTS | 6 | Hard cap: a third safety net beyond the sentinel and the emptied menu |
UNSPECIFIED | "unspecified" | The exit when a field isn't mentioned, preventing the model from hallucinating defaults |
MENU | 4 items, only latte has size/milk | Descriptions capture how customers phrase their orders; fields are the schema |
| Requests per order | N+1 item-finding calls + 1 call per item with fields | This example: 3+1=4 calls; all served from cache, only menu or question changes cause misses |
Related tutorials:
- Agent Decisions: Picking Skills, Converting to Function Calls — the same "one sentence into a structured call" idea applied to functions: one Choice question picks the function, one question per parameter fills the value; unmentioned parameters exit via a yes/no question
- Value Extraction: Dates, Emails, Phone Numbers, Amounts — also on the "Documents and Data" track: values can only come from the source text; regex finds candidates, Jev picks the right one
- Parallel Questions and Speculative Fan-out — why field questions are sent in batches: 13 questions in one request are 12.2x cheaper and 10.0x faster
Next Lesson Preview
A one-sentence order has become a shopping cart; the next question is which of a pile of candidates actually match. Next lesson: Search and Matching: Reranking, Line-by-Line Search, Entity Alignment.
You will learn:
- Reranking lifts CLERC legal-query top-1 hits from 5% to 18%, and top-10 from 38% to 62%
- Line-by-line semantic search over 218 lines of the GitHub ToS: assign each line an ID, and one Choice question points to the matching line — a large-scale version of this page's "options as candidates"
- How to use one Score question plus three Noul questions to find matching beers among 450 candidate pairs from two beer catalogs