liveBook · Manning

Output format

As explained in Effective Conversational AI

Structured output is generated information organized according to a predefined machine-readable format or set of fields.

A language model may understand a request yet return information in an inconvenient or unpredictable shape. Structured output organizes generated information into predefined fields or a machine-readable format, making it easier to review or pass to another application. section 12.3.2 section 7.3.2

Use explicit instructions and examples to make the expected structure clearer:

  • Choose the required fields before prompting; JSON is useful because downstream applications can consume it easily. section 12.3.2
  • State exact key names and value types when an application depends on them, such as ClaimID rather than ClaimNumber or numeric values rather than strings. section 12.3.2
  • Add a one-shot example when the model extracts too many fields, duplicates data, invents keys, or uses an unsuitable layout. section 12.3.2 section 7.3.2
  • Validate the result against the required format and review content for correctness, completeness, safety, and resilience to prompt injection. section 4.2.2

Extracting claim identifiers

A transcript-extraction prompt can request only TaxID, MemberID, and ClaimID, with numeric values. An unconstrained response may also include names, dates, and duplicate identifiers; a detailed example narrows the response to the desired keys. section 12.3.2

Listing 12.12 An extractive summary with one example
<|instruction|>
Read the following conversation transcript between a user and the automated assistant. Extract all IDs in JSON format.
Use only the following JSON keys: "TaxID", "MemberID",   #1
"ClaimID".   #1
The JSON values should be numbers, not strings.  #1

<|transcript|>  #2
AI: "Welcome to the automated assistant, how can I   #2
help?"   #2
User: "Claim status"  #2
AI: "Ok, claims. What's your Tax ID?"   #2
User: "333444555"  #2
AI: "Thank you. What's the member's eight-digit Member   #2
ID?"  #2
User: "55667788"   #2
AI: "Ok, and what's the member's date of birth?"  #2
User: "April 19, 2024"  #2
#2
<|JSON|>   #2
{"TaxID": 333444555, "MemberID": 55667788}  #2

<|transcript|>  #3
<... human-readable transcript removed for brevity ...>

<|JSON|>   #4
{"TaxID": 123456789, "MemberID": 87654321, "ClaimID":   #5
111222333}   #5

Inspect a constrained JSON prompt that specifies permitted keys and numeric values, then compare its compact result with less controlled extraction. section 12.3.2

How Effective Conversational AI covers it

How deep it goes
Explains field selection, JSON prompting, one-shot examples, and format evaluation, but does not detail parser implementation.
Examples
Demonstrates intent-labeled utterances and transcript extraction of TaxID, MemberID, and ClaimID.
What it assumes
Assumes familiarity with conversational transcripts and language-model prompting while teaching field selection and JSON constraints through examples.
What you can do after
Apply it via prompt examples and explicit schemas to guide extraction and assess whether generated responses meet required formats.
How it connects
Connects JSON to extractive summarization, transcript processing, intent classification, and generative AI evaluation.

Also explained in

Compare how 10 books explain output format →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Conversational AI. The section links point to the parts of the book it draws on.