Back to changelog

Page classification now includes reasoning explanations

Page classification results now include the model's reasoning for each decision to help with debugging and prompt engineering.

Key Highlights

  • Detailed explanations for why pages received specific classifications
  • Helps identify prompt engineering opportunities and debug classification errors
  • Automatically included in all classification results with no performance impact

What's new#

Page classification results now include the model's reasoning for each classification decision. When pages are classified, you'll receive both the classification labels and a text explanation of why those labels were chosen.

Why it matters#

  • Debug classification errors - understand why pages got unexpected labels
  • Improve prompt engineering - see how the model interprets your classification prompts
  • Build confidence - verify the model's decision-making process
  • Iterate faster - refine prompts based on reasoning insights

Highlights#

  • Detailed reasoning for each page classification
  • Helps identify prompt engineering opportunities
  • Useful for complex documents where classification logic isn't obvious
  • No performance impact - reasoning is generated alongside classification

How to use#

Reasoning is automatically included in classification results:

1doc_ai = DocumentAI() 2 3result = doc_ai.parse_and_wait( 4 file="complex_document.pdf", 5 page_classification=PageClassificationConfig( 6 page_classes=["Terms", "Transactions", "Account_Info"] 7 ) 8) 9 10for page in result.pages: 11 print(f"Page {page.page_number}:") 12 print(f"Classifications: {page.classifications}") 13 print(f"Reasoning: {page.classification_reasoning}")

Example output:

1{ 2"page_class": "Terms", 3"page_numbers": [ 4 2 5], 6"classification_reasons": { 7 "2": "The page provides instructions on how to balance an account, which involves managing account information and balances. It also details how to track and reconcile deposits and withdrawals, directly relating to transactions. Furthermore, it outlines terms and procedures for resolving errors, understanding billing rights, and calculating finance charges, which fall under terms and conditions." 8} 9},

Use cases#

  • Prompt debugging - See why certain pages aren't getting expected classifications
  • Model validation - Verify the classification logic makes sense for your use case
  • Documentation - Generate explanations for downstream users about document structure
  • Quality assurance - Spot-check model reasoning on complex documents

Status#

✅ Live now. Classification reasoning included automatically in all page classification results.

This website uses cookies to enhance your browsing experience. By clicking "Accept All Cookies", you consent to the use of ALL cookies. By clicking "Decline", only essential cookies will be used. Read our Privacy Policy for more details.