Implement information extraction solutions 5.2 Extract content from documents

A custom Content Understanding document analyzer for contracts needs three fields…

Study guide skill: Implement analyzers for generating structured or markdown outputs for downstream reasoning by using Content Understanding

Question B5-020

A custom Content Understanding document analyzer for contracts needs three fields: ContractNumber exactly as printed, with its source location for a review UI; RiskLevel, which requires interpreting the clauses; and ContractType, which must be one of five fixed values. Which method assignment is correct?

Select one answer.

  • A ContractNumber: generate; RiskLevel: extract; ContractType: classify with an enum
  • B ContractNumber: extract, with estimateSourceAndConfidence set to true; RiskLevel: generate; ContractType: classify with an enum ✓ Correct answer
  • C All three: generate, because only generate fields can return a source location
  • D ContractNumber: extract, with estimateSourceAndConfidence left false; RiskLevel: generate; ContractType: generate, listing the five values in the description

Answer: B

Extract returns values as they appear in the content and requires estimateSourceAndConfidence set to true, which also returns the source location (page number and bounding box) for the review UI. Generate suits values that need interpretation, such as a risk level, and classify with an enum suits a fixed set of categories. Option C is wrong because source location isn't limited to generate: extract fields must return it, and listing values in a description doesn't make generate behave like classify with an enum.

Deep dive

How it works

Each field in a Content Understanding analyzer schema gets a method, and the analyzer reference defines three:

  • extract: values are extracted as they appear in the content. Best for literal text from specific locations. Extract requires estimateSourceAndConfidence set to true for the field.
  • generate: values are generated freely from the content by AI models. Best for complex or variable fields that need interpretation.
  • classify: values are classified against a predefined set of categories. Best when you use an enum with a fixed set of possible values.

Map the contract fields:

  1. ContractNumber must be exactly as printed and needs a source location for the review UI, so it's extract with estimateSourceAndConfidence true. That setting returns the source location (page number, bounding box) and a confidence score, and highlighting source text in user interfaces is one of its listed uses.
  2. RiskLevel requires interpreting clauses, so it's generate. The best-practices page uses risk level as its own example of a generate field.
  3. ContractType must be one of five fixed values, so it's classify with an enum.

The other options, and when you'd use them

  • ContractNumber generate, RiskLevel extract: Backwards. Generate produces values freely, which is wrong for an exact identifier, and extract only returns values as they appear, so it can't produce an interpreted risk level.
  • All three generate for source locations: estimateSourceAndConfidence returns the source location, and it must be true for extract fields. Source location isn't a generate-only feature.
  • estimateSourceAndConfidence false; ContractType generate: Extract requires estimateSourceAndConfidence set to true, and a fixed set of values is what classify with an enum is for.

Exam tip

Literal value + location = extract (with estimateSourceAndConfidence true). Needs interpretation = generate. Fixed list = classify with enum.

References

Last reviewed:

Ready to test yourself? The quiz asks this and every other AI-103 question, with instant feedback. Practice this in a quiz →

All Information extraction questions · AI-103 study guide

Thanks for your feedback!