Models, Retrieval, Tools, and Control Flow › Limitations & impact
Language AI HandbookAll chapters The parser deliberately recognizes a tiny vocabulary, whole-dollar amounts, and whole-number sizes. A correctly shaped query plan can still misread a constraint. Validate extraction against labeled questions and evaluate generation against the source records when replacing the stubs. The toy generator returns well-formed tuples. The wrapper assumes that shape and leaves generator exceptions to its caller. A production adapter can validate the wire payload and convert recognized execution errors into the outcomes its application supports.
For sequential calls that all run, stage latencies add. Adding a second model or a remote dependency therefore consumes part of the same request deadline. Returning early avoids later stages. Timing and costs should be measured on representative complete, partial, and rejected paths because the stage sequence varies with the request.
The program demonstrates a simulated policy check. Live inventory writes require a verified caller identity, authorization, and a transaction or another mechanism that accounts for concurrency and duplicate requests. Here the lookup only observes the supplied in-memory mapping and the reservation stays an output record.
Keep tests aimed at the contract. A catalog test can require that filtering implements a strict upper bound. A trace test can require that stock is queried only after an answer passes its reference check. A separate evaluation set would measure whether a real parser understands colloquial requests. Pass those resulting constraints through the same filter before comparing them with the expected output. This distinguishes a parser error, where the wrong limit was extracted, from a filter error, where the right limit was interpreted incorrectly.
A diagnostic trace is useful because it describes a particular path. It also has limits. The example has deterministic, locally measured fixtures and no concurrency. Two production calls may overlap in time, and a list of stages in one process would then lack timing for work performed in another service. Recording structured inputs and outcomes at component boundaries will make that later instrumenting job clearer. The following chapters add an evaluation plan and a way to connect timing and outcomes across dependencies.
A useful test harness stubs one dependency per failure case. To exercise the syntax check, return a plan whose intent is availability and whose size is missing. To exercise the attribution check, keep the query plan valid and give the generator an ID that filtering removed. To exercise partial service, retain the catalog answer and make inventory unavailable. If you change all three boundaries in one test, the first rejection can mask failures further downstream. The trace helps verify that the intended stage ran before the assertion.
A similar approach works for the positive path. A fixture where the only product is in stock confirms the caller can observe that count. A separate fixture asks for a reservation and checks the returned decision. The second assertion belongs next to an assertion that the mapping has its original count. That is the point at which the example's simulation boundary is enforced. A real inventory service would own any writes, and its tests would check that the persisted stock count changes once for the authorized operation and remains consistent when another request is processed concurrently.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!