Merged PDF Processing Results

Back to Dashboard
PDF Information
Original Filename: ilovepdf_merged_9_merged.pdf
Upload Date: January 02, 2026 at 09:45 AM
Total Pages: 34
Processing Status: Partial
Extraction Summary
Total Documents: 7
Loan Statements: 2
Nominal Ledgers: 1
Mortgage Statements: 1
Hp Agreements: 1
Payroll Statements: 2
Page Classification Results
Page 1

Unknown

60%
Page 2

Loan Statement

95%
Page 3

Loan Statement

90%
Page 4

Loan Statement

95%
Page 5

Loan Statement

95%
Page 6

Loan Statement

95%
Page 7

Unknown

80%
Page 8

Loan Statement

95%
Page 9

Loan Statement

95%
Page 10

Nominal Ledger

95%
Page 11

Nominal Ledger

95%
Page 12

Nominal Ledger

95%
Page 13

Nominal Ledger

95%
Page 14

Nominal Ledger

95%
Page 15

Nominal Ledger

95%
Page 16

Nominal Ledger

95%
Page 17

Nominal Ledger

95%
Page 18

Nominal Ledger

95%
Page 19

Nominal Ledger

95%
Page 20

Nominal Ledger

95%
Page 21

Mortgage Statement

95%
Page 22

Mortgage Statement

95%
Page 23

Mortgage Statement

95%
Page 24

Mortgage Statement

95%
Page 25

Mortgage Statement

95%
Page 26

Unknown

70%
Page 27

Hp Agreement

98%
Page 28

Hp Agreement

95%
Page 29

Hp Agreement

95%
Page 30

Hp Agreement

95%
Page 31

Hp Agreement

95%
Page 32

Unknown

80%
Page 33

Payroll Statement

95%
Page 34

Payroll Statement

95%
Extracted Documents 7
Document Type Pages Confidence Processing Status Created Actions
Loan Statement 2-6 (5 pages) 94% Processed 2026-01-02 09:46 View
Loan Statement 8-9 (2 pages) 95% Processed 2026-01-02 09:46 View
Nominal Ledger 10-20 (11 pages) 95% Processed 2026-01-02 09:46 No view available
Mortgage Statement 21-25 (5 pages) 95% Processed 2026-01-02 09:46 View
Hp Agreement 27-31 (5 pages) 96% Processed 2026-01-02 09:46 View
Payroll Statement 33 (1 page) 95% Failed 2026-01-02 09:46 Processing...
Payroll Statement 34 (1 page) 95% Failed 2026-01-02 09:46 Processing...
{
  "document_groups": [
    {
      "avg_confidence": 0.9400000000000001,
      "document_identifiers": {
        "agreement_date": null,
        "amount_financed": null,
        "annual_interest_rate": "13.2% p.a.",
        "invoice_date": null,
        "invoice_number": null,
        "loan_reference": "RS0008610B32Z",
        "loan_tenure": "60 months",
        "monthly_payment": null,
        "monthly_payment_amount": "\u00a32,399.83",
        "mortgage_account_number": null,
        "outstanding_balance": "\u00a352,204.64",
        "property_address": null,
        "remaining_term_months": null,
        "seller_name": null,
        "statement_period": "30-03-2022 to 30-04-2024",
        "total_amount": null
      },
      "document_type": "loan_statement",
      "end_page": 6,
      "pages": [
        {
          "confidence_score": 0.95,
          "document_type": "loan_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and contains key indicators such as \u0027Loan Start Date\u0027, \u0027Original Loan Amount\u0027, \u0027Interest Rate\u0027, \u0027Total Principal Outstanding\u0027, and \u0027Final Repayment Due\u0027. Additionally, it includes a loan reference number and details about payments made, which are typical of loan statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": \"60 months\",\n        \"loan_reference\": \"RS0008610B32Z\",\n        \"annual_interest_rate\": \"13.2% p.a.\",\n        \"outstanding_balance\": \"\u00a352,204.64\",\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW06HfPvUGtmXqtMesXTmBy0IeNs\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Loan Statement\\\u0027 and contains key indicators such as \\\u0027Loan Start Date\\\u0027, \\\u0027Original Loan Amount\\\u0027, \\\u0027Interest Rate\\\u0027, \\\u0027Total Principal Outstanding\\\u0027, and \\\u0027Final Repayment Due\\\u0027. Additionally, it includes a loan reference number and details about payments made, which are typical of loan statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": \"60 months\",\\n        \"loan_reference\": \"RS0008610B32Z\",\\n        \"annual_interest_rate\": \"13.2% p.a.\",\\n        \"outstanding_balance\": \"\u00a352,204.64\",\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347086, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=244, prompt_tokens=1488, total_tokens=1732, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, r"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": "13.2% p.a.",
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": "RS0008610B32Z",
                  "loan_tenure": "60 months",
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": "\u00a352,204.64",
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document is titled \u0027Loan Statement\u0027 and contains key indicators such as \u0027Loan Start Date\u0027, \u0027Original Loan Amount\u0027, \u0027Interest Rate\u0027, \u0027Total Principal Outstanding\u0027, and \u0027Final Repayment Due\u0027. Additionally, it includes a loan reference number and details about payments made, which are typical of loan statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and contains key indicators such as \u0027Loan Start Date\u0027, \u0027Original Loan Amount\u0027, \u0027Interest Rate\u0027, \u0027Total Principal Outstanding\u0027, and \u0027Final Repayment Due\u0027. Additionally, it includes a loan reference number and details about payments made, which are typical of loan statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": \"60 months\",\n        \"loan_reference\": \"RS0008610B32Z\",\n        \"annual_interest_rate\": \"13.2% p.a.\",\n        \"outstanding_balance\": \"\u00a352,204.64\",\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "loan_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.16200501253132832,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.03529411764705882
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.038461538461538464,
                  "pattern_score": 0.0,
                  "total_score": 0.023076923076923078
                },
                "invoice": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.0,
                  "total_score": 0.03333333333333333
                },
                "loan_statement": {
                  "keyword_score": 0.06666666666666667,
                  "pattern_score": 0.09090909090909091,
                  "total_score": 0.11454545454545456
                },
                "mortgage_statement": {
                  "keyword_score": 0.10526315789473684,
                  "pattern_score": 0.09523809523809523,
                  "total_score": 0.16200501253132832
                },
                "nominal_ledger": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.041666666666666664,
                  "pattern_score": 0.0,
                  "total_score": 0.045
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "mortgage_statement"
            }
          },
          "page_number": 2,
          "text_length": 1942
        },
        {
          "confidence_score": 0.9,
          "document_type": "loan_statement",
          "features": {
            "llm_based": {
              "confidence": 0.9,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.9,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and includes references to a loan, such as the company name \u0027LendingCrowd\u0027, which is a lending platform, and mentions of fees and capital at risk. These are key indicators of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW075g9qNhw4bLe6ZWmzWhWigExi\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.9,\\n    \"reasoning\": \"The document is titled \\\u0027Loan Statement\\\u0027 and includes references to a loan, such as the company name \\\u0027LendingCrowd\\\u0027, which is a lending platform, and mentions of fees and capital at risk. These are key indicators of a loan statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347087, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=212, prompt_tokens=1132, total_tokens=1344, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(audio_tokens=0, cached_tokens=0))"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document is titled \u0027Loan Statement\u0027 and includes references to a loan, such as the company name \u0027LendingCrowd\u0027, which is a lending platform, and mentions of fees and capital at risk. These are key indicators of a loan statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.9,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and includes references to a loan, such as the company name \u0027LendingCrowd\u0027, which is a lending platform, and mentions of fees and capital at risk. These are key indicators of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "loan_statement"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.11454545454545456,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "loan_statement": {
                  "keyword_score": 0.06666666666666667,
                  "pattern_score": 0.09090909090909091,
                  "total_score": 0.11454545454545456
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.013888888888888888,
                  "pattern_score": 0.0,
                  "total_score": 0.015
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "loan_statement"
            }
          },
          "page_number": 3,
          "text_length": 585
        },
        {
          "confidence_score": 0.95,
          "document_type": "loan_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and includes key indicators such as loan payments, payment dates, principal, interest, total paid, and balance. It also mentions a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references LendingCrowd, a financial institution. These elements are consistent with a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a371,021.48\",\n        \"statement_period\": \"30-03-2022 to 30-04-2024\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,399.83\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW09nAfMHwGVCD4zBi3JOCA00HrB\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Loan Statement\\\u0027 and includes key indicators such as loan payments, payment dates, principal, interest, total paid, and balance. It also mentions a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references LendingCrowd, a financial institution. These elements are consistent with a loan statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a371,021.48\",\\n        \"statement_period\": \"30-03-2022 to 30-04-2024\",\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a32,399.83\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347089, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=256, prompt_tokens=2075, total_tokens=2331, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0,"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": "\u00a32,399.83",
                  "mortgage_account_number": null,
                  "outstanding_balance": "\u00a371,021.48",
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "30-03-2022 to 30-04-2024",
                  "total_amount": null
                },
                "llm_reasoning": "The document is titled \u0027Loan Statement\u0027 and includes key indicators such as loan payments, payment dates, principal, interest, total paid, and balance. It also mentions a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references LendingCrowd, a financial institution. These elements are consistent with a loan statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and includes key indicators such as loan payments, payment dates, principal, interest, total paid, and balance. It also mentions a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references LendingCrowd, a financial institution. These elements are consistent with a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a371,021.48\",\n        \"statement_period\": \"30-03-2022 to 30-04-2024\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,399.83\"\n    }\n}\n```"
              },
              "type": "loan_statement"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.22909090909090912,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.03529411764705882
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.0,
                  "total_score": 0.03333333333333333
                },
                "loan_statement": {
                  "keyword_score": 0.13333333333333333,
                  "pattern_score": 0.18181818181818182,
                  "total_score": 0.22909090909090912
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.013888888888888888,
                  "pattern_score": 0.0,
                  "total_score": 0.015
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "loan_statement"
            }
          },
          "page_number": 4,
          "text_length": 2080
        },
        {
          "confidence_score": 0.95,
          "document_type": "loan_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and includes key indicators such as payment dates, principal amounts, interest amounts, total paid, and remaining balance. It also references a company name and includes details of loan repayments, which are characteristic of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a352,204.64\",\n        \"statement_period\": \"30-05-2024 to 29-01-2025\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0AU6Ff5tLqdQfhpRoJNUyujdOS\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Loan Statement\\\u0027 and includes key indicators such as payment dates, principal amounts, interest amounts, total paid, and remaining balance. It also references a company name and includes details of loan repayments, which are characteristic of a loan statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a352,204.64\",\\n        \"statement_period\": \"30-05-2024 to 29-01-2025\",\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347090, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=233, prompt_tokens=1454, total_tokens=1687, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": "\u00a352,204.64",
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "30-05-2024 to 29-01-2025",
                  "total_amount": null
                },
                "llm_reasoning": "The document is titled \u0027Loan Statement\u0027 and includes key indicators such as payment dates, principal amounts, interest amounts, total paid, and remaining balance. It also references a company name and includes details of loan repayments, which are characteristic of a loan statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and includes key indicators such as payment dates, principal amounts, interest amounts, total paid, and remaining balance. It also references a company name and includes details of loan repayments, which are characteristic of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a352,204.64\",\n        \"statement_period\": \"30-05-2024 to 29-01-2025\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "loan_statement"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.11454545454545456,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.03529411764705882
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.0,
                  "total_score": 0.03333333333333333
                },
                "loan_statement": {
                  "keyword_score": 0.06666666666666667,
                  "pattern_score": 0.09090909090909091,
                  "total_score": 0.11454545454545456
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.013888888888888888,
                  "pattern_score": 0.0,
                  "total_score": 0.015
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "loan_statement"
            }
          },
          "page_number": 5,
          "text_length": 1104
        },
        {
          "confidence_score": 0.95,
          "document_type": "loan_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and contains key indicators such as scheduled payments, principal, interest, total payment amounts, and outstanding balances. It also includes a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references to LendingCrowd, a financial institution. These are clear indicators of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a350,379.05\",\n        \"statement_period\": \"28 February 2025 to 28 February 2027\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,399.83\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0CPyoTYak2aFvl6iPHA3ihBO5X\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Loan Statement\\\u0027 and contains key indicators such as scheduled payments, principal, interest, total payment amounts, and outstanding balances. It also includes a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references to LendingCrowd, a financial institution. These are clear indicators of a loan statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a350,379.05\",\\n        \"statement_period\": \"28 February 2025 to 28 February 2027\",\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a32,399.83\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347092, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=254, prompt_tokens=1960, total_tokens=2214, completion_tokens_details=CompletionTokensDetails(accepted_prediction_t"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": "\u00a32,399.83",
                  "mortgage_account_number": null,
                  "outstanding_balance": "\u00a350,379.05",
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "28 February 2025 to 28 February 2027",
                  "total_amount": null
                },
                "llm_reasoning": "The document is titled \u0027Loan Statement\u0027 and contains key indicators such as scheduled payments, principal, interest, total payment amounts, and outstanding balances. It also includes a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references to LendingCrowd, a financial institution. These are clear indicators of a loan statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and contains key indicators such as scheduled payments, principal, interest, total payment amounts, and outstanding balances. It also includes a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references to LendingCrowd, a financial institution. These are clear indicators of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a350,379.05\",\n        \"statement_period\": \"28 February 2025 to 28 February 2027\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,399.83\"\n    }\n}\n```"
              },
              "type": "loan_statement"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.11454545454545456,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.03529411764705882
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.0,
                  "total_score": 0.03333333333333333
                },
                "loan_statement": {
                  "keyword_score": 0.06666666666666667,
                  "pattern_score": 0.09090909090909091,
                  "total_score": 0.11454545454545456
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.013888888888888888,
                  "pattern_score": 0.0,
                  "total_score": 0.015
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "loan_statement"
            }
          },
          "page_number": 6,
          "text_length": 1855
        }
      ],
      "start_page": 2
    },
    {
      "avg_confidence": 0.95,
      "document_identifiers": {
        "agreement_date": null,
        "amount_financed": null,
        "annual_interest_rate": null,
        "invoice_date": null,
        "invoice_number": null,
        "loan_reference": "BSCSAQUA2863D8",
        "loan_tenure": "72 months",
        "monthly_payment": null,
        "monthly_payment_amount": "\u00a32,058.24",
        "mortgage_account_number": null,
        "outstanding_balance": null,
        "property_address": null,
        "remaining_term_months": null,
        "seller_name": null,
        "statement_period": "27/02/2023 to 28/07/2025",
        "total_amount": null
      },
      "document_type": "loan_statement",
      "end_page": 9,
      "pages": [
        {
          "confidence_score": 0.95,
          "document_type": "loan_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as a loan reference number (\u0027BSCSAQUA2863D8\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. These are characteristic elements of a loan account statement. There is no mention of property addresses, hire purchase agreements, or other indicators of different document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": \"72 months\",\n        \"loan_reference\": \"BSCSAQUA2863D8\",\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"27/02/2023 to 28/07/2025\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,058.24\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0HrqRJpTHRS5L1VGjtGK5ABkII\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as a loan reference number (\\\u0027BSCSAQUA2863D8\\\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. These are characteristic elements of a loan account statement. There is no mention of property addresses, hire purchase agreements, or other indicators of different document types.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": \"72 months\",\\n        \"loan_reference\": \"BSCSAQUA2863D8\",\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": \"27/02/2023 to 28/07/2025\",\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a32,058.24\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347097, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=273, prompt_tokens=1698, total_tokens=1971, completion_tokens_deta"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": "BSCSAQUA2863D8",
                  "loan_tenure": "72 months",
                  "monthly_payment": null,
                  "monthly_payment_amount": "\u00a32,058.24",
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "27/02/2023 to 28/07/2025",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a loan statement, such as a loan reference number (\u0027BSCSAQUA2863D8\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. These are characteristic elements of a loan account statement. There is no mention of property addresses, hire purchase agreements, or other indicators of different document types.",
                "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as a loan reference number (\u0027BSCSAQUA2863D8\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. These are characteristic elements of a loan account statement. There is no mention of property addresses, hire purchase agreements, or other indicators of different document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": \"72 months\",\n        \"loan_reference\": \"BSCSAQUA2863D8\",\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"27/02/2023 to 28/07/2025\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,058.24\"\n    }\n}\n```"
              },
              "type": "loan_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.07058823529411765,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.11764705882352941,
                  "pattern_score": 0.0,
                  "total_score": 0.07058823529411765
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.038461538461538464,
                  "pattern_score": 0.0625,
                  "total_score": 0.04807692307692308
                },
                "invoice": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.0,
                  "total_score": 0.03333333333333333
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.02631578947368421,
                  "pattern_score": 0.0,
                  "total_score": 0.025263157894736838
                },
                "nominal_ledger": {
                  "keyword_score": 0.08333333333333333,
                  "pattern_score": 0.0,
                  "total_score": 0.065
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "bank_statement"
            }
          },
          "page_number": 8,
          "text_length": 1695
        },
        {
          "confidence_score": 0.95,
          "document_type": "loan_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as a loan reference number (\u0027BSCSAQUA2863D8\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. Additionally, it includes a loan withdrawal transaction, which is a common feature of loan statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": \"72 months\",\n        \"loan_reference\": \"BSCSAQUA2863D8\",\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,058.24\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0J4S2B7phU27yODETcUitzgXJM\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as a loan reference number (\\\u0027BSCSAQUA2863D8\\\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. Additionally, it includes a loan withdrawal transaction, which is a common feature of loan statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": \"72 months\",\\n        \"loan_reference\": \"BSCSAQUA2863D8\",\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a32,058.24\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347099, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=247, prompt_tokens=1298, total_tokens=1545, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, reject"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": "BSCSAQUA2863D8",
                  "loan_tenure": "72 months",
                  "monthly_payment": null,
                  "monthly_payment_amount": "\u00a32,058.24",
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a loan statement, such as a loan reference number (\u0027BSCSAQUA2863D8\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. Additionally, it includes a loan withdrawal transaction, which is a common feature of loan statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as a loan reference number (\u0027BSCSAQUA2863D8\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. Additionally, it includes a loan withdrawal transaction, which is a common feature of loan statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": \"72 months\",\n        \"loan_reference\": \"BSCSAQUA2863D8\",\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,058.24\"\n    }\n}\n```"
              },
              "type": "loan_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.065,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.03529411764705882
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.038461538461538464,
                  "pattern_score": 0.0625,
                  "total_score": 0.04807692307692308
                },
                "invoice": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.0,
                  "total_score": 0.03333333333333333
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.02631578947368421,
                  "pattern_score": 0.0,
                  "total_score": 0.025263157894736838
                },
                "nominal_ledger": {
                  "keyword_score": 0.08333333333333333,
                  "pattern_score": 0.0,
                  "total_score": 0.065
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 9,
          "text_length": 779
        }
      ],
      "start_page": 8
    },
    {
      "avg_confidence": 0.95,
      "document_identifiers": {
        "agreement_date": null,
        "amount_financed": null,
        "annual_interest_rate": null,
        "invoice_date": null,
        "invoice_number": null,
        "loan_reference": null,
        "loan_tenure": null,
        "monthly_payment": null,
        "monthly_payment_amount": null,
        "mortgage_account_number": null,
        "outstanding_balance": null,
        "property_address": null,
        "remaining_term_months": null,
        "seller_name": null,
        "statement_period": null,
        "total_amount": null
      },
      "document_type": "nominal_ledger",
      "end_page": 20,
      "pages": [
        {
          "confidence_score": 0.95,
          "document_type": "nominal_ledger",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains account codes, descriptions, and financial figures for different periods, which are key indicators of a nominal ledger. Terms like \u0027Sale of goods,\u0027 \u0027Opening stock,\u0027 \u0027Purchases,\u0027 and \u0027Wages and salaries\u0027 further confirm this classification.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0LTqE17IO2NCSAw2d4uo3gnjvn\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains account codes, descriptions, and financial figures for different periods, which are key indicators of a nominal ledger. Terms like \\\u0027Sale of goods,\\\u0027 \\\u0027Opening stock,\\\u0027 \\\u0027Purchases,\\\u0027 and \\\u0027Wages and salaries\\\u0027 further confirm this classification.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347101, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=216, prompt_tokens=1613, total_tokens=1829, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetail"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains account codes, descriptions, and financial figures for different periods, which are key indicators of a nominal ledger. Terms like \u0027Sale of goods,\u0027 \u0027Opening stock,\u0027 \u0027Purchases,\u0027 and \u0027Wages and salaries\u0027 further confirm this classification.",
                "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains account codes, descriptions, and financial figures for different periods, which are key indicators of a nominal ledger. Terms like \u0027Sale of goods,\u0027 \u0027Opening stock,\u0027 \u0027Purchases,\u0027 and \u0027Wages and salaries\u0027 further confirm this classification.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "nominal_ledger"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.4642857142857143,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.06666666666666667,
                  "pattern_score": 0.0,
                  "total_score": 0.04
                },
                "financial_statement": {
                  "keyword_score": 0.05263157894736842,
                  "pattern_score": 0.0,
                  "total_score": 0.03789473684210525
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.0,
                  "total_score": 0.03333333333333333
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.5,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.4642857142857143
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.041666666666666664,
                  "pattern_score": 0.0,
                  "total_score": 0.045
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 10,
          "text_length": 1723
        },
        {
          "confidence_score": 0.95,
          "document_type": "nominal_ledger",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to account codes, descriptions of transactions (e.g., \u0027Payroll expenses booked\u0027, \u0027Employers NI\u0027, \u0027Staff welfare\u0027), and amounts debited and credited. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions across various accounts.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0MftsmeI62q26FmcMdHgO8NpBf\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains references to account codes, descriptions of transactions (e.g., \\\u0027Payroll expenses booked\\\u0027, \\\u0027Employers NI\\\u0027, \\\u0027Staff welfare\\\u0027), and amounts debited and credited. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions across various accounts.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347102, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=221, prompt_tokens=1612, total_tokens=1833, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains references to account codes, descriptions of transactions (e.g., \u0027Payroll expenses booked\u0027, \u0027Employers NI\u0027, \u0027Staff welfare\u0027), and amounts debited and credited. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions across various accounts.",
                "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to account codes, descriptions of transactions (e.g., \u0027Payroll expenses booked\u0027, \u0027Employers NI\u0027, \u0027Staff welfare\u0027), and amounts debited and credited. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions across various accounts.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "nominal_ledger"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.33428571428571424,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.05263157894736842,
                  "pattern_score": 0.0,
                  "total_score": 0.03789473684210525
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.125,
                  "total_score": 0.08333333333333334
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.3333333333333333,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.33428571428571424
                },
                "p32_payroll": {
                  "keyword_score": 0.05263157894736842,
                  "pattern_score": 0.0,
                  "total_score": 0.047368421052631574
                },
                "payroll_statement": {
                  "keyword_score": 0.041666666666666664,
                  "pattern_score": 0.030303030303030304,
                  "total_score": 0.06681818181818183
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 11,
          "text_length": 1673
        },
        {
          "confidence_score": 0.95,
          "document_type": "nominal_ledger",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, descriptions of expenses (e.g., \u0027Light, heat and power\u0027, \u0027Repairs and renewals\u0027, \u0027Telephone and fax\u0027), and corresponding debit and credit amounts. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions categorized by accounts.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0OexbOwRsrSfApQIIjgvB6hsPp\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to account codes, descriptions of expenses (e.g., \\\u0027Light, heat and power\\\u0027, \\\u0027Repairs and renewals\\\u0027, \\\u0027Telephone and fax\\\u0027), and corresponding debit and credit amounts. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions categorized by accounts.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347104, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=226, prompt_tokens=1635, total_tokens=1861, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, reje"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains multiple references to account codes, descriptions of expenses (e.g., \u0027Light, heat and power\u0027, \u0027Repairs and renewals\u0027, \u0027Telephone and fax\u0027), and corresponding debit and credit amounts. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions categorized by accounts.",
                "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, descriptions of expenses (e.g., \u0027Light, heat and power\u0027, \u0027Repairs and renewals\u0027, \u0027Telephone and fax\u0027), and corresponding debit and credit amounts. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions categorized by accounts.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "nominal_ledger"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.33428571428571424,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.06666666666666667,
                  "pattern_score": 0.0,
                  "total_score": 0.04
                },
                "financial_statement": {
                  "keyword_score": 0.05263157894736842,
                  "pattern_score": 0.0,
                  "total_score": 0.03789473684210525
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.3333333333333333,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.33428571428571424
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.013888888888888888,
                  "pattern_score": 0.0,
                  "total_score": 0.015
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 12,
          "text_length": 1622
        },
        {
          "confidence_score": 0.95,
          "document_type": "nominal_ledger",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple entries with account codes, descriptions, and amounts, which are characteristic of a nominal ledger. Specific account codes such as \u00277504-Stationery\u0027, \u00277206-TV Licence\u0027, and \u00278200-Donations\u0027 are indicative of a general ledger or nominal ledger. There are no indicators of transactions, invoices, payroll, or other financial documents.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0P0wW3GDaQ0RlXxuUrCwS3x9Vf\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple entries with account codes, descriptions, and amounts, which are characteristic of a nominal ledger. Specific account codes such as \\\u00277504-Stationery\\\u0027, \\\u00277206-TV Licence\\\u0027, and \\\u00278200-Donations\\\u0027 are indicative of a general ledger or nominal ledger. There are no indicators of transactions, invoices, payroll, or other financial documents.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347105, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=239, prompt_tokens=1652, total_tokens=1891, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains multiple entries with account codes, descriptions, and amounts, which are characteristic of a nominal ledger. Specific account codes such as \u00277504-Stationery\u0027, \u00277206-TV Licence\u0027, and \u00278200-Donations\u0027 are indicative of a general ledger or nominal ledger. There are no indicators of transactions, invoices, payroll, or other financial documents.",
                "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple entries with account codes, descriptions, and amounts, which are characteristic of a nominal ledger. Specific account codes such as \u00277504-Stationery\u0027, \u00277206-TV Licence\u0027, and \u00278200-Donations\u0027 are indicative of a general ledger or nominal ledger. There are no indicators of transactions, invoices, payroll, or other financial documents.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "nominal_ledger"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.33428571428571424,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.05263157894736842,
                  "pattern_score": 0.0,
                  "total_score": 0.03789473684210525
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.3333333333333333,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.33428571428571424
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.013888888888888888,
                  "pattern_score": 0.0,
                  "total_score": 0.015
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 13,
          "text_length": 1600
        },
        {
          "confidence_score": 0.95,
          "document_type": "nominal_ledger",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains detailed account codes, descriptions of expenses, and amounts categorized under specific ledger accounts such as \u0027Motor \u0026 Travel\u0027, \u0027Advertising\u0027, \u0027Bank Charges\u0027, and \u0027Depreciation\u0027. These are key indicators of a nominal ledger or general ledger document.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0Rms5iUMg8stuUX1dNo1EesuiR\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains detailed account codes, descriptions of expenses, and amounts categorized under specific ledger accounts such as \\\u0027Motor \u0026 Travel\\\u0027, \\\u0027Advertising\\\u0027, \\\u0027Bank Charges\\\u0027, and \\\u0027Depreciation\\\u0027. These are key indicators of a nominal ledger or general ledger document.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347107, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=216, prompt_tokens=1659, total_tokens=1875, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=Pro"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains detailed account codes, descriptions of expenses, and amounts categorized under specific ledger accounts such as \u0027Motor \u0026 Travel\u0027, \u0027Advertising\u0027, \u0027Bank Charges\u0027, and \u0027Depreciation\u0027. These are key indicators of a nominal ledger or general ledger document.",
                "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains detailed account codes, descriptions of expenses, and amounts categorized under specific ledger accounts such as \u0027Motor \u0026 Travel\u0027, \u0027Advertising\u0027, \u0027Bank Charges\u0027, and \u0027Depreciation\u0027. These are key indicators of a nominal ledger or general ledger document.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "nominal_ledger"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.33428571428571424,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.06666666666666667,
                  "pattern_score": 0.0,
                  "total_score": 0.04
                },
                "financial_statement": {
                  "keyword_score": 0.05263157894736842,
                  "pattern_score": 0.0,
                  "total_score": 0.03789473684210525
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.3333333333333333,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.33428571428571424
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.013888888888888888,
                  "pattern_score": 0.0,
                  "total_score": 0.015
                },
                "property_statement": {
                  "keyword_score": 0.027777777777777776,
                  "pattern_score": 0.02564102564102564,
                  "total_score": 0.06730769230769232
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 14,
          "text_length": 1936
        },
        {
          "confidence_score": 0.95,
          "document_type": "nominal_ledger",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, descriptions of transactions, and financial entries such as depreciation, corporation tax, and plant \u0026 machinery costs. These are key indicators of a nominal ledger, which is used to record financial transactions and account balances. There are no specific identifiers or details that match other document types like invoices, loan statements, or payroll statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0TRUUbFp8gIDWtjzLCmslAQTto\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to account codes, descriptions of transactions, and financial entries such as depreciation, corporation tax, and plant \u0026 machinery costs. These are key indicators of a nominal ledger, which is used to record financial transactions and account balances. There are no specific identifiers or details that match other document types like invoices, loan statements, or payroll statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347109, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=235, prompt_tokens=1646, total_tokens=1881, completion_tokens_details=Compl"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains multiple references to account codes, descriptions of transactions, and financial entries such as depreciation, corporation tax, and plant \u0026 machinery costs. These are key indicators of a nominal ledger, which is used to record financial transactions and account balances. There are no specific identifiers or details that match other document types like invoices, loan statements, or payroll statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, descriptions of transactions, and financial entries such as depreciation, corporation tax, and plant \u0026 machinery costs. These are key indicators of a nominal ledger, which is used to record financial transactions and account balances. There are no specific identifiers or details that match other document types like invoices, loan statements, or payroll statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "nominal_ledger"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.33428571428571424,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.03529411764705882
                },
                "corporation_tax": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.042352941176470586
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.0,
                  "total_score": 0.03333333333333333
                },
                "loan_statement": {
                  "keyword_score": 0.06666666666666667,
                  "pattern_score": 0.0,
                  "total_score": 0.06
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.3333333333333333,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.33428571428571424
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.013888888888888888,
                  "pattern_score": 0.0,
                  "total_score": 0.015
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 15,
          "text_length": 1953
        },
        {
          "confidence_score": 0.95,
          "document_type": "nominal_ledger",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, journal entries (JE), reclassifications, and accumulated depreciation, which are key indicators of a nominal ledger. Additionally, terms like \u0027cost b/fwd\u0027, \u0027depreciation\u0027, and \u0027reclassification\u0027 are specific to accounting and ledger records. There are no indicators of transactions, invoices, payroll, or other financial documents.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0UqG6CAZgZvQiExPOZ4wdM0wfx\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to account codes, journal entries (JE), reclassifications, and accumulated depreciation, which are key indicators of a nominal ledger. Additionally, terms like \\\u0027cost b/fwd\\\u0027, \\\u0027depreciation\\\u0027, and \\\u0027reclassification\\\u0027 are specific to accounting and ledger records. There are no indicators of transactions, invoices, payroll, or other financial documents.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347110, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=240, prompt_tokens=1666, total_tokens=1906, completion_tokens_details=CompletionTokensDetails(accepted_"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains multiple references to account codes, journal entries (JE), reclassifications, and accumulated depreciation, which are key indicators of a nominal ledger. Additionally, terms like \u0027cost b/fwd\u0027, \u0027depreciation\u0027, and \u0027reclassification\u0027 are specific to accounting and ledger records. There are no indicators of transactions, invoices, payroll, or other financial documents.",
                "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, journal entries (JE), reclassifications, and accumulated depreciation, which are key indicators of a nominal ledger. Additionally, terms like \u0027cost b/fwd\u0027, \u0027depreciation\u0027, and \u0027reclassification\u0027 are specific to accounting and ledger records. There are no indicators of transactions, invoices, payroll, or other financial documents.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "nominal_ledger"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.33428571428571424,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.3333333333333333,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.33428571428571424
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.013888888888888888,
                  "pattern_score": 0.0,
                  "total_score": 0.015
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 16,
          "text_length": 2185
        },
        {
          "confidence_score": 0.95,
          "document_type": "nominal_ledger",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, ledger entries, and descriptions such as \u0027Depreciation\u0027, \u0027Closing Stock\u0027, \u0027Opening Stock\u0027, \u0027Prepayments\u0027, and \u0027Intercompany Loans\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions categorized by accounts.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0W9trObqWNG9XLyAUvD5MZRzu5\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to account codes, ledger entries, and descriptions such as \\\u0027Depreciation\\\u0027, \\\u0027Closing Stock\\\u0027, \\\u0027Opening Stock\\\u0027, \\\u0027Prepayments\\\u0027, and \\\u0027Intercompany Loans\\\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions categorized by accounts.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347112, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=224, prompt_tokens=1651, total_tokens=1875, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_t"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains multiple references to account codes, ledger entries, and descriptions such as \u0027Depreciation\u0027, \u0027Closing Stock\u0027, \u0027Opening Stock\u0027, \u0027Prepayments\u0027, and \u0027Intercompany Loans\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions categorized by accounts.",
                "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, ledger entries, and descriptions such as \u0027Depreciation\u0027, \u0027Closing Stock\u0027, \u0027Opening Stock\u0027, \u0027Prepayments\u0027, and \u0027Intercompany Loans\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions categorized by accounts.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "nominal_ledger"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.33428571428571424,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.03529411764705882
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.3333333333333333,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.33428571428571424
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.013888888888888888,
                  "pattern_score": 0.0,
                  "total_score": 0.015
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 17,
          "text_length": 1837
        },
        {
          "confidence_score": 0.95,
          "document_type": "nominal_ledger",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, control accounts, and financial entries such as \u0027Trade creditors\u0027, \u0027Wages and salaries control\u0027, \u0027Pension contributions unpaid\u0027, and \u0027Corporation tax control\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions and balances across various accounts. Additionally, the document includes terms like \u0027Import\u0027, \u0027adjusted\u0027, and \u0027provision\u0027, which are commonly associated with ledger entries.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0YK13kiw1zAzoI7vEBCw3TAkNn\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to account codes, control accounts, and financial entries such as \\\u0027Trade creditors\\\u0027, \\\u0027Wages and salaries control\\\u0027, \\\u0027Pension contributions unpaid\\\u0027, and \\\u0027Corporation tax control\\\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions and balances across various accounts. Additionally, the document includes terms like \\\u0027Import\\\u0027, \\\u0027adjusted\\\u0027, and \\\u0027provision\\\u0027, which are commonly associated with ledger entries.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347114, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains multiple references to account codes, control accounts, and financial entries such as \u0027Trade creditors\u0027, \u0027Wages and salaries control\u0027, \u0027Pension contributions unpaid\u0027, and \u0027Corporation tax control\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions and balances across various accounts. Additionally, the document includes terms like \u0027Import\u0027, \u0027adjusted\u0027, and \u0027provision\u0027, which are commonly associated with ledger entries.",
                "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, control accounts, and financial entries such as \u0027Trade creditors\u0027, \u0027Wages and salaries control\u0027, \u0027Pension contributions unpaid\u0027, and \u0027Corporation tax control\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions and balances across various accounts. Additionally, the document includes terms like \u0027Import\u0027, \u0027adjusted\u0027, and \u0027provision\u0027, which are commonly associated with ledger entries.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "nominal_ledger"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.33428571428571424,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.11764705882352941,
                  "pattern_score": 0.0,
                  "total_score": 0.07058823529411765
                },
                "corporation_tax": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.042352941176470586
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.05263157894736842,
                  "pattern_score": 0.0,
                  "total_score": 0.03789473684210525
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.125,
                  "total_score": 0.08333333333333334
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.3333333333333333,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.33428571428571424
                },
                "p32_payroll": {
                  "keyword_score": 0.05263157894736842,
                  "pattern_score": 0.0,
                  "total_score": 0.047368421052631574
                },
                "payroll_statement": {
                  "keyword_score": 0.041666666666666664,
                  "pattern_score": 0.030303030303030304,
                  "total_score": 0.06681818181818183
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 18,
          "text_length": 1718
        },
        {
          "confidence_score": 0.95,
          "document_type": "nominal_ledger",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, ledger entries, and descriptions such as \u0027Payroll expenses booked\u0027, \u0027VAT Control account\u0027, \u0027Directors Loan Account\u0027, and \u0027Retained Earnings\u0027. These are clear indicators of a nominal ledger or general ledger document. There are no references to invoices, payroll, loans, mortgages, or other specific document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0aPYxNuoM1lXLT3Z8bjWAFpVY8\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to account codes, ledger entries, and descriptions such as \\\u0027Payroll expenses booked\\\u0027, \\\u0027VAT Control account\\\u0027, \\\u0027Directors Loan Account\\\u0027, and \\\u0027Retained Earnings\\\u0027. These are clear indicators of a nominal ledger or general ledger document. There are no references to invoices, payroll, loans, mortgages, or other specific document types.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347116, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=235, prompt_tokens=1670, total_tokens=1905, completion_tokens_details=CompletionTokensDetails(accepted_prediction_toke"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains multiple references to account codes, ledger entries, and descriptions such as \u0027Payroll expenses booked\u0027, \u0027VAT Control account\u0027, \u0027Directors Loan Account\u0027, and \u0027Retained Earnings\u0027. These are clear indicators of a nominal ledger or general ledger document. There are no references to invoices, payroll, loans, mortgages, or other specific document types.",
                "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, ledger entries, and descriptions such as \u0027Payroll expenses booked\u0027, \u0027VAT Control account\u0027, \u0027Directors Loan Account\u0027, and \u0027Retained Earnings\u0027. These are clear indicators of a nominal ledger or general ledger document. There are no references to invoices, payroll, loans, mortgages, or other specific document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "nominal_ledger"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.33428571428571424,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.03529411764705882
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.06666666666666667,
                  "pattern_score": 0.0,
                  "total_score": 0.04
                },
                "financial_statement": {
                  "keyword_score": 0.15789473684210525,
                  "pattern_score": 0.2,
                  "total_score": 0.20968421052631578
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "loan_statement": {
                  "keyword_score": 0.06666666666666667,
                  "pattern_score": 0.0,
                  "total_score": 0.06
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.3333333333333333,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.33428571428571424
                },
                "p32_payroll": {
                  "keyword_score": 0.05263157894736842,
                  "pattern_score": 0.0,
                  "total_score": 0.047368421052631574
                },
                "payroll_statement": {
                  "keyword_score": 0.027777777777777776,
                  "pattern_score": 0.0,
                  "total_score": 0.03
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.02564102564102564,
                  "total_score": 0.02564102564102564
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 19,
          "text_length": 1812
        },
        {
          "confidence_score": 0.95,
          "document_type": "nominal_ledger",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to account codes, descriptions of transactions (e.g., \u0027Extra dividend\u0027, \u0027Dividend Accounted\u0027), and balances, which are key indicators of a nominal ledger. Additionally, the term \u0027Nominal Ledger\u0027 is explicitly mentioned in the document.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0bbnO1VyTGVB61xSM3nxSyG4dH\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains references to account codes, descriptions of transactions (e.g., \\\u0027Extra dividend\\\u0027, \\\u0027Dividend Accounted\\\u0027), and balances, which are key indicators of a nominal ledger. Additionally, the term \\\u0027Nominal Ledger\\\u0027 is explicitly mentioned in the document.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347117, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=217, prompt_tokens=1123, total_tokens=1340, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensD"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains references to account codes, descriptions of transactions (e.g., \u0027Extra dividend\u0027, \u0027Dividend Accounted\u0027), and balances, which are key indicators of a nominal ledger. Additionally, the term \u0027Nominal Ledger\u0027 is explicitly mentioned in the document.",
                "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to account codes, descriptions of transactions (e.g., \u0027Extra dividend\u0027, \u0027Dividend Accounted\u0027), and balances, which are key indicators of a nominal ledger. Additionally, the term \u0027Nominal Ledger\u0027 is explicitly mentioned in the document.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "nominal_ledger"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.33428571428571424,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.03529411764705882
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.10526315789473684,
                  "pattern_score": 0.1,
                  "total_score": 0.12378947368421052
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.3333333333333333,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.33428571428571424
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 20,
          "text_length": 351
        }
      ],
      "start_page": 10
    },
    {
      "avg_confidence": 0.95,
      "document_identifiers": {
        "agreement_date": null,
        "amount_financed": null,
        "annual_interest_rate": "3.99%",
        "invoice_date": null,
        "invoice_number": null,
        "loan_reference": null,
        "loan_tenure": null,
        "monthly_payment": null,
        "monthly_payment_amount": "\u00a3705.55",
        "mortgage_account_number": "1100059898",
        "outstanding_balance": "\u00a3212,160.19",
        "property_address": "Flat 1, Russell House, 58 Sydenham Road, Croydon, CRO 2FJ",
        "remaining_term_months": 106,
        "seller_name": null,
        "statement_period": "1st April of last year to 31st March of this year",
        "total_amount": null
      },
      "document_type": "mortgage_statement",
      "end_page": 25,
      "pages": [
        {
          "confidence_score": 0.95,
          "document_type": "mortgage_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document explicitly mentions \u0027Your Buy To Let Mortgage Statement,\u0027 includes a \u0027Mortgage Account Number,\u0027 and provides details such as the property address and the statement period. These are key indicators of a mortgage statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"1st April of last year to 31st March of this year\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": \"Flat 1, Russell House, 58 Sydenham Road, Croydon, CRO 2FJ\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0dwW0iTCL5bmsdTzQ41Qawyaby\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"mortgage_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document explicitly mentions \\\u0027Your Buy To Let Mortgage Statement,\\\u0027 includes a \\\u0027Mortgage Account Number,\\\u0027 and provides details such as the property address and the statement period. These are key indicators of a mortgage statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": \"1st April of last year to 31st March of this year\",\\n        \"mortgage_account_number\": \"1100059898\",\\n        \"property_address\": \"Flat 1, Russell House, 58 Sydenham Road, Croydon, CRO 2FJ\",\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347119, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=245, prompt_tokens=1356, total_tokens=1601, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": "1100059898",
                  "outstanding_balance": null,
                  "property_address": "Flat 1, Russell House, 58 Sydenham Road, Croydon, CRO 2FJ",
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "1st April of last year to 31st March of this year",
                  "total_amount": null
                },
                "llm_reasoning": "The document explicitly mentions \u0027Your Buy To Let Mortgage Statement,\u0027 includes a \u0027Mortgage Account Number,\u0027 and provides details such as the property address and the statement period. These are key indicators of a mortgage statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document explicitly mentions \u0027Your Buy To Let Mortgage Statement,\u0027 includes a \u0027Mortgage Account Number,\u0027 and provides details such as the property address and the statement period. These are key indicators of a mortgage statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"1st April of last year to 31st March of this year\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": \"Flat 1, Russell House, 58 Sydenham Road, Croydon, CRO 2FJ\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "mortgage_statement"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.24822055137844612,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.09243697478991597
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.13157894736842105,
                  "pattern_score": 0.19047619047619047,
                  "total_score": 0.24822055137844612
                },
                "nominal_ledger": {
                  "keyword_score": 0.08333333333333333,
                  "pattern_score": 0.0,
                  "total_score": 0.065
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "mortgage_statement"
            }
          },
          "page_number": 21,
          "text_length": 1522
        },
        {
          "confidence_score": 0.95,
          "document_type": "mortgage_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Your Mortgage Statement Summary\u0027, \u0027Account number\u0027, \u0027Repayment type\u0027, \u0027Remaining mortgage term\u0027, and \u0027Interest Rate Details\u0027. It also mentions \u0027Interest Only\u0027 repayment type and provides an interest rate and remaining term, which are specific to mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"3.99%\",\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": 106,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0g5iUfmDjkEZxjHJtPROt2gi7m\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"mortgage_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \\\u0027Your Mortgage Statement Summary\\\u0027, \\\u0027Account number\\\u0027, \\\u0027Repayment type\\\u0027, \\\u0027Remaining mortgage term\\\u0027, and \\\u0027Interest Rate Details\\\u0027. It also mentions \\\u0027Interest Only\\\u0027 repayment type and provides an interest rate and remaining term, which are specific to mortgage statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": \"3.99%\",\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": \"1100059898\",\\n        \"property_address\": null,\\n        \"remaining_term_months\": 106,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347122, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=234, prompt_tokens=1151, total_tokens=1385, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": "3.99%",
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": "1100059898",
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": 106,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a mortgage statement, such as \u0027Your Mortgage Statement Summary\u0027, \u0027Account number\u0027, \u0027Repayment type\u0027, \u0027Remaining mortgage term\u0027, and \u0027Interest Rate Details\u0027. It also mentions \u0027Interest Only\u0027 repayment type and provides an interest rate and remaining term, which are specific to mortgage statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Your Mortgage Statement Summary\u0027, \u0027Account number\u0027, \u0027Repayment type\u0027, \u0027Remaining mortgage term\u0027, and \u0027Interest Rate Details\u0027. It also mentions \u0027Interest Only\u0027 repayment type and provides an interest rate and remaining term, which are specific to mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"3.99%\",\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": 106,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "mortgage_statement"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.13152882205513783,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.09243697478991597
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.10526315789473684,
                  "pattern_score": 0.047619047619047616,
                  "total_score": 0.13152882205513783
                },
                "nominal_ledger": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.027777777777777776,
                  "pattern_score": 0.0,
                  "total_score": 0.03
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "mortgage_statement"
            }
          },
          "page_number": 22,
          "text_length": 747
        },
        {
          "confidence_score": 0.95,
          "document_type": "mortgage_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment Due\u0027, \u0027Payment received by DD\u0027, and a running balance. Additionally, it includes a transaction summary for a specific period and mentions that it is suitable for tax return purposes, which is typical for mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3212,160.19\",\n        \"statement_period\": \"1 April 2023 to 31 March 2024\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3705.55\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0igPXyMih9bZkojRfXslhF44jX\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"mortgage_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \\\u0027Mortgage Account Number\\\u0027, \\\u0027Interest Charged\\\u0027, \\\u0027Payment Due\\\u0027, \\\u0027Payment received by DD\\\u0027, and a running balance. Additionally, it includes a transaction summary for a specific period and mentions that it is suitable for tax return purposes, which is typical for mortgage statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a3212,160.19\",\\n        \"statement_period\": \"1 April 2023 to 31 March 2024\",\\n        \"mortgage_account_number\": \"1100059898\",\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a3705.55\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347124, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=255, prompt_tokens=1485, total_tokens=1740, completion_tokens_details=CompletionTokensDeta"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": "\u00a3705.55",
                  "mortgage_account_number": "1100059898",
                  "outstanding_balance": "\u00a3212,160.19",
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "1 April 2023 to 31 March 2024",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment Due\u0027, \u0027Payment received by DD\u0027, and a running balance. Additionally, it includes a transaction summary for a specific period and mentions that it is suitable for tax return purposes, which is typical for mortgage statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment Due\u0027, \u0027Payment received by DD\u0027, and a running balance. Additionally, it includes a transaction summary for a specific period and mentions that it is suitable for tax return purposes, which is typical for mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3212,160.19\",\n        \"statement_period\": \"1 April 2023 to 31 March 2024\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3705.55\"\n    }\n}\n```"
              },
              "type": "mortgage_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.19831932773109243,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.23529411764705882,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.19831932773109243
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.1111111111111111,
                  "pattern_score": 0.0,
                  "total_score": 0.06666666666666667
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.10526315789473684,
                  "pattern_score": 0.09523809523809523,
                  "total_score": 0.16200501253132832
                },
                "nominal_ledger": {
                  "keyword_score": 0.16666666666666666,
                  "pattern_score": 0.0,
                  "total_score": 0.13
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.013888888888888888,
                  "pattern_score": 0.0,
                  "total_score": 0.015
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "bank_statement"
            }
          },
          "page_number": 23,
          "text_length": 1648
        },
        {
          "confidence_score": 0.95,
          "document_type": "mortgage_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and \u0027Mortgage Payment Due\u0027. It also includes a detailed breakdown of payments, interest charges, and balances over time, which are typical features of a mortgage statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3212,162.11\",\n        \"statement_period\": \"01 Aug 2023 to 01 Mar 2024\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3705.55\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0kY1p8WGrI7UsuxfBRVwTukTZT\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"mortgage_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \\\u0027Mortgage Account Number\\\u0027, \\\u0027Interest Charged\\\u0027, \\\u0027Payment received by DD\\\u0027, and \\\u0027Mortgage Payment Due\\\u0027. It also includes a detailed breakdown of payments, interest charges, and balances over time, which are typical features of a mortgage statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a3212,162.11\",\\n        \"statement_period\": \"01 Aug 2023 to 01 Mar 2024\",\\n        \"mortgage_account_number\": \"1100059898\",\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a3705.55\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347126, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=249, prompt_tokens=1468, total_tokens=1717, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audi"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": "\u00a3705.55",
                  "mortgage_account_number": "1100059898",
                  "outstanding_balance": "\u00a3212,162.11",
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "01 Aug 2023 to 01 Mar 2024",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and \u0027Mortgage Payment Due\u0027. It also includes a detailed breakdown of payments, interest charges, and balances over time, which are typical features of a mortgage statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and \u0027Mortgage Payment Due\u0027. It also includes a detailed breakdown of payments, interest charges, and balances over time, which are typical features of a mortgage statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3212,162.11\",\n        \"statement_period\": \"01 Aug 2023 to 01 Mar 2024\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3705.55\"\n    }\n}\n```"
              },
              "type": "mortgage_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.19831932773109243,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.23529411764705882,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.19831932773109243
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.0,
                  "total_score": 0.03333333333333333
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.02631578947368421,
                  "pattern_score": 0.047619047619047616,
                  "total_score": 0.05573934837092731
                },
                "nominal_ledger": {
                  "keyword_score": 0.08333333333333333,
                  "pattern_score": 0.0,
                  "total_score": 0.065
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "bank_statement"
            }
          },
          "page_number": 24,
          "text_length": 1140
        },
        {
          "confidence_score": 0.95,
          "document_type": "mortgage_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and a closing balance. Additionally, it references a mortgage provider (Fleet Mortgages) and includes details about interest charged and payments made.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3212,175.64\",\n        \"statement_period\": \"1 April 2023 to 31 March 2024\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3705.55\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0mC6a1HitP5KN1b9hIwHV0wsyj\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"mortgage_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \\\u0027Mortgage Account Number\\\u0027, \\\u0027Interest Charged\\\u0027, \\\u0027Payment received by DD\\\u0027, and a closing balance. Additionally, it references a mortgage provider (Fleet Mortgages) and includes details about interest charged and payments made.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a3212,175.64\",\\n        \"statement_period\": \"1 April 2023 to 31 March 2024\",\\n        \"mortgage_account_number\": \"1100059898\",\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a3705.55\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347128, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=244, prompt_tokens=1162, total_tokens=1406, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasonin"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": "\u00a3705.55",
                  "mortgage_account_number": "1100059898",
                  "outstanding_balance": "\u00a3212,175.64",
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "1 April 2023 to 31 March 2024",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and a closing balance. Additionally, it references a mortgage provider (Fleet Mortgages) and includes details about interest charged and payments made.",
                "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and a closing balance. Additionally, it references a mortgage provider (Fleet Mortgages) and includes details about interest charged and payments made.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3212,175.64\",\n        \"statement_period\": \"1 April 2023 to 31 March 2024\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3705.55\"\n    }\n}\n```"
              },
              "type": "mortgage_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.19831932773109243,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.23529411764705882,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.19831932773109243
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.06666666666666667,
                  "pattern_score": 0.0,
                  "total_score": 0.04
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.1111111111111111,
                  "pattern_score": 0.0,
                  "total_score": 0.06666666666666667
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.02631578947368421,
                  "pattern_score": 0.047619047619047616,
                  "total_score": 0.05573934837092731
                },
                "nominal_ledger": {
                  "keyword_score": 0.16666666666666666,
                  "pattern_score": 0.0,
                  "total_score": 0.13
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "bank_statement"
            }
          },
          "page_number": 25,
          "text_length": 531
        }
      ],
      "start_page": 21
    },
    {
      "avg_confidence": 0.9559999999999998,
      "document_identifiers": {
        "agreement_date": "not explicitly mentioned",
        "amount_financed": "54,256.58",
        "annual_interest_rate": null,
        "invoice_date": null,
        "invoice_number": null,
        "loan_reference": null,
        "loan_tenure": "36",
        "monthly_payment": "1,760.08",
        "monthly_payment_amount": null,
        "mortgage_account_number": null,
        "outstanding_balance": null,
        "property_address": null,
        "remaining_term_months": null,
        "seller_name": null,
        "statement_period": null,
        "total_amount": null
      },
      "document_type": "hp_agreement",
      "end_page": 31,
      "pages": [
        {
          "confidence_score": 0.98,
          "document_type": "hp_agreement",
          "features": {
            "llm_based": {
              "confidence": 0.98,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.98,\n    \"reasoning\": \"The document explicitly mentions \u0027Hire Purchase Agreement\u0027 and includes key details such as \u0027Agreement Number\u0027, \u0027Balance Financed\u0027, \u0027Monthly Payment\u0027, and \u0027Hire Period\u0027, which are characteristic of hire purchase agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": \"54,256.58\",\n        \"monthly_payment\": \"1,760.08\",\n        \"loan_tenure\": \"36\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0ptbvCwDyTFmoL5b2NJmnCTLTp\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.98,\\n    \"reasoning\": \"The document explicitly mentions \\\u0027Hire Purchase Agreement\\\u0027 and includes key details such as \\\u0027Agreement Number\\\u0027, \\\u0027Balance Financed\\\u0027, \\\u0027Monthly Payment\\\u0027, and \\\u0027Hire Period\\\u0027, which are characteristic of hire purchase agreements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": \"54,256.58\",\\n        \"monthly_payment\": \"1,760.08\",\\n        \"loan_tenure\": \"36\",\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347131, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=215, prompt_tokens=1731, total_tokens=1946, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(audio_tokens=0, cached_t"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": "54,256.58",
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": "36",
                  "monthly_payment": "1,760.08",
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document explicitly mentions \u0027Hire Purchase Agreement\u0027 and includes key details such as \u0027Agreement Number\u0027, \u0027Balance Financed\u0027, \u0027Monthly Payment\u0027, and \u0027Hire Period\u0027, which are characteristic of hire purchase agreements.",
                "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.98,\n    \"reasoning\": \"The document explicitly mentions \u0027Hire Purchase Agreement\u0027 and includes key details such as \u0027Agreement Number\u0027, \u0027Balance Financed\u0027, \u0027Monthly Payment\u0027, and \u0027Hire Period\u0027, which are characteristic of hire purchase agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": \"54,256.58\",\n        \"monthly_payment\": \"1,760.08\",\n        \"loan_tenure\": \"36\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "hp_agreement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.195,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.03529411764705882
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.2692307692307692,
                  "pattern_score": 0.0625,
                  "total_score": 0.18653846153846151
                },
                "invoice": {
                  "keyword_score": 0.16666666666666666,
                  "pattern_score": 0.0,
                  "total_score": 0.09999999999999999
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.25,
                  "pattern_score": 0.0,
                  "total_score": 0.195
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.013888888888888888,
                  "pattern_score": 0.0,
                  "total_score": 0.015
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 27,
          "text_length": 2556
        },
        {
          "confidence_score": 0.95,
          "document_type": "hp_agreement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027Agreement,\u0027 \u0027finance,\u0027 \u0027Supplier,\u0027 and \u0027Equipment.\u0027 It also includes terms like \u0027amount financed,\u0027 \u0027settlement amount,\u0027 and references to the Financial Services and Markets Act, which are typical in hire purchase or finance agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0rTBKNnId9FNF63MKMIWceZHLM\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \\\u0027Agreement,\\\u0027 \\\u0027finance,\\\u0027 \\\u0027Supplier,\\\u0027 and \\\u0027Equipment.\\\u0027 It also includes terms like \\\u0027amount financed,\\\u0027 \\\u0027settlement amount,\\\u0027 and references to the Financial Services and Markets Act, which are typical in hire purchase or finance agreements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347133, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=225, prompt_tokens=1602, total_tokens=1827, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, reject"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a hire purchase agreement, such as references to \u0027Agreement,\u0027 \u0027finance,\u0027 \u0027Supplier,\u0027 and \u0027Equipment.\u0027 It also includes terms like \u0027amount financed,\u0027 \u0027settlement amount,\u0027 and references to the Financial Services and Markets Act, which are typical in hire purchase or finance agreements.",
                "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027Agreement,\u0027 \u0027finance,\u0027 \u0027Supplier,\u0027 and \u0027Equipment.\u0027 It also includes terms like \u0027amount financed,\u0027 \u0027settlement amount,\u0027 and references to the Financial Services and Markets Act, which are typical in hire purchase or finance agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "hp_agreement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.065,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.03529411764705882
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.07692307692307693,
                  "pattern_score": 0.0,
                  "total_score": 0.046153846153846156
                },
                "invoice": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.08333333333333333,
                  "pattern_score": 0.0,
                  "total_score": 0.065
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.013888888888888888,
                  "pattern_score": 0.0,
                  "total_score": 0.015
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 28,
          "text_length": 4689
        },
        {
          "confidence_score": 0.95,
          "document_type": "hp_agreement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027hire\u0027, \u0027agreement\u0027, \u0027equipment\u0027, \u0027rentals\u0027, \u0027payment of rentals\u0027, \u0027commencement of hire\u0027, and terms related to the use, maintenance, and payment for equipment. These are characteristic of a hire purchase or finance agreement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": \"not explicitly mentioned\",\n        \"amount_financed\": \"not explicitly mentioned\",\n        \"monthly_payment\": \"not explicitly mentioned\",\n        \"loan_tenure\": \"not explicitly mentioned\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0tBecjR5AaE2QDXy1YPcfUXzge\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \\\u0027hire\\\u0027, \\\u0027agreement\\\u0027, \\\u0027equipment\\\u0027, \\\u0027rentals\\\u0027, \\\u0027payment of rentals\\\u0027, \\\u0027commencement of hire\\\u0027, and terms related to the use, maintenance, and payment for equipment. These are characteristic of a hire purchase or finance agreement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": \"not explicitly mentioned\",\\n        \"amount_financed\": \"not explicitly mentioned\",\\n        \"monthly_payment\": \"not explicitly mentioned\",\\n        \"loan_tenure\": \"not explicitly mentioned\",\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347135, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=240, prompt_tokens=1654, total_tokens=1894, completion_tokens_details=CompletionTokensD"
                },
                "document_identifiers": {
                  "agreement_date": "not explicitly mentioned",
                  "amount_financed": "not explicitly mentioned",
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": "not explicitly mentioned",
                  "monthly_payment": "not explicitly mentioned",
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a hire purchase agreement, such as references to \u0027hire\u0027, \u0027agreement\u0027, \u0027equipment\u0027, \u0027rentals\u0027, \u0027payment of rentals\u0027, \u0027commencement of hire\u0027, and terms related to the use, maintenance, and payment for equipment. These are characteristic of a hire purchase or finance agreement.",
                "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027hire\u0027, \u0027agreement\u0027, \u0027equipment\u0027, \u0027rentals\u0027, \u0027payment of rentals\u0027, \u0027commencement of hire\u0027, and terms related to the use, maintenance, and payment for equipment. These are characteristic of a hire purchase or finance agreement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": \"not explicitly mentioned\",\n        \"amount_financed\": \"not explicitly mentioned\",\n        \"monthly_payment\": \"not explicitly mentioned\",\n        \"loan_tenure\": \"not explicitly mentioned\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "hp_agreement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.2374736842105263,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.11764705882352941,
                  "pattern_score": 0.0,
                  "total_score": 0.07058823529411765
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.2631578947368421,
                  "pattern_score": 0.1,
                  "total_score": 0.2374736842105263
                },
                "hp_agreement": {
                  "keyword_score": 0.038461538461538464,
                  "pattern_score": 0.0,
                  "total_score": 0.023076923076923078
                },
                "invoice": {
                  "keyword_score": 0.16666666666666666,
                  "pattern_score": 0.0,
                  "total_score": 0.09999999999999999
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.02631578947368421,
                  "pattern_score": 0.0,
                  "total_score": 0.025263157894736838
                },
                "nominal_ledger": {
                  "keyword_score": 0.08333333333333333,
                  "pattern_score": 0.0,
                  "total_score": 0.065
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.0,
                  "total_score": 0.06
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "financial_statement"
            }
          },
          "page_number": 29,
          "text_length": 12322
        },
        {
          "confidence_score": 0.95,
          "document_type": "hp_agreement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and \u0027Termination\u0027. Additionally, it mentions terms like \u0027amount financed\u0027, \u0027insurance money\u0027, and \u0027hiring of the Equipment\u0027, which are specific to hire purchase agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0vj9ATGZ8oYfUZNbCQ7x8FiEke\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \\\u0027Equipment\\\u0027, \\\u0027Insurance monies\\\u0027, \\\u0027Total Loss\\\u0027, \\\u0027Rentals\\\u0027, and \\\u0027Termination\\\u0027. Additionally, it mentions terms like \\\u0027amount financed\\\u0027, \\\u0027insurance money\\\u0027, and \\\u0027hiring of the Equipment\\\u0027, which are specific to hire purchase agreements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347137, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=228, prompt_tokens=1672, total_tokens=1900, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejecte"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a hire purchase agreement, such as references to \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and \u0027Termination\u0027. Additionally, it mentions terms like \u0027amount financed\u0027, \u0027insurance money\u0027, and \u0027hiring of the Equipment\u0027, which are specific to hire purchase agreements.",
                "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and \u0027Termination\u0027. Additionally, it mentions terms like \u0027amount financed\u0027, \u0027insurance money\u0027, and \u0027hiring of the Equipment\u0027, which are specific to hire purchase agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "hp_agreement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.13333333333333333,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.03529411764705882
                },
                "corporation_tax": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.0,
                  "total_score": 0.042352941176470586
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.10526315789473684,
                  "pattern_score": 0.0,
                  "total_score": 0.0757894736842105
                },
                "hp_agreement": {
                  "keyword_score": 0.07692307692307693,
                  "pattern_score": 0.0625,
                  "total_score": 0.07115384615384615
                },
                "invoice": {
                  "keyword_score": 0.2222222222222222,
                  "pattern_score": 0.0,
                  "total_score": 0.13333333333333333
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.02631578947368421,
                  "pattern_score": 0.0,
                  "total_score": 0.025263157894736838
                },
                "nominal_ledger": {
                  "keyword_score": 0.16666666666666666,
                  "pattern_score": 0.0,
                  "total_score": 0.13
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.027777777777777776,
                  "pattern_score": 0.0,
                  "total_score": 0.03
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "invoice"
            }
          },
          "page_number": 30,
          "text_length": 11405
        },
        {
          "confidence_score": 0.95,
          "document_type": "hp_agreement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027Aldermore,\u0027 which is a financial institution often associated with hire purchase agreements. Additionally, the document discusses terms like \u0027amounts due,\u0027 \u0027commission,\u0027 and \u0027repossession,\u0027 which are common in hire purchase agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW13qZhW4UxXjzNQMig6DEHvvRay\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \\\u0027Option to Purchase,\\\u0027 \\\u0027Rentals,\\\u0027 \\\u0027Option to Purchase Fee,\\\u0027 \\\u0027hiring of the Equipment,\\\u0027 and \\\u0027Aldermore,\\\u0027 which is a financial institution often associated with hire purchase agreements. Additionally, the document discusses terms like \\\u0027amounts due,\\\u0027 \\\u0027commission,\\\u0027 and \\\u0027repossession,\\\u0027 which are common in hire purchase agreements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347145, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=250, prompt_tokens=1627, total_tokens=1877, compl"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027Aldermore,\u0027 which is a financial institution often associated with hire purchase agreements. Additionally, the document discusses terms like \u0027amounts due,\u0027 \u0027commission,\u0027 and \u0027repossession,\u0027 which are common in hire purchase agreements.",
                "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027Aldermore,\u0027 which is a financial institution often associated with hire purchase agreements. Additionally, the document discusses terms like \u0027amounts due,\u0027 \u0027commission,\u0027 and \u0027repossession,\u0027 which are common in hire purchase agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "hp_agreement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.10897435897435898,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.17647058823529413,
                  "pattern_score": 0.0,
                  "total_score": 0.10588235294117647
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.10526315789473684,
                  "pattern_score": 0.0,
                  "total_score": 0.0757894736842105
                },
                "hp_agreement": {
                  "keyword_score": 0.038461538461538464,
                  "pattern_score": 0.0,
                  "total_score": 0.023076923076923078
                },
                "invoice": {
                  "keyword_score": 0.16666666666666666,
                  "pattern_score": 0.0,
                  "total_score": 0.09999999999999999
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.05263157894736842,
                  "pattern_score": 0.0,
                  "total_score": 0.050526315789473676
                },
                "nominal_ledger": {
                  "keyword_score": 0.08333333333333333,
                  "pattern_score": 0.0,
                  "total_score": 0.065
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.041666666666666664,
                  "pattern_score": 0.0,
                  "total_score": 0.045
                },
                "property_statement": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.02564102564102564,
                  "total_score": 0.10897435897435898
                }
              },
              "type": "property_statement"
            }
          },
          "page_number": 31,
          "text_length": 10817
        }
      ],
      "start_page": 27
    },
    {
      "avg_confidence": 0.95,
      "document_identifiers": {
        "agreement_date": null,
        "amount_financed": null,
        "annual_interest_rate": null,
        "invoice_date": null,
        "invoice_number": null,
        "loan_reference": null,
        "loan_tenure": null,
        "monthly_payment": null,
        "monthly_payment_amount": null,
        "mortgage_account_number": null,
        "outstanding_balance": null,
        "property_address": null,
        "remaining_term_months": null,
        "seller_name": null,
        "statement_period": null,
        "total_amount": null
      },
      "document_type": "payroll_statement",
      "end_page": 34,
      "pages": [
        {
          "confidence_score": 0.95,
          "document_type": "payroll_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"payroll_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains detailed payroll information, including employee names, gross pay, taxable gross, tax, NICs, net pay, employer NICs, and cost to employer. These are key indicators of a payroll statement. Additionally, the document is titled \u0027Payroll Summary\u0027 and includes data for multiple employees across two months, which is characteristic of payroll summaries or history reports.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW18c801EkaBvEzWbGWMr4iTsMK3\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"payroll_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains detailed payroll information, including employee names, gross pay, taxable gross, tax, NICs, net pay, employer NICs, and cost to employer. These are key indicators of a payroll statement. Additionally, the document is titled \\\u0027Payroll Summary\\\u0027 and includes data for multiple employees across two months, which is characteristic of payroll summaries or history reports.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347150, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=236, prompt_tokens=2693, total_tokens=2929, completion_tokens_details=CompletionTokensDetails(accepted_pred"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains detailed payroll information, including employee names, gross pay, taxable gross, tax, NICs, net pay, employer NICs, and cost to employer. These are key indicators of a payroll statement. Additionally, the document is titled \u0027Payroll Summary\u0027 and includes data for multiple employees across two months, which is characteristic of payroll summaries or history reports.",
                "raw_response": "```json\n{\n    \"document_type\": \"payroll_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains detailed payroll information, including employee names, gross pay, taxable gross, tax, NICs, net pay, employer NICs, and cost to employer. These are key indicators of a payroll statement. Additionally, the document is titled \u0027Payroll Summary\u0027 and includes data for multiple employees across two months, which is characteristic of payroll summaries or history reports.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "payroll_statement"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.4881818181818182,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.1111111111111111,
                  "pattern_score": 0.0,
                  "total_score": 0.06666666666666667
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.25,
                  "pattern_score": 0.30303030303030304,
                  "total_score": 0.4881818181818182
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "payroll_statement"
            }
          },
          "page_number": 33,
          "text_length": 6074
        },
        {
          "confidence_score": 0.95,
          "document_type": "payroll_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"payroll_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains detailed payroll information such as employee names, gross pay, taxable gross, net pay, deductions, employer NICs, and cost to employer. It also includes a summary of payroll data for multiple employees over a specific period, which is characteristic of a payroll statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW19IJuEsy1iMcFgLq3J6TVrSIxO\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"payroll_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains detailed payroll information such as employee names, gross pay, taxable gross, net pay, deductions, employer NICs, and cost to employer. It also includes a summary of payroll data for multiple employees over a specific period, which is characteristic of a payroll statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347151, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=219, prompt_tokens=2699, total_tokens=2918, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tok"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains detailed payroll information such as employee names, gross pay, taxable gross, net pay, deductions, employer NICs, and cost to employer. It also includes a summary of payroll data for multiple employees over a specific period, which is characteristic of a payroll statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"payroll_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains detailed payroll information such as employee names, gross pay, taxable gross, net pay, deductions, employer NICs, and cost to employer. It also includes a summary of payroll data for multiple employees over a specific period, which is characteristic of a payroll statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "payroll_statement"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.42136363636363633,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "invoice": {
                  "keyword_score": 0.1111111111111111,
                  "pattern_score": 0.0,
                  "total_score": 0.06666666666666667
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "mortgage_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "p32_payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll_statement": {
                  "keyword_score": 0.20833333333333334,
                  "pattern_score": 0.2727272727272727,
                  "total_score": 0.42136363636363633
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "payroll_statement"
            }
          },
          "page_number": 34,
          "text_length": 4043
        }
      ],
      "start_page": 33
    }
  ],
  "page_classifications": [
    {
      "confidence_score": 0.6,
      "document_type": "unknown",
      "features": {
        "llm_based": {
          "confidence": 0.6,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.6,\n    \"reasoning\": \"The document mentions \u0027lending crowd\u0027, which suggests a financial institution or lending service. However, the text is very limited and lacks specific details such as transactions, balances, or other indicators. Based on the context, it is most likely related to a loan statement, but the confidence is low due to insufficient information.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW04knevKbx5QxPLwhTY7JGuHDJJ\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.6,\\n    \"reasoning\": \"The document mentions \\\u0027lending crowd\\\u0027, which suggests a financial institution or lending service. However, the text is very limited and lacks specific details such as transactions, balances, or other indicators. Based on the context, it is most likely related to a loan statement, but the confidence is low due to insufficient information.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347084, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=225, prompt_tokens=995, total_tokens=1220, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, re"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document mentions \u0027lending crowd\u0027, which suggests a financial institution or lending service. However, the text is very limited and lacks specific details such as transactions, balances, or other indicators. Based on the context, it is most likely related to a loan statement, but the confidence is low due to insufficient information.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.6,\n    \"reasoning\": \"The document mentions \u0027lending crowd\u0027, which suggests a financial institution or lending service. However, the text is very limited and lacks specific details such as transactions, balances, or other indicators. Based on the context, it is most likely related to a loan statement, but the confidence is low due to insufficient information.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "loan_statement"
        },
        "method_used": "uncertain",
        "pattern_based": {
          "confidence": 0.015,
          "features": {
            "bank_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "payroll_statement"
        }
      },
      "page_number": 1,
      "text_length": 19
    },
    {
      "confidence_score": 0.95,
      "document_type": "loan_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and contains key indicators such as \u0027Loan Start Date\u0027, \u0027Original Loan Amount\u0027, \u0027Interest Rate\u0027, \u0027Total Principal Outstanding\u0027, and \u0027Final Repayment Due\u0027. Additionally, it includes a loan reference number and details about payments made, which are typical of loan statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": \"60 months\",\n        \"loan_reference\": \"RS0008610B32Z\",\n        \"annual_interest_rate\": \"13.2% p.a.\",\n        \"outstanding_balance\": \"\u00a352,204.64\",\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW06HfPvUGtmXqtMesXTmBy0IeNs\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Loan Statement\\\u0027 and contains key indicators such as \\\u0027Loan Start Date\\\u0027, \\\u0027Original Loan Amount\\\u0027, \\\u0027Interest Rate\\\u0027, \\\u0027Total Principal Outstanding\\\u0027, and \\\u0027Final Repayment Due\\\u0027. Additionally, it includes a loan reference number and details about payments made, which are typical of loan statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": \"60 months\",\\n        \"loan_reference\": \"RS0008610B32Z\",\\n        \"annual_interest_rate\": \"13.2% p.a.\",\\n        \"outstanding_balance\": \"\u00a352,204.64\",\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347086, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=244, prompt_tokens=1488, total_tokens=1732, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, r"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": "13.2% p.a.",
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": "RS0008610B32Z",
              "loan_tenure": "60 months",
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": "\u00a352,204.64",
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document is titled \u0027Loan Statement\u0027 and contains key indicators such as \u0027Loan Start Date\u0027, \u0027Original Loan Amount\u0027, \u0027Interest Rate\u0027, \u0027Total Principal Outstanding\u0027, and \u0027Final Repayment Due\u0027. Additionally, it includes a loan reference number and details about payments made, which are typical of loan statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and contains key indicators such as \u0027Loan Start Date\u0027, \u0027Original Loan Amount\u0027, \u0027Interest Rate\u0027, \u0027Total Principal Outstanding\u0027, and \u0027Final Repayment Due\u0027. Additionally, it includes a loan reference number and details about payments made, which are typical of loan statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": \"60 months\",\n        \"loan_reference\": \"RS0008610B32Z\",\n        \"annual_interest_rate\": \"13.2% p.a.\",\n        \"outstanding_balance\": \"\u00a352,204.64\",\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "loan_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.16200501253132832,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.03529411764705882
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.038461538461538464,
              "pattern_score": 0.0,
              "total_score": 0.023076923076923078
            },
            "invoice": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.0,
              "total_score": 0.03333333333333333
            },
            "loan_statement": {
              "keyword_score": 0.06666666666666667,
              "pattern_score": 0.09090909090909091,
              "total_score": 0.11454545454545456
            },
            "mortgage_statement": {
              "keyword_score": 0.10526315789473684,
              "pattern_score": 0.09523809523809523,
              "total_score": 0.16200501253132832
            },
            "nominal_ledger": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.041666666666666664,
              "pattern_score": 0.0,
              "total_score": 0.045
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "mortgage_statement"
        }
      },
      "page_number": 2,
      "text_length": 1942
    },
    {
      "confidence_score": 0.9,
      "document_type": "loan_statement",
      "features": {
        "llm_based": {
          "confidence": 0.9,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.9,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and includes references to a loan, such as the company name \u0027LendingCrowd\u0027, which is a lending platform, and mentions of fees and capital at risk. These are key indicators of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW075g9qNhw4bLe6ZWmzWhWigExi\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.9,\\n    \"reasoning\": \"The document is titled \\\u0027Loan Statement\\\u0027 and includes references to a loan, such as the company name \\\u0027LendingCrowd\\\u0027, which is a lending platform, and mentions of fees and capital at risk. These are key indicators of a loan statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347087, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=212, prompt_tokens=1132, total_tokens=1344, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(audio_tokens=0, cached_tokens=0))"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document is titled \u0027Loan Statement\u0027 and includes references to a loan, such as the company name \u0027LendingCrowd\u0027, which is a lending platform, and mentions of fees and capital at risk. These are key indicators of a loan statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.9,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and includes references to a loan, such as the company name \u0027LendingCrowd\u0027, which is a lending platform, and mentions of fees and capital at risk. These are key indicators of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "loan_statement"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.11454545454545456,
          "features": {
            "bank_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.06666666666666667,
              "pattern_score": 0.09090909090909091,
              "total_score": 0.11454545454545456
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "loan_statement"
        }
      },
      "page_number": 3,
      "text_length": 585
    },
    {
      "confidence_score": 0.95,
      "document_type": "loan_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and includes key indicators such as loan payments, payment dates, principal, interest, total paid, and balance. It also mentions a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references LendingCrowd, a financial institution. These elements are consistent with a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a371,021.48\",\n        \"statement_period\": \"30-03-2022 to 30-04-2024\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,399.83\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW09nAfMHwGVCD4zBi3JOCA00HrB\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Loan Statement\\\u0027 and includes key indicators such as loan payments, payment dates, principal, interest, total paid, and balance. It also mentions a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references LendingCrowd, a financial institution. These elements are consistent with a loan statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a371,021.48\",\\n        \"statement_period\": \"30-03-2022 to 30-04-2024\",\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a32,399.83\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347089, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=256, prompt_tokens=2075, total_tokens=2331, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0,"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": "\u00a32,399.83",
              "mortgage_account_number": null,
              "outstanding_balance": "\u00a371,021.48",
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "30-03-2022 to 30-04-2024",
              "total_amount": null
            },
            "llm_reasoning": "The document is titled \u0027Loan Statement\u0027 and includes key indicators such as loan payments, payment dates, principal, interest, total paid, and balance. It also mentions a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references LendingCrowd, a financial institution. These elements are consistent with a loan statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and includes key indicators such as loan payments, payment dates, principal, interest, total paid, and balance. It also mentions a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references LendingCrowd, a financial institution. These elements are consistent with a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a371,021.48\",\n        \"statement_period\": \"30-03-2022 to 30-04-2024\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,399.83\"\n    }\n}\n```"
          },
          "type": "loan_statement"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.22909090909090912,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.03529411764705882
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.0,
              "total_score": 0.03333333333333333
            },
            "loan_statement": {
              "keyword_score": 0.13333333333333333,
              "pattern_score": 0.18181818181818182,
              "total_score": 0.22909090909090912
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "loan_statement"
        }
      },
      "page_number": 4,
      "text_length": 2080
    },
    {
      "confidence_score": 0.95,
      "document_type": "loan_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and includes key indicators such as payment dates, principal amounts, interest amounts, total paid, and remaining balance. It also references a company name and includes details of loan repayments, which are characteristic of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a352,204.64\",\n        \"statement_period\": \"30-05-2024 to 29-01-2025\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0AU6Ff5tLqdQfhpRoJNUyujdOS\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Loan Statement\\\u0027 and includes key indicators such as payment dates, principal amounts, interest amounts, total paid, and remaining balance. It also references a company name and includes details of loan repayments, which are characteristic of a loan statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a352,204.64\",\\n        \"statement_period\": \"30-05-2024 to 29-01-2025\",\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347090, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=233, prompt_tokens=1454, total_tokens=1687, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": "\u00a352,204.64",
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "30-05-2024 to 29-01-2025",
              "total_amount": null
            },
            "llm_reasoning": "The document is titled \u0027Loan Statement\u0027 and includes key indicators such as payment dates, principal amounts, interest amounts, total paid, and remaining balance. It also references a company name and includes details of loan repayments, which are characteristic of a loan statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and includes key indicators such as payment dates, principal amounts, interest amounts, total paid, and remaining balance. It also references a company name and includes details of loan repayments, which are characteristic of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a352,204.64\",\n        \"statement_period\": \"30-05-2024 to 29-01-2025\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "loan_statement"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.11454545454545456,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.03529411764705882
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.0,
              "total_score": 0.03333333333333333
            },
            "loan_statement": {
              "keyword_score": 0.06666666666666667,
              "pattern_score": 0.09090909090909091,
              "total_score": 0.11454545454545456
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "loan_statement"
        }
      },
      "page_number": 5,
      "text_length": 1104
    },
    {
      "confidence_score": 0.95,
      "document_type": "loan_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and contains key indicators such as scheduled payments, principal, interest, total payment amounts, and outstanding balances. It also includes a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references to LendingCrowd, a financial institution. These are clear indicators of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a350,379.05\",\n        \"statement_period\": \"28 February 2025 to 28 February 2027\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,399.83\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0CPyoTYak2aFvl6iPHA3ihBO5X\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Loan Statement\\\u0027 and contains key indicators such as scheduled payments, principal, interest, total payment amounts, and outstanding balances. It also includes a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references to LendingCrowd, a financial institution. These are clear indicators of a loan statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a350,379.05\",\\n        \"statement_period\": \"28 February 2025 to 28 February 2027\",\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a32,399.83\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347092, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=254, prompt_tokens=1960, total_tokens=2214, completion_tokens_details=CompletionTokensDetails(accepted_prediction_t"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": "\u00a32,399.83",
              "mortgage_account_number": null,
              "outstanding_balance": "\u00a350,379.05",
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "28 February 2025 to 28 February 2027",
              "total_amount": null
            },
            "llm_reasoning": "The document is titled \u0027Loan Statement\u0027 and contains key indicators such as scheduled payments, principal, interest, total payment amounts, and outstanding balances. It also includes a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references to LendingCrowd, a financial institution. These are clear indicators of a loan statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Statement\u0027 and contains key indicators such as scheduled payments, principal, interest, total payment amounts, and outstanding balances. It also includes a company name (S.C.S. AQUATIC \u0026 PET WHOLESALE) and references to LendingCrowd, a financial institution. These are clear indicators of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a350,379.05\",\n        \"statement_period\": \"28 February 2025 to 28 February 2027\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,399.83\"\n    }\n}\n```"
          },
          "type": "loan_statement"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.11454545454545456,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.03529411764705882
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.0,
              "total_score": 0.03333333333333333
            },
            "loan_statement": {
              "keyword_score": 0.06666666666666667,
              "pattern_score": 0.09090909090909091,
              "total_score": 0.11454545454545456
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "loan_statement"
        }
      },
      "page_number": 6,
      "text_length": 1855
    },
    {
      "confidence_score": 0.8,
      "document_type": "unknown",
      "features": {
        "llm_based": {
          "confidence": 0.8,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.8,\n    \"reasoning\": \"The document mentions \u0027Funding Circle\u0027 which is a known loan provider, and the term \u0027loan\u0027 is explicitly stated, indicating that this document is related to a loan account or loan statement. However, the lack of detailed information reduces the confidence level slightly.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0F8GlccfqbUagCdi4HeNS1Vpen\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.8,\\n    \"reasoning\": \"The document mentions \\\u0027Funding Circle\\\u0027 which is a known loan provider, and the term \\\u0027loan\\\u0027 is explicitly stated, indicating that this document is related to a loan account or loan statement. However, the lack of detailed information reduces the confidence level slightly.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347095, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=213, prompt_tokens=993, total_tokens=1206, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDet"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document mentions \u0027Funding Circle\u0027 which is a known loan provider, and the term \u0027loan\u0027 is explicitly stated, indicating that this document is related to a loan account or loan statement. However, the lack of detailed information reduces the confidence level slightly.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.8,\n    \"reasoning\": \"The document mentions \u0027Funding Circle\u0027 which is a known loan provider, and the term \u0027loan\u0027 is explicitly stated, indicating that this document is related to a loan account or loan statement. However, the lack of detailed information reduces the confidence level slightly.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "loan_statement"
        },
        "method_used": "uncertain",
        "pattern_based": {
          "confidence": 0.0,
          "features": {
            "bank_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 7,
      "text_length": 20
    },
    {
      "confidence_score": 0.95,
      "document_type": "loan_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as a loan reference number (\u0027BSCSAQUA2863D8\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. These are characteristic elements of a loan account statement. There is no mention of property addresses, hire purchase agreements, or other indicators of different document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": \"72 months\",\n        \"loan_reference\": \"BSCSAQUA2863D8\",\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"27/02/2023 to 28/07/2025\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,058.24\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0HrqRJpTHRS5L1VGjtGK5ABkII\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as a loan reference number (\\\u0027BSCSAQUA2863D8\\\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. These are characteristic elements of a loan account statement. There is no mention of property addresses, hire purchase agreements, or other indicators of different document types.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": \"72 months\",\\n        \"loan_reference\": \"BSCSAQUA2863D8\",\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": \"27/02/2023 to 28/07/2025\",\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a32,058.24\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347097, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=273, prompt_tokens=1698, total_tokens=1971, completion_tokens_deta"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": "BSCSAQUA2863D8",
              "loan_tenure": "72 months",
              "monthly_payment": null,
              "monthly_payment_amount": "\u00a32,058.24",
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "27/02/2023 to 28/07/2025",
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a loan statement, such as a loan reference number (\u0027BSCSAQUA2863D8\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. These are characteristic elements of a loan account statement. There is no mention of property addresses, hire purchase agreements, or other indicators of different document types.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as a loan reference number (\u0027BSCSAQUA2863D8\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. These are characteristic elements of a loan account statement. There is no mention of property addresses, hire purchase agreements, or other indicators of different document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": \"72 months\",\n        \"loan_reference\": \"BSCSAQUA2863D8\",\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"27/02/2023 to 28/07/2025\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,058.24\"\n    }\n}\n```"
          },
          "type": "loan_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.07058823529411765,
          "features": {
            "bank_statement": {
              "keyword_score": 0.11764705882352941,
              "pattern_score": 0.0,
              "total_score": 0.07058823529411765
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.038461538461538464,
              "pattern_score": 0.0625,
              "total_score": 0.04807692307692308
            },
            "invoice": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.0,
              "total_score": 0.03333333333333333
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.02631578947368421,
              "pattern_score": 0.0,
              "total_score": 0.025263157894736838
            },
            "nominal_ledger": {
              "keyword_score": 0.08333333333333333,
              "pattern_score": 0.0,
              "total_score": 0.065
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 8,
      "text_length": 1695
    },
    {
      "confidence_score": 0.95,
      "document_type": "loan_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as a loan reference number (\u0027BSCSAQUA2863D8\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. Additionally, it includes a loan withdrawal transaction, which is a common feature of loan statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": \"72 months\",\n        \"loan_reference\": \"BSCSAQUA2863D8\",\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,058.24\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0J4S2B7phU27yODETcUitzgXJM\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"loan_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as a loan reference number (\\\u0027BSCSAQUA2863D8\\\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. Additionally, it includes a loan withdrawal transaction, which is a common feature of loan statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": \"72 months\",\\n        \"loan_reference\": \"BSCSAQUA2863D8\",\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a32,058.24\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347099, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=247, prompt_tokens=1298, total_tokens=1545, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, reject"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": "BSCSAQUA2863D8",
              "loan_tenure": "72 months",
              "monthly_payment": null,
              "monthly_payment_amount": "\u00a32,058.24",
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a loan statement, such as a loan reference number (\u0027BSCSAQUA2863D8\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. Additionally, it includes a loan withdrawal transaction, which is a common feature of loan statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as a loan reference number (\u0027BSCSAQUA2863D8\u0027), a loan amount (\u00a3105,000.00), a loan term (72 months), and a series of direct debit repayments. Additionally, it includes a loan withdrawal transaction, which is a common feature of loan statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": \"72 months\",\n        \"loan_reference\": \"BSCSAQUA2863D8\",\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a32,058.24\"\n    }\n}\n```"
          },
          "type": "loan_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.065,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.03529411764705882
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.038461538461538464,
              "pattern_score": 0.0625,
              "total_score": 0.04807692307692308
            },
            "invoice": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.0,
              "total_score": 0.03333333333333333
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.02631578947368421,
              "pattern_score": 0.0,
              "total_score": 0.025263157894736838
            },
            "nominal_ledger": {
              "keyword_score": 0.08333333333333333,
              "pattern_score": 0.0,
              "total_score": 0.065
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 9,
      "text_length": 779
    },
    {
      "confidence_score": 0.95,
      "document_type": "nominal_ledger",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains account codes, descriptions, and financial figures for different periods, which are key indicators of a nominal ledger. Terms like \u0027Sale of goods,\u0027 \u0027Opening stock,\u0027 \u0027Purchases,\u0027 and \u0027Wages and salaries\u0027 further confirm this classification.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0LTqE17IO2NCSAw2d4uo3gnjvn\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains account codes, descriptions, and financial figures for different periods, which are key indicators of a nominal ledger. Terms like \\\u0027Sale of goods,\\\u0027 \\\u0027Opening stock,\\\u0027 \\\u0027Purchases,\\\u0027 and \\\u0027Wages and salaries\\\u0027 further confirm this classification.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347101, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=216, prompt_tokens=1613, total_tokens=1829, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetail"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains account codes, descriptions, and financial figures for different periods, which are key indicators of a nominal ledger. Terms like \u0027Sale of goods,\u0027 \u0027Opening stock,\u0027 \u0027Purchases,\u0027 and \u0027Wages and salaries\u0027 further confirm this classification.",
            "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains account codes, descriptions, and financial figures for different periods, which are key indicators of a nominal ledger. Terms like \u0027Sale of goods,\u0027 \u0027Opening stock,\u0027 \u0027Purchases,\u0027 and \u0027Wages and salaries\u0027 further confirm this classification.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "nominal_ledger"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.4642857142857143,
          "features": {
            "bank_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.06666666666666667,
              "pattern_score": 0.0,
              "total_score": 0.04
            },
            "financial_statement": {
              "keyword_score": 0.05263157894736842,
              "pattern_score": 0.0,
              "total_score": 0.03789473684210525
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.0,
              "total_score": 0.03333333333333333
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.5,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.4642857142857143
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.041666666666666664,
              "pattern_score": 0.0,
              "total_score": 0.045
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 10,
      "text_length": 1723
    },
    {
      "confidence_score": 0.95,
      "document_type": "nominal_ledger",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to account codes, descriptions of transactions (e.g., \u0027Payroll expenses booked\u0027, \u0027Employers NI\u0027, \u0027Staff welfare\u0027), and amounts debited and credited. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions across various accounts.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0MftsmeI62q26FmcMdHgO8NpBf\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains references to account codes, descriptions of transactions (e.g., \\\u0027Payroll expenses booked\\\u0027, \\\u0027Employers NI\\\u0027, \\\u0027Staff welfare\\\u0027), and amounts debited and credited. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions across various accounts.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347102, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=221, prompt_tokens=1612, total_tokens=1833, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains references to account codes, descriptions of transactions (e.g., \u0027Payroll expenses booked\u0027, \u0027Employers NI\u0027, \u0027Staff welfare\u0027), and amounts debited and credited. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions across various accounts.",
            "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to account codes, descriptions of transactions (e.g., \u0027Payroll expenses booked\u0027, \u0027Employers NI\u0027, \u0027Staff welfare\u0027), and amounts debited and credited. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions across various accounts.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "nominal_ledger"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.33428571428571424,
          "features": {
            "bank_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.05263157894736842,
              "pattern_score": 0.0,
              "total_score": 0.03789473684210525
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.125,
              "total_score": 0.08333333333333334
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.3333333333333333,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.33428571428571424
            },
            "p32_payroll": {
              "keyword_score": 0.05263157894736842,
              "pattern_score": 0.0,
              "total_score": 0.047368421052631574
            },
            "payroll_statement": {
              "keyword_score": 0.041666666666666664,
              "pattern_score": 0.030303030303030304,
              "total_score": 0.06681818181818183
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 11,
      "text_length": 1673
    },
    {
      "confidence_score": 0.95,
      "document_type": "nominal_ledger",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, descriptions of expenses (e.g., \u0027Light, heat and power\u0027, \u0027Repairs and renewals\u0027, \u0027Telephone and fax\u0027), and corresponding debit and credit amounts. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions categorized by accounts.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0OexbOwRsrSfApQIIjgvB6hsPp\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to account codes, descriptions of expenses (e.g., \\\u0027Light, heat and power\\\u0027, \\\u0027Repairs and renewals\\\u0027, \\\u0027Telephone and fax\\\u0027), and corresponding debit and credit amounts. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions categorized by accounts.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347104, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=226, prompt_tokens=1635, total_tokens=1861, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, reje"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains multiple references to account codes, descriptions of expenses (e.g., \u0027Light, heat and power\u0027, \u0027Repairs and renewals\u0027, \u0027Telephone and fax\u0027), and corresponding debit and credit amounts. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions categorized by accounts.",
            "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, descriptions of expenses (e.g., \u0027Light, heat and power\u0027, \u0027Repairs and renewals\u0027, \u0027Telephone and fax\u0027), and corresponding debit and credit amounts. These are key indicators of a nominal ledger or general ledger, which tracks financial transactions categorized by accounts.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "nominal_ledger"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.33428571428571424,
          "features": {
            "bank_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.06666666666666667,
              "pattern_score": 0.0,
              "total_score": 0.04
            },
            "financial_statement": {
              "keyword_score": 0.05263157894736842,
              "pattern_score": 0.0,
              "total_score": 0.03789473684210525
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.3333333333333333,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.33428571428571424
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 12,
      "text_length": 1622
    },
    {
      "confidence_score": 0.95,
      "document_type": "nominal_ledger",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple entries with account codes, descriptions, and amounts, which are characteristic of a nominal ledger. Specific account codes such as \u00277504-Stationery\u0027, \u00277206-TV Licence\u0027, and \u00278200-Donations\u0027 are indicative of a general ledger or nominal ledger. There are no indicators of transactions, invoices, payroll, or other financial documents.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0P0wW3GDaQ0RlXxuUrCwS3x9Vf\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple entries with account codes, descriptions, and amounts, which are characteristic of a nominal ledger. Specific account codes such as \\\u00277504-Stationery\\\u0027, \\\u00277206-TV Licence\\\u0027, and \\\u00278200-Donations\\\u0027 are indicative of a general ledger or nominal ledger. There are no indicators of transactions, invoices, payroll, or other financial documents.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347105, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=239, prompt_tokens=1652, total_tokens=1891, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains multiple entries with account codes, descriptions, and amounts, which are characteristic of a nominal ledger. Specific account codes such as \u00277504-Stationery\u0027, \u00277206-TV Licence\u0027, and \u00278200-Donations\u0027 are indicative of a general ledger or nominal ledger. There are no indicators of transactions, invoices, payroll, or other financial documents.",
            "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple entries with account codes, descriptions, and amounts, which are characteristic of a nominal ledger. Specific account codes such as \u00277504-Stationery\u0027, \u00277206-TV Licence\u0027, and \u00278200-Donations\u0027 are indicative of a general ledger or nominal ledger. There are no indicators of transactions, invoices, payroll, or other financial documents.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "nominal_ledger"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.33428571428571424,
          "features": {
            "bank_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.05263157894736842,
              "pattern_score": 0.0,
              "total_score": 0.03789473684210525
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.3333333333333333,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.33428571428571424
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 13,
      "text_length": 1600
    },
    {
      "confidence_score": 0.95,
      "document_type": "nominal_ledger",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains detailed account codes, descriptions of expenses, and amounts categorized under specific ledger accounts such as \u0027Motor \u0026 Travel\u0027, \u0027Advertising\u0027, \u0027Bank Charges\u0027, and \u0027Depreciation\u0027. These are key indicators of a nominal ledger or general ledger document.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0Rms5iUMg8stuUX1dNo1EesuiR\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains detailed account codes, descriptions of expenses, and amounts categorized under specific ledger accounts such as \\\u0027Motor \u0026 Travel\\\u0027, \\\u0027Advertising\\\u0027, \\\u0027Bank Charges\\\u0027, and \\\u0027Depreciation\\\u0027. These are key indicators of a nominal ledger or general ledger document.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347107, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=216, prompt_tokens=1659, total_tokens=1875, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=Pro"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains detailed account codes, descriptions of expenses, and amounts categorized under specific ledger accounts such as \u0027Motor \u0026 Travel\u0027, \u0027Advertising\u0027, \u0027Bank Charges\u0027, and \u0027Depreciation\u0027. These are key indicators of a nominal ledger or general ledger document.",
            "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains detailed account codes, descriptions of expenses, and amounts categorized under specific ledger accounts such as \u0027Motor \u0026 Travel\u0027, \u0027Advertising\u0027, \u0027Bank Charges\u0027, and \u0027Depreciation\u0027. These are key indicators of a nominal ledger or general ledger document.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "nominal_ledger"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.33428571428571424,
          "features": {
            "bank_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.06666666666666667,
              "pattern_score": 0.0,
              "total_score": 0.04
            },
            "financial_statement": {
              "keyword_score": 0.05263157894736842,
              "pattern_score": 0.0,
              "total_score": 0.03789473684210525
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.3333333333333333,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.33428571428571424
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.027777777777777776,
              "pattern_score": 0.02564102564102564,
              "total_score": 0.06730769230769232
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 14,
      "text_length": 1936
    },
    {
      "confidence_score": 0.95,
      "document_type": "nominal_ledger",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, descriptions of transactions, and financial entries such as depreciation, corporation tax, and plant \u0026 machinery costs. These are key indicators of a nominal ledger, which is used to record financial transactions and account balances. There are no specific identifiers or details that match other document types like invoices, loan statements, or payroll statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0TRUUbFp8gIDWtjzLCmslAQTto\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to account codes, descriptions of transactions, and financial entries such as depreciation, corporation tax, and plant \u0026 machinery costs. These are key indicators of a nominal ledger, which is used to record financial transactions and account balances. There are no specific identifiers or details that match other document types like invoices, loan statements, or payroll statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347109, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=235, prompt_tokens=1646, total_tokens=1881, completion_tokens_details=Compl"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains multiple references to account codes, descriptions of transactions, and financial entries such as depreciation, corporation tax, and plant \u0026 machinery costs. These are key indicators of a nominal ledger, which is used to record financial transactions and account balances. There are no specific identifiers or details that match other document types like invoices, loan statements, or payroll statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, descriptions of transactions, and financial entries such as depreciation, corporation tax, and plant \u0026 machinery costs. These are key indicators of a nominal ledger, which is used to record financial transactions and account balances. There are no specific identifiers or details that match other document types like invoices, loan statements, or payroll statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "nominal_ledger"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.33428571428571424,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.03529411764705882
            },
            "corporation_tax": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.042352941176470586
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.0,
              "total_score": 0.03333333333333333
            },
            "loan_statement": {
              "keyword_score": 0.06666666666666667,
              "pattern_score": 0.0,
              "total_score": 0.06
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.3333333333333333,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.33428571428571424
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 15,
      "text_length": 1953
    },
    {
      "confidence_score": 0.95,
      "document_type": "nominal_ledger",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, journal entries (JE), reclassifications, and accumulated depreciation, which are key indicators of a nominal ledger. Additionally, terms like \u0027cost b/fwd\u0027, \u0027depreciation\u0027, and \u0027reclassification\u0027 are specific to accounting and ledger records. There are no indicators of transactions, invoices, payroll, or other financial documents.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0UqG6CAZgZvQiExPOZ4wdM0wfx\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to account codes, journal entries (JE), reclassifications, and accumulated depreciation, which are key indicators of a nominal ledger. Additionally, terms like \\\u0027cost b/fwd\\\u0027, \\\u0027depreciation\\\u0027, and \\\u0027reclassification\\\u0027 are specific to accounting and ledger records. There are no indicators of transactions, invoices, payroll, or other financial documents.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347110, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=240, prompt_tokens=1666, total_tokens=1906, completion_tokens_details=CompletionTokensDetails(accepted_"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains multiple references to account codes, journal entries (JE), reclassifications, and accumulated depreciation, which are key indicators of a nominal ledger. Additionally, terms like \u0027cost b/fwd\u0027, \u0027depreciation\u0027, and \u0027reclassification\u0027 are specific to accounting and ledger records. There are no indicators of transactions, invoices, payroll, or other financial documents.",
            "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, journal entries (JE), reclassifications, and accumulated depreciation, which are key indicators of a nominal ledger. Additionally, terms like \u0027cost b/fwd\u0027, \u0027depreciation\u0027, and \u0027reclassification\u0027 are specific to accounting and ledger records. There are no indicators of transactions, invoices, payroll, or other financial documents.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "nominal_ledger"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.33428571428571424,
          "features": {
            "bank_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.3333333333333333,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.33428571428571424
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 16,
      "text_length": 2185
    },
    {
      "confidence_score": 0.95,
      "document_type": "nominal_ledger",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, ledger entries, and descriptions such as \u0027Depreciation\u0027, \u0027Closing Stock\u0027, \u0027Opening Stock\u0027, \u0027Prepayments\u0027, and \u0027Intercompany Loans\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions categorized by accounts.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0W9trObqWNG9XLyAUvD5MZRzu5\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to account codes, ledger entries, and descriptions such as \\\u0027Depreciation\\\u0027, \\\u0027Closing Stock\\\u0027, \\\u0027Opening Stock\\\u0027, \\\u0027Prepayments\\\u0027, and \\\u0027Intercompany Loans\\\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions categorized by accounts.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347112, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=224, prompt_tokens=1651, total_tokens=1875, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_t"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains multiple references to account codes, ledger entries, and descriptions such as \u0027Depreciation\u0027, \u0027Closing Stock\u0027, \u0027Opening Stock\u0027, \u0027Prepayments\u0027, and \u0027Intercompany Loans\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions categorized by accounts.",
            "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, ledger entries, and descriptions such as \u0027Depreciation\u0027, \u0027Closing Stock\u0027, \u0027Opening Stock\u0027, \u0027Prepayments\u0027, and \u0027Intercompany Loans\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions categorized by accounts.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "nominal_ledger"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.33428571428571424,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.03529411764705882
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.3333333333333333,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.33428571428571424
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 17,
      "text_length": 1837
    },
    {
      "confidence_score": 0.95,
      "document_type": "nominal_ledger",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, control accounts, and financial entries such as \u0027Trade creditors\u0027, \u0027Wages and salaries control\u0027, \u0027Pension contributions unpaid\u0027, and \u0027Corporation tax control\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions and balances across various accounts. Additionally, the document includes terms like \u0027Import\u0027, \u0027adjusted\u0027, and \u0027provision\u0027, which are commonly associated with ledger entries.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0YK13kiw1zAzoI7vEBCw3TAkNn\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to account codes, control accounts, and financial entries such as \\\u0027Trade creditors\\\u0027, \\\u0027Wages and salaries control\\\u0027, \\\u0027Pension contributions unpaid\\\u0027, and \\\u0027Corporation tax control\\\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions and balances across various accounts. Additionally, the document includes terms like \\\u0027Import\\\u0027, \\\u0027adjusted\\\u0027, and \\\u0027provision\\\u0027, which are commonly associated with ledger entries.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347114, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains multiple references to account codes, control accounts, and financial entries such as \u0027Trade creditors\u0027, \u0027Wages and salaries control\u0027, \u0027Pension contributions unpaid\u0027, and \u0027Corporation tax control\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions and balances across various accounts. Additionally, the document includes terms like \u0027Import\u0027, \u0027adjusted\u0027, and \u0027provision\u0027, which are commonly associated with ledger entries.",
            "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, control accounts, and financial entries such as \u0027Trade creditors\u0027, \u0027Wages and salaries control\u0027, \u0027Pension contributions unpaid\u0027, and \u0027Corporation tax control\u0027. These are key indicators of a nominal ledger, which is used to record financial transactions and balances across various accounts. Additionally, the document includes terms like \u0027Import\u0027, \u0027adjusted\u0027, and \u0027provision\u0027, which are commonly associated with ledger entries.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "nominal_ledger"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.33428571428571424,
          "features": {
            "bank_statement": {
              "keyword_score": 0.11764705882352941,
              "pattern_score": 0.0,
              "total_score": 0.07058823529411765
            },
            "corporation_tax": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.042352941176470586
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.05263157894736842,
              "pattern_score": 0.0,
              "total_score": 0.03789473684210525
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.125,
              "total_score": 0.08333333333333334
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.3333333333333333,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.33428571428571424
            },
            "p32_payroll": {
              "keyword_score": 0.05263157894736842,
              "pattern_score": 0.0,
              "total_score": 0.047368421052631574
            },
            "payroll_statement": {
              "keyword_score": 0.041666666666666664,
              "pattern_score": 0.030303030303030304,
              "total_score": 0.06681818181818183
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 18,
      "text_length": 1718
    },
    {
      "confidence_score": 0.95,
      "document_type": "nominal_ledger",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, ledger entries, and descriptions such as \u0027Payroll expenses booked\u0027, \u0027VAT Control account\u0027, \u0027Directors Loan Account\u0027, and \u0027Retained Earnings\u0027. These are clear indicators of a nominal ledger or general ledger document. There are no references to invoices, payroll, loans, mortgages, or other specific document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0aPYxNuoM1lXLT3Z8bjWAFpVY8\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to account codes, ledger entries, and descriptions such as \\\u0027Payroll expenses booked\\\u0027, \\\u0027VAT Control account\\\u0027, \\\u0027Directors Loan Account\\\u0027, and \\\u0027Retained Earnings\\\u0027. These are clear indicators of a nominal ledger or general ledger document. There are no references to invoices, payroll, loans, mortgages, or other specific document types.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347116, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=235, prompt_tokens=1670, total_tokens=1905, completion_tokens_details=CompletionTokensDetails(accepted_prediction_toke"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains multiple references to account codes, ledger entries, and descriptions such as \u0027Payroll expenses booked\u0027, \u0027VAT Control account\u0027, \u0027Directors Loan Account\u0027, and \u0027Retained Earnings\u0027. These are clear indicators of a nominal ledger or general ledger document. There are no references to invoices, payroll, loans, mortgages, or other specific document types.",
            "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to account codes, ledger entries, and descriptions such as \u0027Payroll expenses booked\u0027, \u0027VAT Control account\u0027, \u0027Directors Loan Account\u0027, and \u0027Retained Earnings\u0027. These are clear indicators of a nominal ledger or general ledger document. There are no references to invoices, payroll, loans, mortgages, or other specific document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "nominal_ledger"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.33428571428571424,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.03529411764705882
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.06666666666666667,
              "pattern_score": 0.0,
              "total_score": 0.04
            },
            "financial_statement": {
              "keyword_score": 0.15789473684210525,
              "pattern_score": 0.2,
              "total_score": 0.20968421052631578
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.06666666666666667,
              "pattern_score": 0.0,
              "total_score": 0.06
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.3333333333333333,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.33428571428571424
            },
            "p32_payroll": {
              "keyword_score": 0.05263157894736842,
              "pattern_score": 0.0,
              "total_score": 0.047368421052631574
            },
            "payroll_statement": {
              "keyword_score": 0.027777777777777776,
              "pattern_score": 0.0,
              "total_score": 0.03
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.02564102564102564,
              "total_score": 0.02564102564102564
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 19,
      "text_length": 1812
    },
    {
      "confidence_score": 0.95,
      "document_type": "nominal_ledger",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to account codes, descriptions of transactions (e.g., \u0027Extra dividend\u0027, \u0027Dividend Accounted\u0027), and balances, which are key indicators of a nominal ledger. Additionally, the term \u0027Nominal Ledger\u0027 is explicitly mentioned in the document.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0bbnO1VyTGVB61xSM3nxSyG4dH\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"nominal_ledger\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains references to account codes, descriptions of transactions (e.g., \\\u0027Extra dividend\\\u0027, \\\u0027Dividend Accounted\\\u0027), and balances, which are key indicators of a nominal ledger. Additionally, the term \\\u0027Nominal Ledger\\\u0027 is explicitly mentioned in the document.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347117, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=217, prompt_tokens=1123, total_tokens=1340, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensD"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains references to account codes, descriptions of transactions (e.g., \u0027Extra dividend\u0027, \u0027Dividend Accounted\u0027), and balances, which are key indicators of a nominal ledger. Additionally, the term \u0027Nominal Ledger\u0027 is explicitly mentioned in the document.",
            "raw_response": "```json\n{\n    \"document_type\": \"nominal_ledger\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to account codes, descriptions of transactions (e.g., \u0027Extra dividend\u0027, \u0027Dividend Accounted\u0027), and balances, which are key indicators of a nominal ledger. Additionally, the term \u0027Nominal Ledger\u0027 is explicitly mentioned in the document.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "nominal_ledger"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.33428571428571424,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.03529411764705882
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.10526315789473684,
              "pattern_score": 0.1,
              "total_score": 0.12378947368421052
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.3333333333333333,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.33428571428571424
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 20,
      "text_length": 351
    },
    {
      "confidence_score": 0.95,
      "document_type": "mortgage_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document explicitly mentions \u0027Your Buy To Let Mortgage Statement,\u0027 includes a \u0027Mortgage Account Number,\u0027 and provides details such as the property address and the statement period. These are key indicators of a mortgage statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"1st April of last year to 31st March of this year\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": \"Flat 1, Russell House, 58 Sydenham Road, Croydon, CRO 2FJ\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0dwW0iTCL5bmsdTzQ41Qawyaby\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"mortgage_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document explicitly mentions \\\u0027Your Buy To Let Mortgage Statement,\\\u0027 includes a \\\u0027Mortgage Account Number,\\\u0027 and provides details such as the property address and the statement period. These are key indicators of a mortgage statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": \"1st April of last year to 31st March of this year\",\\n        \"mortgage_account_number\": \"1100059898\",\\n        \"property_address\": \"Flat 1, Russell House, 58 Sydenham Road, Croydon, CRO 2FJ\",\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347119, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=245, prompt_tokens=1356, total_tokens=1601, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": "1100059898",
              "outstanding_balance": null,
              "property_address": "Flat 1, Russell House, 58 Sydenham Road, Croydon, CRO 2FJ",
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "1st April of last year to 31st March of this year",
              "total_amount": null
            },
            "llm_reasoning": "The document explicitly mentions \u0027Your Buy To Let Mortgage Statement,\u0027 includes a \u0027Mortgage Account Number,\u0027 and provides details such as the property address and the statement period. These are key indicators of a mortgage statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document explicitly mentions \u0027Your Buy To Let Mortgage Statement,\u0027 includes a \u0027Mortgage Account Number,\u0027 and provides details such as the property address and the statement period. These are key indicators of a mortgage statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"1st April of last year to 31st March of this year\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": \"Flat 1, Russell House, 58 Sydenham Road, Croydon, CRO 2FJ\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "mortgage_statement"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.24822055137844612,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.09243697478991597
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.13157894736842105,
              "pattern_score": 0.19047619047619047,
              "total_score": 0.24822055137844612
            },
            "nominal_ledger": {
              "keyword_score": 0.08333333333333333,
              "pattern_score": 0.0,
              "total_score": 0.065
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "mortgage_statement"
        }
      },
      "page_number": 21,
      "text_length": 1522
    },
    {
      "confidence_score": 0.95,
      "document_type": "mortgage_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Your Mortgage Statement Summary\u0027, \u0027Account number\u0027, \u0027Repayment type\u0027, \u0027Remaining mortgage term\u0027, and \u0027Interest Rate Details\u0027. It also mentions \u0027Interest Only\u0027 repayment type and provides an interest rate and remaining term, which are specific to mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"3.99%\",\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": 106,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0g5iUfmDjkEZxjHJtPROt2gi7m\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"mortgage_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \\\u0027Your Mortgage Statement Summary\\\u0027, \\\u0027Account number\\\u0027, \\\u0027Repayment type\\\u0027, \\\u0027Remaining mortgage term\\\u0027, and \\\u0027Interest Rate Details\\\u0027. It also mentions \\\u0027Interest Only\\\u0027 repayment type and provides an interest rate and remaining term, which are specific to mortgage statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": \"3.99%\",\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": \"1100059898\",\\n        \"property_address\": null,\\n        \"remaining_term_months\": 106,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347122, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=234, prompt_tokens=1151, total_tokens=1385, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": "3.99%",
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": "1100059898",
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": 106,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a mortgage statement, such as \u0027Your Mortgage Statement Summary\u0027, \u0027Account number\u0027, \u0027Repayment type\u0027, \u0027Remaining mortgage term\u0027, and \u0027Interest Rate Details\u0027. It also mentions \u0027Interest Only\u0027 repayment type and provides an interest rate and remaining term, which are specific to mortgage statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Your Mortgage Statement Summary\u0027, \u0027Account number\u0027, \u0027Repayment type\u0027, \u0027Remaining mortgage term\u0027, and \u0027Interest Rate Details\u0027. It also mentions \u0027Interest Only\u0027 repayment type and provides an interest rate and remaining term, which are specific to mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"3.99%\",\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": 106,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "mortgage_statement"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.13152882205513783,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.09243697478991597
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.10526315789473684,
              "pattern_score": 0.047619047619047616,
              "total_score": 0.13152882205513783
            },
            "nominal_ledger": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.027777777777777776,
              "pattern_score": 0.0,
              "total_score": 0.03
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "mortgage_statement"
        }
      },
      "page_number": 22,
      "text_length": 747
    },
    {
      "confidence_score": 0.95,
      "document_type": "mortgage_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment Due\u0027, \u0027Payment received by DD\u0027, and a running balance. Additionally, it includes a transaction summary for a specific period and mentions that it is suitable for tax return purposes, which is typical for mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3212,160.19\",\n        \"statement_period\": \"1 April 2023 to 31 March 2024\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3705.55\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0igPXyMih9bZkojRfXslhF44jX\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"mortgage_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \\\u0027Mortgage Account Number\\\u0027, \\\u0027Interest Charged\\\u0027, \\\u0027Payment Due\\\u0027, \\\u0027Payment received by DD\\\u0027, and a running balance. Additionally, it includes a transaction summary for a specific period and mentions that it is suitable for tax return purposes, which is typical for mortgage statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a3212,160.19\",\\n        \"statement_period\": \"1 April 2023 to 31 March 2024\",\\n        \"mortgage_account_number\": \"1100059898\",\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a3705.55\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347124, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=255, prompt_tokens=1485, total_tokens=1740, completion_tokens_details=CompletionTokensDeta"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": "\u00a3705.55",
              "mortgage_account_number": "1100059898",
              "outstanding_balance": "\u00a3212,160.19",
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "1 April 2023 to 31 March 2024",
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment Due\u0027, \u0027Payment received by DD\u0027, and a running balance. Additionally, it includes a transaction summary for a specific period and mentions that it is suitable for tax return purposes, which is typical for mortgage statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment Due\u0027, \u0027Payment received by DD\u0027, and a running balance. Additionally, it includes a transaction summary for a specific period and mentions that it is suitable for tax return purposes, which is typical for mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3212,160.19\",\n        \"statement_period\": \"1 April 2023 to 31 March 2024\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3705.55\"\n    }\n}\n```"
          },
          "type": "mortgage_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.19831932773109243,
          "features": {
            "bank_statement": {
              "keyword_score": 0.23529411764705882,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.19831932773109243
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.1111111111111111,
              "pattern_score": 0.0,
              "total_score": 0.06666666666666667
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.10526315789473684,
              "pattern_score": 0.09523809523809523,
              "total_score": 0.16200501253132832
            },
            "nominal_ledger": {
              "keyword_score": 0.16666666666666666,
              "pattern_score": 0.0,
              "total_score": 0.13
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 23,
      "text_length": 1648
    },
    {
      "confidence_score": 0.95,
      "document_type": "mortgage_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and \u0027Mortgage Payment Due\u0027. It also includes a detailed breakdown of payments, interest charges, and balances over time, which are typical features of a mortgage statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3212,162.11\",\n        \"statement_period\": \"01 Aug 2023 to 01 Mar 2024\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3705.55\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0kY1p8WGrI7UsuxfBRVwTukTZT\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"mortgage_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \\\u0027Mortgage Account Number\\\u0027, \\\u0027Interest Charged\\\u0027, \\\u0027Payment received by DD\\\u0027, and \\\u0027Mortgage Payment Due\\\u0027. It also includes a detailed breakdown of payments, interest charges, and balances over time, which are typical features of a mortgage statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a3212,162.11\",\\n        \"statement_period\": \"01 Aug 2023 to 01 Mar 2024\",\\n        \"mortgage_account_number\": \"1100059898\",\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a3705.55\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347126, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=249, prompt_tokens=1468, total_tokens=1717, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audi"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": "\u00a3705.55",
              "mortgage_account_number": "1100059898",
              "outstanding_balance": "\u00a3212,162.11",
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "01 Aug 2023 to 01 Mar 2024",
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and \u0027Mortgage Payment Due\u0027. It also includes a detailed breakdown of payments, interest charges, and balances over time, which are typical features of a mortgage statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and \u0027Mortgage Payment Due\u0027. It also includes a detailed breakdown of payments, interest charges, and balances over time, which are typical features of a mortgage statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3212,162.11\",\n        \"statement_period\": \"01 Aug 2023 to 01 Mar 2024\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3705.55\"\n    }\n}\n```"
          },
          "type": "mortgage_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.19831932773109243,
          "features": {
            "bank_statement": {
              "keyword_score": 0.23529411764705882,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.19831932773109243
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.0,
              "total_score": 0.03333333333333333
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.02631578947368421,
              "pattern_score": 0.047619047619047616,
              "total_score": 0.05573934837092731
            },
            "nominal_ledger": {
              "keyword_score": 0.08333333333333333,
              "pattern_score": 0.0,
              "total_score": 0.065
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 24,
      "text_length": 1140
    },
    {
      "confidence_score": 0.95,
      "document_type": "mortgage_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and a closing balance. Additionally, it references a mortgage provider (Fleet Mortgages) and includes details about interest charged and payments made.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3212,175.64\",\n        \"statement_period\": \"1 April 2023 to 31 March 2024\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3705.55\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0mC6a1HitP5KN1b9hIwHV0wsyj\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"mortgage_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \\\u0027Mortgage Account Number\\\u0027, \\\u0027Interest Charged\\\u0027, \\\u0027Payment received by DD\\\u0027, and a closing balance. Additionally, it references a mortgage provider (Fleet Mortgages) and includes details about interest charged and payments made.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a3212,175.64\",\\n        \"statement_period\": \"1 April 2023 to 31 March 2024\",\\n        \"mortgage_account_number\": \"1100059898\",\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a3705.55\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347128, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=244, prompt_tokens=1162, total_tokens=1406, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasonin"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": "\u00a3705.55",
              "mortgage_account_number": "1100059898",
              "outstanding_balance": "\u00a3212,175.64",
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "1 April 2023 to 31 March 2024",
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and a closing balance. Additionally, it references a mortgage provider (Fleet Mortgages) and includes details about interest charged and payments made.",
            "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and a closing balance. Additionally, it references a mortgage provider (Fleet Mortgages) and includes details about interest charged and payments made.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3212,175.64\",\n        \"statement_period\": \"1 April 2023 to 31 March 2024\",\n        \"mortgage_account_number\": \"1100059898\",\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3705.55\"\n    }\n}\n```"
          },
          "type": "mortgage_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.19831932773109243,
          "features": {
            "bank_statement": {
              "keyword_score": 0.23529411764705882,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.19831932773109243
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.06666666666666667,
              "pattern_score": 0.0,
              "total_score": 0.04
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.1111111111111111,
              "pattern_score": 0.0,
              "total_score": 0.06666666666666667
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.02631578947368421,
              "pattern_score": 0.047619047619047616,
              "total_score": 0.05573934837092731
            },
            "nominal_ledger": {
              "keyword_score": 0.16666666666666666,
              "pattern_score": 0.0,
              "total_score": 0.13
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 25,
      "text_length": 531
    },
    {
      "confidence_score": 0.7,
      "document_type": "unknown",
      "features": {
        "llm_based": {
          "confidence": 0.7,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"invoice\",\n    \"confidence\": 0.7,\n    \"reasoning\": \"The document contains details of a valuation certificate, including a breakdown of items and their respective values, a total amount, and references to a vendor and purchaser. While it is not a traditional invoice, it closely resembles an invoice in structure and purpose, as it provides a detailed financial summary of goods and their valuation.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": \"Stocktake UK\",\n        \"invoice_date\": \"December 1, 2023\",\n        \"total_amount\": \"34365.93\",\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0npj27wNOV0WK1H9HERgiWBxb0\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"invoice\",\\n    \"confidence\": 0.7,\\n    \"reasoning\": \"The document contains details of a valuation certificate, including a breakdown of items and their respective values, a total amount, and references to a vendor and purchaser. While it is not a traditional invoice, it closely resembles an invoice in structure and purpose, as it provides a detailed financial summary of goods and their valuation.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": \"Stocktake UK\",\\n        \"invoice_date\": \"December 1, 2023\",\\n        \"total_amount\": \"34365.93\",\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347129, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=237, prompt_tokens=1395, total_tokens=1632, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tok"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": "December 1, 2023",
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": "Stocktake UK",
              "statement_period": null,
              "total_amount": "34365.93"
            },
            "llm_reasoning": "The document contains details of a valuation certificate, including a breakdown of items and their respective values, a total amount, and references to a vendor and purchaser. While it is not a traditional invoice, it closely resembles an invoice in structure and purpose, as it provides a detailed financial summary of goods and their valuation.",
            "raw_response": "```json\n{\n    \"document_type\": \"invoice\",\n    \"confidence\": 0.7,\n    \"reasoning\": \"The document contains details of a valuation certificate, including a breakdown of items and their respective values, a total amount, and references to a vendor and purchaser. While it is not a traditional invoice, it closely resembles an invoice in structure and purpose, as it provides a detailed financial summary of goods and their valuation.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": \"Stocktake UK\",\n        \"invoice_date\": \"December 1, 2023\",\n        \"total_amount\": \"34365.93\",\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "invoice"
        },
        "method_used": "uncertain",
        "pattern_based": {
          "confidence": 0.13,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.03529411764705882
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.038461538461538464,
              "pattern_score": 0.0,
              "total_score": 0.023076923076923078
            },
            "invoice": {
              "keyword_score": 0.1111111111111111,
              "pattern_score": 0.0,
              "total_score": 0.06666666666666667
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.16666666666666666,
              "pattern_score": 0.0,
              "total_score": 0.13
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 26,
      "text_length": 1384
    },
    {
      "confidence_score": 0.98,
      "document_type": "hp_agreement",
      "features": {
        "llm_based": {
          "confidence": 0.98,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.98,\n    \"reasoning\": \"The document explicitly mentions \u0027Hire Purchase Agreement\u0027 and includes key details such as \u0027Agreement Number\u0027, \u0027Balance Financed\u0027, \u0027Monthly Payment\u0027, and \u0027Hire Period\u0027, which are characteristic of hire purchase agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": \"54,256.58\",\n        \"monthly_payment\": \"1,760.08\",\n        \"loan_tenure\": \"36\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0ptbvCwDyTFmoL5b2NJmnCTLTp\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.98,\\n    \"reasoning\": \"The document explicitly mentions \\\u0027Hire Purchase Agreement\\\u0027 and includes key details such as \\\u0027Agreement Number\\\u0027, \\\u0027Balance Financed\\\u0027, \\\u0027Monthly Payment\\\u0027, and \\\u0027Hire Period\\\u0027, which are characteristic of hire purchase agreements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": \"54,256.58\",\\n        \"monthly_payment\": \"1,760.08\",\\n        \"loan_tenure\": \"36\",\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347131, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=215, prompt_tokens=1731, total_tokens=1946, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(audio_tokens=0, cached_t"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": "54,256.58",
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": "36",
              "monthly_payment": "1,760.08",
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document explicitly mentions \u0027Hire Purchase Agreement\u0027 and includes key details such as \u0027Agreement Number\u0027, \u0027Balance Financed\u0027, \u0027Monthly Payment\u0027, and \u0027Hire Period\u0027, which are characteristic of hire purchase agreements.",
            "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.98,\n    \"reasoning\": \"The document explicitly mentions \u0027Hire Purchase Agreement\u0027 and includes key details such as \u0027Agreement Number\u0027, \u0027Balance Financed\u0027, \u0027Monthly Payment\u0027, and \u0027Hire Period\u0027, which are characteristic of hire purchase agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": \"54,256.58\",\n        \"monthly_payment\": \"1,760.08\",\n        \"loan_tenure\": \"36\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "hp_agreement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.195,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.03529411764705882
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.2692307692307692,
              "pattern_score": 0.0625,
              "total_score": 0.18653846153846151
            },
            "invoice": {
              "keyword_score": 0.16666666666666666,
              "pattern_score": 0.0,
              "total_score": 0.09999999999999999
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.25,
              "pattern_score": 0.0,
              "total_score": 0.195
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 27,
      "text_length": 2556
    },
    {
      "confidence_score": 0.95,
      "document_type": "hp_agreement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027Agreement,\u0027 \u0027finance,\u0027 \u0027Supplier,\u0027 and \u0027Equipment.\u0027 It also includes terms like \u0027amount financed,\u0027 \u0027settlement amount,\u0027 and references to the Financial Services and Markets Act, which are typical in hire purchase or finance agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0rTBKNnId9FNF63MKMIWceZHLM\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \\\u0027Agreement,\\\u0027 \\\u0027finance,\\\u0027 \\\u0027Supplier,\\\u0027 and \\\u0027Equipment.\\\u0027 It also includes terms like \\\u0027amount financed,\\\u0027 \\\u0027settlement amount,\\\u0027 and references to the Financial Services and Markets Act, which are typical in hire purchase or finance agreements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347133, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=225, prompt_tokens=1602, total_tokens=1827, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, reject"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a hire purchase agreement, such as references to \u0027Agreement,\u0027 \u0027finance,\u0027 \u0027Supplier,\u0027 and \u0027Equipment.\u0027 It also includes terms like \u0027amount financed,\u0027 \u0027settlement amount,\u0027 and references to the Financial Services and Markets Act, which are typical in hire purchase or finance agreements.",
            "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027Agreement,\u0027 \u0027finance,\u0027 \u0027Supplier,\u0027 and \u0027Equipment.\u0027 It also includes terms like \u0027amount financed,\u0027 \u0027settlement amount,\u0027 and references to the Financial Services and Markets Act, which are typical in hire purchase or finance agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "hp_agreement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.065,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.03529411764705882
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.07692307692307693,
              "pattern_score": 0.0,
              "total_score": 0.046153846153846156
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.08333333333333333,
              "pattern_score": 0.0,
              "total_score": 0.065
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.013888888888888888,
              "pattern_score": 0.0,
              "total_score": 0.015
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 28,
      "text_length": 4689
    },
    {
      "confidence_score": 0.95,
      "document_type": "hp_agreement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027hire\u0027, \u0027agreement\u0027, \u0027equipment\u0027, \u0027rentals\u0027, \u0027payment of rentals\u0027, \u0027commencement of hire\u0027, and terms related to the use, maintenance, and payment for equipment. These are characteristic of a hire purchase or finance agreement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": \"not explicitly mentioned\",\n        \"amount_financed\": \"not explicitly mentioned\",\n        \"monthly_payment\": \"not explicitly mentioned\",\n        \"loan_tenure\": \"not explicitly mentioned\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0tBecjR5AaE2QDXy1YPcfUXzge\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \\\u0027hire\\\u0027, \\\u0027agreement\\\u0027, \\\u0027equipment\\\u0027, \\\u0027rentals\\\u0027, \\\u0027payment of rentals\\\u0027, \\\u0027commencement of hire\\\u0027, and terms related to the use, maintenance, and payment for equipment. These are characteristic of a hire purchase or finance agreement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": \"not explicitly mentioned\",\\n        \"amount_financed\": \"not explicitly mentioned\",\\n        \"monthly_payment\": \"not explicitly mentioned\",\\n        \"loan_tenure\": \"not explicitly mentioned\",\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347135, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=240, prompt_tokens=1654, total_tokens=1894, completion_tokens_details=CompletionTokensD"
            },
            "document_identifiers": {
              "agreement_date": "not explicitly mentioned",
              "amount_financed": "not explicitly mentioned",
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": "not explicitly mentioned",
              "monthly_payment": "not explicitly mentioned",
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a hire purchase agreement, such as references to \u0027hire\u0027, \u0027agreement\u0027, \u0027equipment\u0027, \u0027rentals\u0027, \u0027payment of rentals\u0027, \u0027commencement of hire\u0027, and terms related to the use, maintenance, and payment for equipment. These are characteristic of a hire purchase or finance agreement.",
            "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027hire\u0027, \u0027agreement\u0027, \u0027equipment\u0027, \u0027rentals\u0027, \u0027payment of rentals\u0027, \u0027commencement of hire\u0027, and terms related to the use, maintenance, and payment for equipment. These are characteristic of a hire purchase or finance agreement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": \"not explicitly mentioned\",\n        \"amount_financed\": \"not explicitly mentioned\",\n        \"monthly_payment\": \"not explicitly mentioned\",\n        \"loan_tenure\": \"not explicitly mentioned\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "hp_agreement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.2374736842105263,
          "features": {
            "bank_statement": {
              "keyword_score": 0.11764705882352941,
              "pattern_score": 0.0,
              "total_score": 0.07058823529411765
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.2631578947368421,
              "pattern_score": 0.1,
              "total_score": 0.2374736842105263
            },
            "hp_agreement": {
              "keyword_score": 0.038461538461538464,
              "pattern_score": 0.0,
              "total_score": 0.023076923076923078
            },
            "invoice": {
              "keyword_score": 0.16666666666666666,
              "pattern_score": 0.0,
              "total_score": 0.09999999999999999
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.02631578947368421,
              "pattern_score": 0.0,
              "total_score": 0.025263157894736838
            },
            "nominal_ledger": {
              "keyword_score": 0.08333333333333333,
              "pattern_score": 0.0,
              "total_score": 0.065
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.0,
              "total_score": 0.06
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "financial_statement"
        }
      },
      "page_number": 29,
      "text_length": 12322
    },
    {
      "confidence_score": 0.95,
      "document_type": "hp_agreement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and \u0027Termination\u0027. Additionally, it mentions terms like \u0027amount financed\u0027, \u0027insurance money\u0027, and \u0027hiring of the Equipment\u0027, which are specific to hire purchase agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW0vj9ATGZ8oYfUZNbCQ7x8FiEke\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \\\u0027Equipment\\\u0027, \\\u0027Insurance monies\\\u0027, \\\u0027Total Loss\\\u0027, \\\u0027Rentals\\\u0027, and \\\u0027Termination\\\u0027. Additionally, it mentions terms like \\\u0027amount financed\\\u0027, \\\u0027insurance money\\\u0027, and \\\u0027hiring of the Equipment\\\u0027, which are specific to hire purchase agreements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347137, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=228, prompt_tokens=1672, total_tokens=1900, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejecte"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a hire purchase agreement, such as references to \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and \u0027Termination\u0027. Additionally, it mentions terms like \u0027amount financed\u0027, \u0027insurance money\u0027, and \u0027hiring of the Equipment\u0027, which are specific to hire purchase agreements.",
            "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and \u0027Termination\u0027. Additionally, it mentions terms like \u0027amount financed\u0027, \u0027insurance money\u0027, and \u0027hiring of the Equipment\u0027, which are specific to hire purchase agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "hp_agreement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.13333333333333333,
          "features": {
            "bank_statement": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.03529411764705882
            },
            "corporation_tax": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.0,
              "total_score": 0.042352941176470586
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.10526315789473684,
              "pattern_score": 0.0,
              "total_score": 0.0757894736842105
            },
            "hp_agreement": {
              "keyword_score": 0.07692307692307693,
              "pattern_score": 0.0625,
              "total_score": 0.07115384615384615
            },
            "invoice": {
              "keyword_score": 0.2222222222222222,
              "pattern_score": 0.0,
              "total_score": 0.13333333333333333
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.02631578947368421,
              "pattern_score": 0.0,
              "total_score": 0.025263157894736838
            },
            "nominal_ledger": {
              "keyword_score": 0.16666666666666666,
              "pattern_score": 0.0,
              "total_score": 0.13
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.027777777777777776,
              "pattern_score": 0.0,
              "total_score": 0.03
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "invoice"
        }
      },
      "page_number": 30,
      "text_length": 11405
    },
    {
      "confidence_score": 0.95,
      "document_type": "hp_agreement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027Aldermore,\u0027 which is a financial institution often associated with hire purchase agreements. Additionally, the document discusses terms like \u0027amounts due,\u0027 \u0027commission,\u0027 and \u0027repossession,\u0027 which are common in hire purchase agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW13qZhW4UxXjzNQMig6DEHvvRay\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \\\u0027Option to Purchase,\\\u0027 \\\u0027Rentals,\\\u0027 \\\u0027Option to Purchase Fee,\\\u0027 \\\u0027hiring of the Equipment,\\\u0027 and \\\u0027Aldermore,\\\u0027 which is a financial institution often associated with hire purchase agreements. Additionally, the document discusses terms like \\\u0027amounts due,\\\u0027 \\\u0027commission,\\\u0027 and \\\u0027repossession,\\\u0027 which are common in hire purchase agreements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347145, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=250, prompt_tokens=1627, total_tokens=1877, compl"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027Aldermore,\u0027 which is a financial institution often associated with hire purchase agreements. Additionally, the document discusses terms like \u0027amounts due,\u0027 \u0027commission,\u0027 and \u0027repossession,\u0027 which are common in hire purchase agreements.",
            "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027Aldermore,\u0027 which is a financial institution often associated with hire purchase agreements. Additionally, the document discusses terms like \u0027amounts due,\u0027 \u0027commission,\u0027 and \u0027repossession,\u0027 which are common in hire purchase agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "hp_agreement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.10897435897435898,
          "features": {
            "bank_statement": {
              "keyword_score": 0.17647058823529413,
              "pattern_score": 0.0,
              "total_score": 0.10588235294117647
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.10526315789473684,
              "pattern_score": 0.0,
              "total_score": 0.0757894736842105
            },
            "hp_agreement": {
              "keyword_score": 0.038461538461538464,
              "pattern_score": 0.0,
              "total_score": 0.023076923076923078
            },
            "invoice": {
              "keyword_score": 0.16666666666666666,
              "pattern_score": 0.0,
              "total_score": 0.09999999999999999
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.05263157894736842,
              "pattern_score": 0.0,
              "total_score": 0.050526315789473676
            },
            "nominal_ledger": {
              "keyword_score": 0.08333333333333333,
              "pattern_score": 0.0,
              "total_score": 0.065
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.041666666666666664,
              "pattern_score": 0.0,
              "total_score": 0.045
            },
            "property_statement": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.02564102564102564,
              "total_score": 0.10897435897435898
            }
          },
          "type": "property_statement"
        }
      },
      "page_number": 31,
      "text_length": 10817
    },
    {
      "confidence_score": 0.8,
      "document_type": "unknown",
      "features": {
        "llm_based": {
          "confidence": 0.8,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"financial_statement\",\n    \"confidence\": 0.8,\n    \"reasoning\": \"The document discusses data protection, credit reference agencies, fraud prevention, and the processing of personal data for financial services. While it does not directly include specific financial figures or account details, the context and terminology suggest it is related to financial operations and compliance, which aligns most closely with a financial statement or related document.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW15KUM9sarG8ZabU3whvdQgx3Jr\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"financial_statement\",\\n    \"confidence\": 0.8,\\n    \"reasoning\": \"The document discusses data protection, credit reference agencies, fraud prevention, and the processing of personal data for financial services. While it does not directly include specific financial figures or account details, the context and terminology suggest it is related to financial operations and compliance, which aligns most closely with a financial statement or related document.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347147, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=225, prompt_tokens=1580, total_tokens=1805, completion_tokens_details=CompletionTokensDetails(accepted_pre"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document discusses data protection, credit reference agencies, fraud prevention, and the processing of personal data for financial services. While it does not directly include specific financial figures or account details, the context and terminology suggest it is related to financial operations and compliance, which aligns most closely with a financial statement or related document.",
            "raw_response": "```json\n{\n    \"document_type\": \"financial_statement\",\n    \"confidence\": 0.8,\n    \"reasoning\": \"The document discusses data protection, credit reference agencies, fraud prevention, and the processing of personal data for financial services. While it does not directly include specific financial figures or account details, the context and terminology suggest it is related to financial operations and compliance, which aligns most closely with a financial statement or related document.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "financial_statement"
        },
        "method_used": "uncertain",
        "pattern_based": {
          "confidence": 0.07058823529411765,
          "features": {
            "bank_statement": {
              "keyword_score": 0.11764705882352941,
              "pattern_score": 0.0,
              "total_score": 0.07058823529411765
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.038461538461538464,
              "pattern_score": 0.0,
              "total_score": 0.023076923076923078
            },
            "invoice": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.027777777777777776,
              "pattern_score": 0.0,
              "total_score": 0.03
            },
            "property_statement": {
              "keyword_score": 0.027777777777777776,
              "pattern_score": 0.0,
              "total_score": 0.041666666666666664
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 32,
      "text_length": 7424
    },
    {
      "confidence_score": 0.95,
      "document_type": "payroll_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"payroll_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains detailed payroll information, including employee names, gross pay, taxable gross, tax, NICs, net pay, employer NICs, and cost to employer. These are key indicators of a payroll statement. Additionally, the document is titled \u0027Payroll Summary\u0027 and includes data for multiple employees across two months, which is characteristic of payroll summaries or history reports.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW18c801EkaBvEzWbGWMr4iTsMK3\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"payroll_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains detailed payroll information, including employee names, gross pay, taxable gross, tax, NICs, net pay, employer NICs, and cost to employer. These are key indicators of a payroll statement. Additionally, the document is titled \\\u0027Payroll Summary\\\u0027 and includes data for multiple employees across two months, which is characteristic of payroll summaries or history reports.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347150, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=236, prompt_tokens=2693, total_tokens=2929, completion_tokens_details=CompletionTokensDetails(accepted_pred"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains detailed payroll information, including employee names, gross pay, taxable gross, tax, NICs, net pay, employer NICs, and cost to employer. These are key indicators of a payroll statement. Additionally, the document is titled \u0027Payroll Summary\u0027 and includes data for multiple employees across two months, which is characteristic of payroll summaries or history reports.",
            "raw_response": "```json\n{\n    \"document_type\": \"payroll_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains detailed payroll information, including employee names, gross pay, taxable gross, tax, NICs, net pay, employer NICs, and cost to employer. These are key indicators of a payroll statement. Additionally, the document is titled \u0027Payroll Summary\u0027 and includes data for multiple employees across two months, which is characteristic of payroll summaries or history reports.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "payroll_statement"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.4881818181818182,
          "features": {
            "bank_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.1111111111111111,
              "pattern_score": 0.0,
              "total_score": 0.06666666666666667
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.25,
              "pattern_score": 0.30303030303030304,
              "total_score": 0.4881818181818182
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "payroll_statement"
        }
      },
      "page_number": 33,
      "text_length": 6074
    },
    {
      "confidence_score": 0.95,
      "document_type": "payroll_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"payroll_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains detailed payroll information such as employee names, gross pay, taxable gross, net pay, deductions, employer NICs, and cost to employer. It also includes a summary of payroll data for multiple employees over a specific period, which is characteristic of a payroll statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CtW19IJuEsy1iMcFgLq3J6TVrSIxO\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"payroll_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains detailed payroll information such as employee names, gross pay, taxable gross, net pay, deductions, employer NICs, and cost to employer. It also includes a summary of payroll data for multiple employees over a specific period, which is characteristic of a payroll statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null,\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1767347151, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=219, prompt_tokens=2699, total_tokens=2918, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tok"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains detailed payroll information such as employee names, gross pay, taxable gross, net pay, deductions, employer NICs, and cost to employer. It also includes a summary of payroll data for multiple employees over a specific period, which is characteristic of a payroll statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"payroll_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains detailed payroll information such as employee names, gross pay, taxable gross, net pay, deductions, employer NICs, and cost to employer. It also includes a summary of payroll data for multiple employees over a specific period, which is characteristic of a payroll statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "payroll_statement"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.42136363636363633,
          "features": {
            "bank_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "invoice": {
              "keyword_score": 0.1111111111111111,
              "pattern_score": 0.0,
              "total_score": 0.06666666666666667
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "mortgage_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "p32_payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll_statement": {
              "keyword_score": 0.20833333333333334,
              "pattern_score": 0.2727272727272727,
              "total_score": 0.42136363636363633
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "payroll_statement"
        }
      },
      "page_number": 34,
      "text_length": 4043
    }
  ],
  "processing_timestamp": "2026-01-02T09:45:52.875314"
}