Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 07 · AI · On a real model · with code: Python · about 23 min to read

Play it as a journeyTutor comes with a plan

The Returns Desk, For Real (a real model, a real harness, and a dress rehearsal that fails)

The Harness
The Harness · Open board

Building with LLMs. The board traces one turn of the returns desk through every box around the model. This lesson builds them in about four hundred lines of Python around a real model, then rehearses the desk until something breaks.

Before you start. The returns desk is a support assistant that can look an order up with lookup_order and open a return with start_return, on top of a model that only writes text (What the Model Sees (one string, every turn, from the top)). A tool call is the model filling in a small form asking your code to run one of those (Structured Output and Tool Schemas (the contract between model and code)). The harness is the ordinary code wrapped around the model (The Harness (everything around the loop that the model never touches)). A loop cap is the most times the harness asks the model about one customer message before handing over to a person (The Loop (an agent is a while loop around one model call)). The state machine is the six boxes a return moves through, IDENTIFY, VERIFY, ELIGIBLE?, CONFIRM, EXECUTE and DONE, plus ESCALATE for a person (Graphs and State Machines (when the shape of the task is known, draw it)). A rung is one check a tool call must pass before it runs (Guardrails, Cost and Latency (the three budgets the harness enforces)). An eval set is your own list of cases with a checkable answer beside each (Evals for Apps (the test suite for a program that is a string)). An injection is text that tries to talk the model into something, like a fake “system note” in a message (Red-Teaming (breaking your own model before a customer does)).

Lesson 68 of 83 in AI

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 17 June 2024: τ-bench, a fake shop graded by its end state
  • A headless call: a real model, from a Python script
  • The build: two tools, six boxes, and rungs that never ask the model
  • Sixteen scripted conversations: the dress rehearsal
  • The first rehearsal: 13 of 16, and a desk that refused politely
  • The re-run: 15, then 16, and a flaky row
  • Can a plain script talk to a real model?
  • One customer, then sixteen
  • Why did the customer with order 5002 get stuck?
  • Did the fix hold, and what does a customer cost?
  • All of it in code

Terms it explains: end-state grading, headless, scripted conversation, flaky, pass^k.

Related paper

Review AI