Skip to main content
    All shows

    Tuesday, November 17 · 14 min

    Prompt, context and structured outputs — Listen & Learn

    0:00-:--
    Speed

    Transcript

    Koko: A support proposal can be perfectly formatted and still be wrong. It can cite a real document and still misrepresent the policy. It can correctly describe eligibility and still lack permission to submit an action. We need three separate layers: task instructions, evidence supplied as data, and application enforcement of the result. This episode follows a return request through those layers and turns a prompt into a versioned, testable interface.

    Chris: The return seems ordinary: a customer bought something recently and asks for a refund. But we do not yet know whether the item was final-sale or whether the cited policy was effective on the purchase date. If I ask the model for a confident answer before assembling those facts, fluency may hide the uncertainty. I want the output contract to allow a useful review request rather than force a recommendation.

    Koko: Begin a prompt package with a version, task instructions, schema version and evidence-selection policy. Describe what to do when facts are absent or policies conflict. Keep the task instruction distinct from retrieved text and user input. Labels and delimiters can help communicate that distinction, but they cannot enforce authorization. A paragraph saying ignore the supervisor remains document content, even when it appears in a policy corpus that the application normally trusts for facts.

    Chris: That means I should not solve every problem by elevating a document into privileged instructions. A policy source can supply eligibility rules without gaining authority to change tool permissions. I would preserve its identity and version while restricting its role to evidence. If it includes an instruction to export the conversation, the application should still lack an approved outbound capability for that request and should never expose secrets just to let the model decide. How should we select the evidence package?

    Koko: For our worked context, retrieve the authorized thirty-day return provision and the final-sale exclusion. Attach stable passage identifiers, version or effective-date metadata, and relevant ticket facts. The model needs enough context to evaluate both the broad rule and its qualifications. Sending every historical document is not automatically safer. It can add contradictory versions, irrelevant personal information and more hostile text while consuming the space needed for decision-critical evidence.

    Chris: A context budget is therefore a selection problem before it becomes a compression problem. I would first determine which corpus and versions this caller may access, then which passages cover the decision. Only then would I shorten material. If a summary keeps the thirty-day rule but drops the final-sale exclusion, it has changed the decision basis. A reduced token count would be real, but an improvement claim would still require targeted quality evidence.

    Koko: Preserve lineage through every transformation. A summary of two passages must retain references to the exact versions used. Do not attach a current document after generation and pretend the model saw it. Historical traceability explains the original proposal; freshness determines whether it may still proceed. Overwriting old evidence to appear current undermines both.

    Chris: For the missing purchase date, I would include an explicit unknown instead of a guessed value. The prompt can ask for missing facts and a review outcome when eligibility is not established. A competing design always selects the most likely answer, which may look helpful in ordinary examples but fails exactly where evidence is weak. We should evaluate whether the system asks the right question, not punish every refusal to guess as an unhelpful answer. What output contract makes those unknowns visible?

    Koko: Now design the output object. A proposal could contain decision, evidence identifiers, missing facts and a concise explanation. Use a closed decision enum and required fields supported by the selected structured-output interface. Structured Outputs constrains completed, non-refusal output to the supplied supported schema. It does not establish factual correctness or action permission. Function calling is the surface for tool requests; a structured response object and a tool invocation serve different integration purposes.

    Chris: If the model returns a decision called probably_refund when the schema permits only propose or needs_review, shape validation should reject it. But if it returns propose with a valid array and fluent explanation, I still have work to do. I must check whether every cited ID belongs to the authorized evidence set, whether blocking facts are missing, and whether those passages actually support the eligibility claim. Shape is only the first boundary.

    Koko: Use successive checks that can explain their own failure. Parse the response, handle its lifecycle outcome, validate shape, verify evidence membership and versions, apply deterministic business prerequisites, and assess claim support. Keep authorization separate after these checks. Some rules are exact, such as rejecting an unknown citation ID. Others require a reviewed rubric or human judgment, such as whether a passage supports a nuanced exception. Do not claim that one validator solves both by implication.

    Chris: Suppose the proposal cites policy four-oh-four, which never appeared in retrieval. I should reject that reference before approval. Replacing it with the nearest real ID would make the output look grounded without establishing support. Another failure is subtler: the citation points to a real installation section, while the claim concerns warranty eligibility. Membership passes, but the cited text does not entail the claim. Both failures need explicit outcomes, even though only one is a fabricated ID. Where does a real citation still fall short?

    Koko: Provider outcomes also need branches. A refusal is not an ordinary proposal with awkward wording. An incomplete response is not successful just because a prefix parses. The application should recognize these outcomes before attempting to use a domain object. SDK helpers can make parsing easier, but they do not remove the need for application decisions about refusal, missing evidence and business constraints. Review the chosen interface’s current supported schema behavior before live implementation.

    Chris: A weak parser might default every missing object to decision propose so the workflow continues. That would transform refusal or interruption into an invented recommendation. A safer application can return a distinct refused or incomplete outcome, preserve only appropriate diagnostics and avoid requesting action approval for nonexistent content. I would test these paths directly with fixtures instead of waiting for a live model to happen to produce each one during a demonstration.

    Koko: Now inspect a schema-valid but unsupported proposal. Our customer has a final-sale item, yet the object cites only the thirty-day rule and says eligible. The right diagnosis depends on the evidence context. If retrieval omitted the exclusion, investigate coverage. If the exclusion was present but ignored, investigate grounding and decision quality. A successful schema check should remain reported as successful; it was never intended to establish policy correctness.

    Chris: That classification helps us avoid random prompt edits. If we keep adding warnings about accuracy while retrieval still excludes the controlling passage, we may improve confidence language without fixing the cause. I would trace the claim back through the exact context and retrieval configuration. The repair experiment should target the earliest defective boundary, then confirm the final recommendation improves without weakening missing-evidence behavior or other required slices.

    Koko: Treat a prompt revision as a versioned engineering change. Record instructions, schema, model configuration and retrieval settings. Keep development cases separate from confirmation evidence. Include absent facts, conflicting policies and hostile passages alongside ordinary questions. Direct questions alone can reward quick answers while revealing little about whether the system handles uncertainty.

    Chris: I would define rubric anchors before comparing versions. For example, a missing purchase date should produce a review request naming that fact; a final-sale case should not be justified with the broad rule alone. I would also keep deterministic checks for unknown citations and unauthorized effects. An aggregate score is useful for navigation, but the report must retain slice results and critical failures so a strong average cannot conceal the behavior we most need to improve. How do we exercise those branches without a live call?

    Koko: In the lab, write prompt version one, a proposal schema and an application validator. Use the starter object that claims eligibility while citing an absent policy ID. Feed it through the evidence-membership check and record the rejection reason. Then add a needs_review object with a missing fact, a refusal outcome, an incomplete output and a real-but-irrelevant citation. The exercise is inspectable offline; it makes no claim about which prompt a live provider follows more reliably.

    Chris: For the allowed evidence set, I would use exact passage identifiers including version and section. The unknown ID should fail deterministically. A valid ID with an unsupported claim should reach the separate support review and fail there. The needs_review object should preserve the missing fact rather than invent eligibility. This gives me meaningful result categories instead of one broad invalid label that would make debugging every case feel identical.

    Koko: Store the prompt and schema version with each fixture result. Keep evidence versions and case identity too. A validator result can be replayed against those inputs, while a future model comparison can use the same declared contract. The report should say which fixtures passed and which model qualities remain unmeasured. Do not calculate imaginary provider costs or label fixture elapsed time as a model benchmark simply because the harness prints numbers.

    Chris: The live-experiment plan can still be concrete without making a live call. I would freeze the cases and rubric, select the intended model configuration, specify actual usage and elapsed-time capture, and define the release gates. That plan creates a reviewable next step. It does not require a key to be embedded in course materials, and it does not turn our offline demonstration into evidence about production accuracy.

    Koko: For transfer, add a time-limited exception requiring a purchase date and another eligibility fact. Identify changes to context selection and business validation. Preserve the exception version and block proposing when the date is unknown. Another example answer alone is insufficient: the learner must adapt the evidence contract when eligibility becomes more specific.

    Chris: I would also run a hostile passage that tells the assistant to ignore missing facts. The model’s response is useful behavioral evidence, but the business validator should still reject a proposal that lacks required eligibility information. If the attack succeeds in wording but not in effect, we should report both facts. That distinction helps improve grounding without mistaking one model refusal for a complete security boundary. What would justify calling a prompt revision better?

    Koko: When comparing prompt versions, show tradeoffs. Suppose version two improves direct-ticket answers but starts proposing when policy coverage is absent. Report the improved and regressed slices with denominators and configuration versions. Do not drop the inconvenient cases or rely on one persuasive example. If the missing-evidence gate fails, the revision is not ready under that gate, even when the overall average increases. An experiment should inform a decision, not decorate a preferred conclusion.

    Chris: If I tune version three after reading the held-out failures, those cases have become development evidence. Renaming the IDs or shuffling question order does not make the content unseen again. I should record exposure, keep the failed results and use fresh confirmation cases. That discipline is especially important when a team tries many prompt versions and reports only the last one: selection on the same set makes the final score easier to overinterpret.

    Koko: Distinguish a well-formed object, a supported claim and an authorized effect. Scope and preserve evidence, provide honest refusal and incomplete paths, and evaluate ordinary plus adversarial cases. These separate boundaries make a prompt interface investigable. Impressive example answers alone do not establish an application contract another engineer can reproduce.

    Chris: For my review, I will bring the versioned prompt, schema, layered validator, fixture report and comparison plan. I should be able to point to the exact stage that rejects an invented citation, the separate stage that rejects unsupported eligibility, and the application boundary that still requires approval. If those answers blur together, I have more design work to do before treating a valid JSON object as a usable support proposal.