Merged PDF Processing Results

Back to Dashboard
PDF Information
Original Filename: ilovepdf_merged_9.pdf
Upload Date: December 18, 2025 at 03:09 PM
Total Pages: 31
Processing Status: Completed
Extraction Summary
Total Documents: 9
Bank Statements: 1
Credit Cards: 1
Hp Agreements: 1
Mortgage Statements: 2
Loan Statements: 1
Property Statements: 3
Page Classification Results
Page 1

Bank Statement

95%
Page 2

Bank Statement

95%
Page 3

Bank Statement

95%
Page 4

Bank Statement

95%
Page 5

Bank Statement

95%
Page 6

Bank Statement

95%
Page 7

Credit Card

95%
Page 8

Credit Card

95%
Page 9

Credit Card

95%
Page 10

Credit Card

95%
Page 11

Credit Card

95%
Page 12

Hp Agreement

95%
Page 13

Hp Agreement

95%
Page 14

Hp Agreement

95%
Page 15

Hp Agreement

95%
Page 16

Hp Agreement

95%
Page 17

Unknown

70%
Page 18

Mortgage Statement

98%
Page 19

Mortgage Statement

95%
Page 20

Mortgage Statement

95%
Page 21

Loan Statement

95%
Page 22

Loan Statement

95%
Page 23

Property Statement

95%
Page 24

Mortgage Statement

95%
Page 25

Mortgage Statement

95%
Page 26

Mortgage Statement

95%
Page 27

Mortgage Statement

95%
Page 28

Mortgage Statement

95%
Page 29

Property Statement

95%
Page 30

Property Statement

95%
Page 31

Property Statement

85%
Extracted Documents 9
Document Type Pages Confidence Processing Status Created Actions
Bank Statement 1-6 (6 pages) 95% Processed 2025-12-18 15:09 View
Credit Card 7-11 (5 pages) 95% Processed 2025-12-18 15:09 View
Hp Agreement 12-16 (5 pages) 95% Processed 2025-12-18 15:09 View
Mortgage Statement 18-20 (3 pages) 96% Processed 2025-12-18 15:10 View
Loan Statement 21-22 (2 pages) 95% Processed 2025-12-18 15:10 View
Property Statement 23 (1 page) 95% Processed 2025-12-18 15:10 No view available
Mortgage Statement 24-28 (5 pages) 95% Processed 2025-12-18 15:10 View
Property Statement 29 (1 page) 95% Processed 2025-12-18 15:10 No view available
Property Statement 30-31 (2 pages) 95% Processed 2025-12-18 15:10 No view available
{
  "document_groups": [
    {
      "avg_confidence": 0.9499999999999998,
      "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": "01 JAN 2025 to 31 JAN 2025",
        "total_amount": null
      },
      "document_type": "bank_statement",
      "end_page": 6,
      "pages": [
        {
          "confidence_score": 0.95,
          "document_type": "bank_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, deposits, withdrawals, and balances. It also includes a summary of the account activity for a specific period and references to the bank (NatWest).\",\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\": \"01 JAN 2025 to 31 JAN 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-Co9tqb8FWRWHOIIvdpPTC94xtUIy3\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"bank_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, deposits, withdrawals, and balances. It also includes a summary of the account activity for a specific period and references to the bank (NatWest).\",\\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\": \"01 JAN 2025 to 31 JAN 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=1766070490, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=229, prompt_tokens=2056, total_tokens=2285, 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": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "01 JAN 2025 to 31 JAN 2025",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, deposits, withdrawals, and balances. It also includes a summary of the account activity for a specific period and references to the bank (NatWest).",
                "raw_response": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, deposits, withdrawals, and balances. It also includes a summary of the account activity for a specific period and references to the bank (NatWest).\",\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\": \"01 JAN 2025 to 31 JAN 2025\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "bank_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.195,
              "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.13333333333333333,
                  "pattern_score": 0.0,
                  "total_score": 0.08
                },
                "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.0,
                  "total_score": 0.025263157894736838
                },
                "nominal_ledger": {
                  "keyword_score": 0.25,
                  "pattern_score": 0.0,
                  "total_score": 0.195
                },
                "payroll": {
                  "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": 1,
          "text_length": 2962
        },
        {
          "confidence_score": 0.95,
          "document_type": "bank_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, 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-Co9tsFgddT0r1EHYHySnbhG4r80Ag\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"bank_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, 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=1766070492, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=214, prompt_tokens=2164, total_tokens=2378, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDe"
                },
                "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 bank statement, such as account numbers, sort codes, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, invoices, payroll, or other financial documents.",
                "raw_response": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, 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": "bank_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.13,
              "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.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.0,
                  "total_score": 0.025263157894736838
                },
                "nominal_ledger": {
                  "keyword_score": 0.16666666666666666,
                  "pattern_score": 0.0,
                  "total_score": 0.13
                },
                "payroll": {
                  "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": 2,
          "text_length": 3154
        },
        {
          "confidence_score": 0.95,
          "document_type": "bank_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account name, account number, sort code, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There are no indicators of other document types like invoices, loan statements, or 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\": 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-Co9ttoxIGKADlO58y1kfgEXLbS2Cq\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"bank_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account name, account number, sort code, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There are no indicators of other document types like invoices, loan statements, or 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\": 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=1766070493, 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=2148, total_tokens=2364, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_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 key indicators of a bank statement, such as account name, account number, sort code, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There are no indicators of other document types like invoices, loan statements, or mortgage statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account name, account number, sort code, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There are no indicators of other document types like invoices, loan statements, or 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\": 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": "bank_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.195,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.17647058823529413,
                  "pattern_score": 0.0,
                  "total_score": 0.10588235294117647
                },
                "corporation_tax": {
                  "keyword_score": 0.058823529411764705,
                  "pattern_score": 0.1,
                  "total_score": 0.0903529411764706
                },
                "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.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.25,
                  "pattern_score": 0.0,
                  "total_score": 0.195
                },
                "payroll": {
                  "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": 3,
          "text_length": 3463
        },
        {
          "confidence_score": 0.95,
          "document_type": "bank_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, 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-Co9tw3KmmL0mL8Ixbxt2ulXbFjT96\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"bank_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, 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=1766070496, 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=2207, total_tokens=2422, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details"
                },
                "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 bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, invoices, payroll, or other financial documents.",
                "raw_response": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, 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": "bank_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.13,
              "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.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.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.16666666666666666,
                  "pattern_score": 0.0,
                  "total_score": 0.13
                },
                "payroll": {
                  "keyword_score": 0.05,
                  "pattern_score": 0.0,
                  "total_score": 0.03
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 4,
          "text_length": 3080
        },
        {
          "confidence_score": 0.95,
          "document_type": "bank_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as an account name, account number, sort code, transaction descriptions, dates, amounts paid in and withdrawn, and running balances. It also includes references to charges and bill payments, which are typical of bank 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-Co9tySDyq7wwvk30GHrLz1tDtkHWo\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"bank_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as an account name, account number, sort code, transaction descriptions, dates, amounts paid in and withdrawn, and running balances. It also includes references to charges and bill payments, which are typical of bank 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=1766070498, 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=1394, total_tokens=1610, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_detai"
                },
                "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 bank statement, such as an account name, account number, sort code, transaction descriptions, dates, amounts paid in and withdrawn, and running balances. It also includes references to charges and bill payments, which are typical of bank statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as an account name, account number, sort code, transaction descriptions, dates, amounts paid in and withdrawn, and running balances. It also includes references to charges and bill payments, which are typical of bank 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": "bank_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.195,
              "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.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.25,
                  "pattern_score": 0.0,
                  "total_score": 0.195
                },
                "payroll": {
                  "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": 5,
          "text_length": 1219
        },
        {
          "confidence_score": 0.95,
          "document_type": "bank_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as an account name (\u0027J \u0026 J MAINTENANCE (HOLDINGS) LTD\u0027), account number (\u002794161356\u0027), sort code (\u002760-17-21\u0027), and references to banking services and statements. There are no indicators of transactions, balances, or other financial categories like invoices, loans, or mortgages.\",\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-Co9u0g5PuCe1mtMfK9WamRF5h45JF\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"bank_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as an account name (\\\u0027J \u0026 J MAINTENANCE (HOLDINGS) LTD\\\u0027), account number (\\\u002794161356\\\u0027), sort code (\\\u002760-17-21\\\u0027), and references to banking services and statements. There are no indicators of transactions, balances, or other financial categories like invoices, loans, or mortgages.\",\\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=1766070500, 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=1624, total_tokens=1861, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_token"
                },
                "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 bank statement, such as an account name (\u0027J \u0026 J MAINTENANCE (HOLDINGS) LTD\u0027), account number (\u002794161356\u0027), sort code (\u002760-17-21\u0027), and references to banking services and statements. There are no indicators of transactions, balances, or other financial categories like invoices, loans, or mortgages.",
                "raw_response": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as an account name (\u0027J \u0026 J MAINTENANCE (HOLDINGS) LTD\u0027), account number (\u002794161356\u0027), sort code (\u002760-17-21\u0027), and references to banking services and statements. There are no indicators of transactions, balances, or other financial categories like invoices, loans, or mortgages.\",\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": "bank_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.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.08333333333333333,
                  "pattern_score": 0.0,
                  "total_score": 0.065
                },
                "payroll": {
                  "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": 6,
          "text_length": 4017
        }
      ],
      "start_page": 1
    },
    {
      "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": "From 27 May to 26 June 2024",
        "total_amount": null
      },
      "document_type": "credit_card",
      "end_page": 11,
      "pages": [
        {
          "confidence_score": 0.95,
          "document_type": "credit_card",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a membership number, a spending limit, a statement period, a payment due date, and a closing balance. Additionally, it includes transaction details and references to American Express, which is a credit card provider.\",\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\": \"From 27 May to 26 June 2024\",\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-Co9u2zAX1lO8PEBAEAEbwloGgPb5m\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"credit_card\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a membership number, a spending limit, a statement period, a payment due date, and a closing balance. Additionally, it includes transaction details and references to American Express, which is a credit card provider.\",\\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\": \"From 27 May to 26 June 2024\",\\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=1766070502, 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=1419, total_tokens=1647, 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": "From 27 May to 26 June 2024",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a credit card statement, such as a membership number, a spending limit, a statement period, a payment due date, and a closing balance. Additionally, it includes transaction details and references to American Express, which is a credit card provider.",
                "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a membership number, a spending limit, a statement period, a payment due date, and a closing balance. Additionally, it includes transaction details and references to American Express, which is a credit card provider.\",\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\": \"From 27 May to 26 June 2024\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "credit_card"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.1411764705882353,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.23529411764705882,
                  "pattern_score": 0.0,
                  "total_score": 0.1411764705882353
                },
                "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.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.08333333333333333,
                  "pattern_score": 0.0,
                  "total_score": 0.065
                },
                "payroll": {
                  "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": 1691
        },
        {
          "confidence_score": 0.95,
          "document_type": "credit_card",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a card number, transaction details with dates and amounts, foreign transaction fees, and payment instructions specific to a credit card account. It also references a \u0027Statement of Account\u0027 for a business credit card.\",\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\": \"26/06/24 to 26/07/24\",\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-Co9u4iimLHQCKvQp0RtbjOKRXlRhG\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"credit_card\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a card number, transaction details with dates and amounts, foreign transaction fees, and payment instructions specific to a credit card account. It also references a \\\u0027Statement of Account\\\u0027 for a business credit card.\",\\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\": \"26/06/24 to 26/07/24\",\\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=1766070504, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=227, prompt_tokens=1832, total_tokens=2059, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prom"
                },
                "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": "26/06/24 to 26/07/24",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a credit card statement, such as a card number, transaction details with dates and amounts, foreign transaction fees, and payment instructions specific to a credit card account. It also references a \u0027Statement of Account\u0027 for a business credit card.",
                "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a card number, transaction details with dates and amounts, foreign transaction fees, and payment instructions specific to a credit card account. It also references a \u0027Statement of Account\u0027 for a business credit card.\",\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\": \"26/06/24 to 26/07/24\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "credit_card"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.2042857142857143,
              "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.0,
                  "total_score": 0.025263157894736838
                },
                "nominal_ledger": {
                  "keyword_score": 0.16666666666666666,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.2042857142857143
                },
                "payroll": {
                  "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": 8,
          "text_length": 3498
        },
        {
          "confidence_score": 0.95,
          "document_type": "credit_card",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a membership number, transaction details, and a next statement date. It also includes a breakdown of transactions and a total spend amount, which are typical features of credit card 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-Co9u6jwU5dUvtOwZyMgmJGLaF0dyz\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"credit_card\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a membership number, transaction details, and a next statement date. It also includes a breakdown of transactions and a total spend amount, which are typical features of credit card 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=1766070506, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=210, prompt_tokens=1072, total_tokens=1282, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(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 key indicators of a credit card statement, such as a membership number, transaction details, and a next statement date. It also includes a breakdown of transactions and a total spend amount, which are typical features of credit card statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a membership number, transaction details, and a next statement date. It also includes a breakdown of transactions and a total spend amount, which are typical features of credit card 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": "credit_card"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.03529411764705882,
              "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.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
                },
                "payroll": {
                  "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": 9,
          "text_length": 401
        },
        {
          "confidence_score": 0.95,
          "document_type": "credit_card",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a card type (\u0027SBS Platinum Charge Card\u0027), card number, membership rewards points, statement period (\u002720/05/24 to 19/06/24\u0027), and next statement date (\u002726/07/24\u0027). It also includes details about cardmember offers and travel insurance, which are typical of credit card 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\": \"20/05/24 to 19/06/24\",\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-Co9u8Mbo5O5kEBcDpFr65PTjBsuCs\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"credit_card\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a card type (\\\u0027SBS Platinum Charge Card\\\u0027), card number, membership rewards points, statement period (\\\u002720/05/24 to 19/06/24\\\u0027), and next statement date (\\\u002726/07/24\\\u0027). It also includes details about cardmember offers and travel insurance, which are typical of credit card 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\": \"20/05/24 to 19/06/24\",\\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=1766070508, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=251, prompt_tokens=1474, total_tokens=1725, 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": "20/05/24 to 19/06/24",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a credit card statement, such as a card type (\u0027SBS Platinum Charge Card\u0027), card number, membership rewards points, statement period (\u002720/05/24 to 19/06/24\u0027), and next statement date (\u002726/07/24\u0027). It also includes details about cardmember offers and travel insurance, which are typical of credit card statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a card type (\u0027SBS Platinum Charge Card\u0027), card number, membership rewards points, statement period (\u002720/05/24 to 19/06/24\u0027), and next statement date (\u002726/07/24\u0027). It also includes details about cardmember offers and travel insurance, which are typical of credit card 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\": \"20/05/24 to 19/06/24\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "credit_card"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.10588235294117647,
              "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.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.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll": {
                  "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": 10,
          "text_length": 2145
        },
        {
          "confidence_score": 0.95,
          "document_type": "credit_card",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document mentions \u0027American Express Business Platinum Card\u0027, \u0027Statement of Account\u0027, and includes details such as \u0027Membership Number\u0027, \u0027Next Statement Date\u0027, and references to managing the card account online. These are clear indicators of a credit card 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-Co9uAVdfZuFiOFlACclyXW9Mx47P7\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"credit_card\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document mentions \\\u0027American Express Business Platinum Card\\\u0027, \\\u0027Statement of Account\\\u0027, and includes details such as \\\u0027Membership Number\\\u0027, \\\u0027Next Statement Date\\\u0027, and references to managing the card account online. These are clear indicators of a credit card 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=1766070510, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=210, prompt_tokens=1117, total_tokens=1327, 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 \u0027American Express Business Platinum Card\u0027, \u0027Statement of Account\u0027, and includes details such as \u0027Membership Number\u0027, \u0027Next Statement Date\u0027, and references to managing the card account online. These are clear indicators of a credit card statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document mentions \u0027American Express Business Platinum Card\u0027, \u0027Statement of Account\u0027, and includes details such as \u0027Membership Number\u0027, \u0027Next Statement Date\u0027, and references to managing the card account online. These are clear indicators of a credit card 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": "credit_card"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.03529411764705882,
              "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.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll": {
                  "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": 11,
          "text_length": 682
        }
      ],
      "start_page": 7
    },
    {
      "avg_confidence": 0.95,
      "document_identifiers": {
        "agreement_date": "date it is signed by Aldermore",
        "amount_financed": "54,256.58",
        "annual_interest_rate": "5% per annum above Finance House Base Rate",
        "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": 16,
      "pages": [
        {
          "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 explicitly mentions \u0027Hire Purchase Agreement\u0027 and includes key indicators such as \u0027amount financed\u0027, \u0027monthly payment\u0027, \u0027loan tenure\u0027, and other financial details specific to hire purchase agreements. It also includes terms like \u0027Option to Purchase Fee\u0027 and \u0027Balance financed\u0027, which are characteristic of HP 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-Co9uCNn3hNp9xaaugd9iLyrdhd7Zn\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 explicitly mentions \\\u0027Hire Purchase Agreement\\\u0027 and includes key indicators such as \\\u0027amount financed\\\u0027, \\\u0027monthly payment\\\u0027, \\\u0027loan tenure\\\u0027, and other financial details specific to hire purchase agreements. It also includes terms like \\\u0027Option to Purchase Fee\\\u0027 and \\\u0027Balance financed\\\u0027, which are characteristic of HP 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=1766070512, 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=1687, total_tokens=1921, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reaso"
                },
                "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 indicators such as \u0027amount financed\u0027, \u0027monthly payment\u0027, \u0027loan tenure\u0027, and other financial details specific to hire purchase agreements. It also includes terms like \u0027Option to Purchase Fee\u0027 and \u0027Balance financed\u0027, which are characteristic of HP agreements.",
                "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document explicitly mentions \u0027Hire Purchase Agreement\u0027 and includes key indicators such as \u0027amount financed\u0027, \u0027monthly payment\u0027, \u0027loan tenure\u0027, and other financial details specific to hire purchase agreements. It also includes terms like \u0027Option to Purchase Fee\u0027 and \u0027Balance financed\u0027, which are characteristic of HP 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
                },
                "payroll": {
                  "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": 12,
          "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, \u0027Equipment\u0027, and declarations related to business purposes and financial arrangements. It also explicitly mentions the lender (Aldermore) providing finance for equipment, which is 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\": 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-Co9uFYvyb2pJD3XVUzU4zYK5Yc9C4\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, \\\u0027Equipment\\\u0027, and declarations related to business purposes and financial arrangements. It also explicitly mentions the lender (Aldermore) providing finance for equipment, which is 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\": 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=1766070515, 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=1558, total_tokens=1783, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoni"
                },
                "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, \u0027Equipment\u0027, and declarations related to business purposes and financial arrangements. It also explicitly mentions the lender (Aldermore) providing finance for equipment, which is characteristic of 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 \u0027Agreement\u0027, \u0027finance\u0027, \u0027Supplier\u0027, \u0027Equipment\u0027, and declarations related to business purposes and financial arrangements. It also explicitly mentions the lender (Aldermore) providing finance for equipment, which is 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\": 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
                },
                "payroll": {
                  "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": 13,
          "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 \u0027Agreement\u0027, \u0027Equipment\u0027, \u0027Rentals\u0027, \u0027Direct Debit\u0027, and terms related to payment schedules and maintenance responsibilities. These are typical of 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\": \"date it is signed by Aldermore\",\n        \"amount_financed\": null,\n        \"monthly_payment\": \"Rentals and any other payments specified on page 1\",\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"5% per annum above Finance House Base Rate\",\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-Co9uIWYotd8cXpNvvQXZtvBLmnsDw\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, \\\u0027Equipment\\\u0027, \\\u0027Rentals\\\u0027, \\\u0027Direct Debit\\\u0027, and terms related to payment schedules and maintenance responsibilities. These are typical of 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\": \"date it is signed by Aldermore\",\\n        \"amount_financed\": null,\\n        \"monthly_payment\": \"Rentals and any other payments specified on page 1\",\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": \"5% per annum above Finance House Base Rate\",\\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=1766070518, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=241, prompt_tokens=1610, total_tokens=1851, completion_tokens_details=CompletionTokensDetails(accepted_pre"
                },
                "document_identifiers": {
                  "agreement_date": "date it is signed by Aldermore",
                  "amount_financed": null,
                  "annual_interest_rate": "5% per annum above Finance House Base Rate",
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": "Rentals and any other payments specified on page 1",
                  "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, \u0027Equipment\u0027, \u0027Rentals\u0027, \u0027Direct Debit\u0027, and terms related to payment schedules and maintenance responsibilities. These are typical of 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, \u0027Equipment\u0027, \u0027Rentals\u0027, \u0027Direct Debit\u0027, and terms related to payment schedules and maintenance responsibilities. These are typical of 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\": \"date it is signed by Aldermore\",\n        \"amount_financed\": null,\n        \"monthly_payment\": \"Rentals and any other payments specified on page 1\",\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"5% per annum above Finance House Base Rate\",\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
                },
                "payroll": {
                  "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": "financial_statement"
            }
          },
          "page_number": 14,
          "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 terms related to termination and payment obligations. These are typical elements 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\": 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-Co9uLgsO0rpUSPHfnyR3LsPjYh5iE\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 terms related to termination and payment obligations. These are typical elements 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\": 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=1766070521, 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=1628, total_tokens=1843, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTok"
                },
                "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 terms related to termination and payment obligations. These are typical elements 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 \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and terms related to termination and payment obligations. These are typical elements 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\": 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
                },
                "payroll": {
                  "keyword_score": 0.05,
                  "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": 15,
          "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 like \u0027Agreement,\u0027 \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 and \u0027Equipment,\u0027 which are indicative of a hire purchase agreement. Additionally, it discusses terms such as \u0027termination of the hiring,\u0027 \u0027Option to Purchase Fee,\u0027 and \u0027amounts due under this Agreement,\u0027 which are specific to 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-Co9uNoaeyUXrrM6xSFGYjpYp6DgIZ\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 like \\\u0027Agreement,\\\u0027 \\\u0027Option to Purchase,\\\u0027 \\\u0027Rentals,\\\u0027 and \\\u0027Equipment,\\\u0027 which are indicative of a hire purchase agreement. Additionally, it discusses terms such as \\\u0027termination of the hiring,\\\u0027 \\\u0027Option to Purchase Fee,\\\u0027 and \\\u0027amounts due under this Agreement,\\\u0027 which are specific to 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=1766070523, 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=1583, total_tokens=1817, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, a"
                },
                "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 like \u0027Agreement,\u0027 \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 and \u0027Equipment,\u0027 which are indicative of a hire purchase agreement. Additionally, it discusses terms such as \u0027termination of the hiring,\u0027 \u0027Option to Purchase Fee,\u0027 and \u0027amounts due under this Agreement,\u0027 which are specific to hire purchase or finance agreements.",
                "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to terms like \u0027Agreement,\u0027 \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 and \u0027Equipment,\u0027 which are indicative of a hire purchase agreement. Additionally, it discusses terms such as \u0027termination of the hiring,\u0027 \u0027Option to Purchase Fee,\u0027 and \u0027amounts due under this Agreement,\u0027 which are specific to 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.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
                },
                "payroll": {
                  "keyword_score": 0.05,
                  "pattern_score": 0.0,
                  "total_score": 0.03
                },
                "property_statement": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.02564102564102564,
                  "total_score": 0.10897435897435898
                }
              },
              "type": "property_statement"
            }
          },
          "page_number": 16,
          "text_length": 10817
        }
      ],
      "start_page": 12
    },
    {
      "avg_confidence": 0.96,
      "document_identifiers": {
        "agreement_date": null,
        "amount_financed": null,
        "annual_interest_rate": "3.59%",
        "invoice_date": null,
        "invoice_number": null,
        "loan_reference": null,
        "loan_tenure": null,
        "monthly_payment": null,
        "monthly_payment_amount": "\u00a3804.94",
        "mortgage_account_number": "71019693",
        "outstanding_balance": "\u00a3268,999.95",
        "property_address": "160, Humber Avenue, Coventry, CV1 2AR",
        "remaining_term_months": 277,
        "seller_name": null,
        "statement_period": "1 October 2023 - 30 September 2024",
        "total_amount": null
      },
      "document_type": "mortgage_statement",
      "end_page": 20,
      "pages": [
        {
          "confidence_score": 0.98,
          "document_type": "mortgage_statement",
          "features": {
            "llm_based": {
              "confidence": 0.98,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.98,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027remaining term\u0027, \u0027monthly payment\u0027, \u0027account balance\u0027, and \u0027interest rate\u0027. It also explicitly mentions \u0027annual mortgage statement\u0027 and provides details about the mortgage account and repayment terms.\",\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\": \"71019693\",\n        \"property_address\": \"160, Humber Avenue, Coventry, CV1 2AR\",\n        \"remaining_term_months\": 277,\n        \"monthly_payment_amount\": \"\u00a3804.94\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Co9uSV1mzRqJbW8K4k6UfuvOQ4Uph\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.98,\\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \\\u0027mortgage account number\\\u0027, \\\u0027property address\\\u0027, \\\u0027remaining term\\\u0027, \\\u0027monthly payment\\\u0027, \\\u0027account balance\\\u0027, and \\\u0027interest rate\\\u0027. It also explicitly mentions \\\u0027annual mortgage statement\\\u0027 and provides details about the mortgage account and repayment terms.\",\\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\": \"71019693\",\\n        \"property_address\": \"160, Humber Avenue, Coventry, CV1 2AR\",\\n        \"remaining_term_months\": 277,\\n        \"monthly_payment_amount\": \"\u00a3804.94\"\\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=1766070528, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=242, prompt_tokens=1480, total_tokens=1722, completion_tokens_details=CompletionTokensDetails(accepted_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": "\u00a3804.94",
                  "mortgage_account_number": "71019693",
                  "outstanding_balance": null,
                  "property_address": "160, Humber Avenue, Coventry, CV1 2AR",
                  "remaining_term_months": 277,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a mortgage statement, such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027remaining term\u0027, \u0027monthly payment\u0027, \u0027account balance\u0027, and \u0027interest rate\u0027. It also explicitly mentions \u0027annual mortgage statement\u0027 and provides details about the mortgage account and repayment terms.",
                "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.98,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027remaining term\u0027, \u0027monthly payment\u0027, \u0027account balance\u0027, and \u0027interest rate\u0027. It also explicitly mentions \u0027annual mortgage statement\u0027 and provides details about the mortgage account and repayment terms.\",\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\": \"71019693\",\n        \"property_address\": \"160, Humber Avenue, Coventry, CV1 2AR\",\n        \"remaining_term_months\": 277,\n        \"monthly_payment_amount\": \"\u00a3804.94\"\n    }\n}\n```"
              },
              "type": "mortgage_statement"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.4912280701754386,
              "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.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.2894736842105263,
                  "pattern_score": 0.3333333333333333,
                  "total_score": 0.4912280701754386
                },
                "nominal_ledger": {
                  "keyword_score": 0.08333333333333333,
                  "pattern_score": 0.0,
                  "total_score": 0.065
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.02564102564102564,
                  "total_score": 0.02564102564102564
                }
              },
              "type": "mortgage_statement"
            }
          },
          "page_number": 18,
          "text_length": 2038
        },
        {
          "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 is titled \u0027Annual Statement\u0027 and includes key indicators such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027monthly payment amount\u0027, \u0027outstanding balance\u0027, and \u0027interest charge\u0027. These are typical elements 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\": \"\u00a3268,999.95\",\n        \"statement_period\": \"1 October 2023 - 30 September 2024\",\n        \"mortgage_account_number\": \"71019693\",\n        \"property_address\": \"160, Humber Avenue, Coventry, CV1 2AR\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3804.94\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Co9uVD2SJPVBAVPtynhKZoxEwdwNv\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 is titled \\\u0027Annual Statement\\\u0027 and includes key indicators such as \\\u0027mortgage account number\\\u0027, \\\u0027property address\\\u0027, \\\u0027monthly payment amount\\\u0027, \\\u0027outstanding balance\\\u0027, and \\\u0027interest charge\\\u0027. These are typical elements 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\": \"\u00a3268,999.95\",\\n        \"statement_period\": \"1 October 2023 - 30 September 2024\",\\n        \"mortgage_account_number\": \"71019693\",\\n        \"property_address\": \"160, Humber Avenue, Coventry, CV1 2AR\",\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a3804.94\"\\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=1766070531, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=248, prompt_tokens=1759, total_tokens=2007, 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": "\u00a3804.94",
                  "mortgage_account_number": "71019693",
                  "outstanding_balance": "\u00a3268,999.95",
                  "property_address": "160, Humber Avenue, Coventry, CV1 2AR",
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "1 October 2023 - 30 September 2024",
                  "total_amount": null
                },
                "llm_reasoning": "The document is titled \u0027Annual Statement\u0027 and includes key indicators such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027monthly payment amount\u0027, \u0027outstanding balance\u0027, and \u0027interest charge\u0027. These are typical elements of a mortgage statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Annual Statement\u0027 and includes key indicators such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027monthly payment amount\u0027, \u0027outstanding balance\u0027, and \u0027interest charge\u0027. These are typical elements 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\": \"\u00a3268,999.95\",\n        \"statement_period\": \"1 October 2023 - 30 September 2024\",\n        \"mortgage_account_number\": \"71019693\",\n        \"property_address\": \"160, Humber Avenue, Coventry, CV1 2AR\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3804.94\"\n    }\n}\n```"
              },
              "type": "mortgage_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.1411764705882353,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.23529411764705882,
                  "pattern_score": 0.0,
                  "total_score": 0.1411764705882353
                },
                "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.07894736842105263,
                  "pattern_score": 0.09523809523809523,
                  "total_score": 0.13674185463659147
                },
                "nominal_ledger": {
                  "keyword_score": 0.16666666666666666,
                  "pattern_score": 0.0,
                  "total_score": 0.13
                },
                "payroll": {
                  "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": 19,
          "text_length": 2145
        },
        {
          "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\u0027, \u0027property may be repossessed\u0027, \u0027interest rate summary\u0027, \u0027closing balance\u0027, and \u0027instalment due\u0027. It also includes details like interest rate, outstanding balance, and payments made during the statement period, which are typical of 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.59%\",\n        \"outstanding_balance\": \"\u00a3268,984.99\",\n        \"statement_period\": \"1 October 2023 to 30 September 2024\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3804.94\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Co9uX0W0RRSlFGdff2ejzfLRZk1Ei\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\\\u0027, \\\u0027property may be repossessed\\\u0027, \\\u0027interest rate summary\\\u0027, \\\u0027closing balance\\\u0027, and \\\u0027instalment due\\\u0027. It also includes details like interest rate, outstanding balance, and payments made during the statement period, which are typical of 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.59%\",\\n        \"outstanding_balance\": \"\u00a3268,984.99\",\\n        \"statement_period\": \"1 October 2023 to 30 September 2024\",\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a3804.94\"\\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=1766070533, 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=1129, total_tokens=1384, completion_tokens_details=CompletionTokensDetails(accepted_"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": "3.59%",
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": "\u00a3804.94",
                  "mortgage_account_number": null,
                  "outstanding_balance": "\u00a3268,984.99",
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "1 October 2023 to 30 September 2024",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a mortgage statement, such as \u0027mortgage\u0027, \u0027property may be repossessed\u0027, \u0027interest rate summary\u0027, \u0027closing balance\u0027, and \u0027instalment due\u0027. It also includes details like interest rate, outstanding balance, and payments made during the statement period, which are typical of 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\u0027, \u0027property may be repossessed\u0027, \u0027interest rate summary\u0027, \u0027closing balance\u0027, and \u0027instalment due\u0027. It also includes details like interest rate, outstanding balance, and payments made during the statement period, which are typical of 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.59%\",\n        \"outstanding_balance\": \"\u00a3268,984.99\",\n        \"statement_period\": \"1 October 2023 to 30 September 2024\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3804.94\"\n    }\n}\n```"
              },
              "type": "mortgage_statement"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.10626566416040101,
              "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.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.07894736842105263,
                  "pattern_score": 0.047619047619047616,
                  "total_score": 0.10626566416040101
                },
                "nominal_ledger": {
                  "keyword_score": 0.08333333333333333,
                  "pattern_score": 0.0,
                  "total_score": 0.065
                },
                "payroll": {
                  "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": 20,
          "text_length": 615
        }
      ],
      "start_page": 18
    },
    {
      "avg_confidence": 0.95,
      "document_identifiers": {
        "agreement_date": null,
        "amount_financed": null,
        "annual_interest_rate": "2.500%",
        "invoice_date": null,
        "invoice_number": null,
        "loan_reference": "23653883476995",
        "loan_tenure": null,
        "monthly_payment": null,
        "monthly_payment_amount": null,
        "mortgage_account_number": null,
        "outstanding_balance": "14966.52",
        "property_address": null,
        "remaining_term_months": null,
        "seller_name": null,
        "statement_period": "10 August 2024 to 11 August 2025",
        "total_amount": null
      },
      "document_type": "loan_statement",
      "end_page": 22,
      "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 Account Statement\u0027 and includes key indicators such as \u0027Barclayloan for Business,\u0027 \u0027Annual Interest Rates,\u0027 \u0027Loan Account Statement,\u0027 and a detailed list of transactions with payments and interest. These are characteristic 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\": null,\n        \"loan_reference\": \"23653883476995\",\n        \"annual_interest_rate\": \"2.500%\",\n        \"outstanding_balance\": \"14966.52\",\n        \"statement_period\": \"10 August 2024 to 11 August 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-Co9uatLFwW8yPe8b1VHBl4Ep2Viqw\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 Account Statement\\\u0027 and includes key indicators such as \\\u0027Barclayloan for Business,\\\u0027 \\\u0027Annual Interest Rates,\\\u0027 \\\u0027Loan Account Statement,\\\u0027 and a detailed list of transactions with payments and interest. These are characteristic 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\": null,\\n        \"loan_reference\": \"23653883476995\",\\n        \"annual_interest_rate\": \"2.500%\",\\n        \"outstanding_balance\": \"14966.52\",\\n        \"statement_period\": \"10 August 2024 to 11 August 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=1766070536, 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=1435, total_tokens=1672, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_p"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": "2.500%",
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": "23653883476995",
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": "14966.52",
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "10 August 2024 to 11 August 2025",
                  "total_amount": null
                },
                "llm_reasoning": "The document is titled \u0027Loan Account Statement\u0027 and includes key indicators such as \u0027Barclayloan for Business,\u0027 \u0027Annual Interest Rates,\u0027 \u0027Loan Account Statement,\u0027 and a detailed list of transactions with payments and interest. These are characteristic of loan statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Account Statement\u0027 and includes key indicators such as \u0027Barclayloan for Business,\u0027 \u0027Annual Interest Rates,\u0027 \u0027Loan Account Statement,\u0027 and a detailed list of transactions with payments and interest. These are characteristic 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\": null,\n        \"loan_reference\": \"23653883476995\",\n        \"annual_interest_rate\": \"2.500%\",\n        \"outstanding_balance\": \"14966.52\",\n        \"statement_period\": \"10 August 2024 to 11 August 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.9272727272727272,
              "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.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.3333333333333333,
                  "pattern_score": 0.2727272727272727,
                  "strong_indicators": true,
                  "total_score": 0.9272727272727272
                },
                "mortgage_statement": {
                  "keyword_score": 0.05263157894736842,
                  "pattern_score": 0.0,
                  "total_score": 0.050526315789473676
                },
                "nominal_ledger": {
                  "keyword_score": 0.16666666666666666,
                  "pattern_score": 0.0,
                  "total_score": 0.13
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "property_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.02564102564102564,
                  "total_score": 0.02564102564102564
                }
              },
              "type": "loan_statement"
            }
          },
          "page_number": 21,
          "text_length": 1272
        },
        {
          "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 references to \u0027Direct Debit Payment,\u0027 \u0027Interest,\u0027 \u0027Closing Balance,\u0027 and a running balance in debit (DR). Additionally, it mentions obtaining a settlement figure and calculating interest daily, which are typical features 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\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"10833.49\",\n        \"statement_period\": \"17 Feb 2025 - 11 Aug 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-Co9ud0k7BdtCaI23r174rEd2jHBhA\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 references to \\\u0027Direct Debit Payment,\\\u0027 \\\u0027Interest,\\\u0027 \\\u0027Closing Balance,\\\u0027 and a running balance in debit (DR). Additionally, it mentions obtaining a settlement figure and calculating interest daily, which are typical features 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\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"10833.49\",\\n        \"statement_period\": \"17 Feb 2025 - 11 Aug 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=1766070539, 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=1409, total_tokens=1643, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_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": "10833.49",
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "17 Feb 2025 - 11 Aug 2025",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a loan statement, such as references to \u0027Direct Debit Payment,\u0027 \u0027Interest,\u0027 \u0027Closing Balance,\u0027 and a running balance in debit (DR). Additionally, it mentions obtaining a settlement figure and calculating interest daily, which are typical features 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 references to \u0027Direct Debit Payment,\u0027 \u0027Interest,\u0027 \u0027Closing Balance,\u0027 and a running balance in debit (DR). Additionally, it mentions obtaining a settlement figure and calculating interest daily, which are typical features 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\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"10833.49\",\n        \"statement_period\": \"17 Feb 2025 - 11 Aug 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": "llm_preferred",
            "pattern_based": {
              "confidence": 0.13,
              "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.05555555555555555,
                  "pattern_score": 0.0,
                  "total_score": 0.03333333333333333
                },
                "loan_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "strong_indicators": true,
                  "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
                },
                "payroll": {
                  "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": 22,
          "text_length": 1598
        }
      ],
      "start_page": 21
    },
    {
      "avg_confidence": 0.95,
      "document_identifiers": {
        "agreement_date": null,
        "amount_financed": null,
        "annual_interest_rate": null,
        "completion_date": "15th July 2022",
        "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": "36 Noreen Avenue, Prestwich, Manchester, Greater Manchester, M25 ILT",
        "purchase_sale_price": "\u00a3192,600.00",
        "remaining_term_months": null,
        "seller_name": null,
        "statement_period": null,
        "total_amount": null
      },
      "document_type": "property_statement",
      "end_page": 23,
      "pages": [
        {
          "confidence_score": 0.95,
          "document_type": "property_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion Date,\u0027 \u0027Sale price of the property,\u0027 and a detailed breakdown of payments and disbursements related to the sale of a property. Additionally, the property address is explicitly mentioned, which is a strong indicator of a property 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\": \"36 Noreen Avenue, Prestwich, Manchester, Greater Manchester, M25 ILT\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null,\n        \"completion_date\": \"15th July 2022\",\n        \"purchase_sale_price\": \"\u00a3192,600.00\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Co9uf8gsZbYPbfmhfdTpDdNsH056F\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"property_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Completion Statement\\\u0027 and includes key indicators such as \\\u0027Completion Date,\\\u0027 \\\u0027Sale price of the property,\\\u0027 and a detailed breakdown of payments and disbursements related to the sale of a property. Additionally, the property address is explicitly mentioned, which is a strong indicator of a property 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\": \"36 Noreen Avenue, Prestwich, Manchester, Greater Manchester, M25 ILT\",\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null,\\n        \"completion_date\": \"15th July 2022\",\\n        \"purchase_sale_price\": \"\u00a3192,600.00\"\\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=1766070541, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_token"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "completion_date": "15th July 2022",
                  "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": "36 Noreen Avenue, Prestwich, Manchester, Greater Manchester, M25 ILT",
                  "purchase_sale_price": "\u00a3192,600.00",
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion Date,\u0027 \u0027Sale price of the property,\u0027 and a detailed breakdown of payments and disbursements related to the sale of a property. Additionally, the property address is explicitly mentioned, which is a strong indicator of a property statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion Date,\u0027 \u0027Sale price of the property,\u0027 and a detailed breakdown of payments and disbursements related to the sale of a property. Additionally, the property address is explicitly mentioned, which is a strong indicator of a property 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\": \"36 Noreen Avenue, Prestwich, Manchester, Greater Manchester, M25 ILT\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null,\n        \"completion_date\": \"15th July 2022\",\n        \"purchase_sale_price\": \"\u00a3192,600.00\"\n    }\n}\n```"
              },
              "type": "property_statement"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.2532051282051282,
              "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.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.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "property_statement": {
                  "keyword_score": 0.08333333333333333,
                  "pattern_score": 0.1282051282051282,
                  "total_score": 0.2532051282051282
                }
              },
              "type": "property_statement"
            }
          },
          "page_number": 23,
          "text_length": 853
        }
      ],
      "start_page": 23
    },
    {
      "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": "1 April 2023 to 31 March 2024",
        "total_amount": null
      },
      "document_type": "mortgage_statement",
      "end_page": 28,
      "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, \u0027Mortgage Account Number\u0027, and \u0027Property Address\u0027, which are key indicators of a mortgage statement. Additionally, it includes references to mortgage payments, a mortgage account number, and a property address, which are specific to this category.\",\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\": \"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-Co9uhJ8NRJ5y8ffo9bBTWI7rLGOUf\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, \\\u0027Mortgage Account Number\\\u0027, and \\\u0027Property Address\\\u0027, which are key indicators of a mortgage statement. Additionally, it includes references to mortgage payments, a mortgage account number, and a property address, which are specific to this category.\",\\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\": \"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=1766070543, 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=1312, total_tokens=1559, completion_tokens_details=CompletionTokensDetails(accepted_predict"
                },
                "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": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document explicitly mentions \u0027Your Buy To Let Mortgage Statement\u0027, \u0027Mortgage Account Number\u0027, and \u0027Property Address\u0027, which are key indicators of a mortgage statement. Additionally, it includes references to mortgage payments, a mortgage account number, and a property address, which are specific to this category.",
                "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, \u0027Mortgage Account Number\u0027, and \u0027Property Address\u0027, which are key indicators of a mortgage statement. Additionally, it includes references to mortgage payments, a mortgage account number, and a property address, which are specific to this category.\",\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\": \"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
                },
                "payroll": {
                  "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": 24,
          "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 \u0027Remaining mortgage term,\u0027 \u0027Interest Rate Details,\u0027 and references to \u0027repayment type\u0027 and \u0027interest only mortgage.\u0027 These are specific to mortgage-related 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\": \"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-Co9ujaXe38xeqCXGonO665FUoX3B5\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 \\\u0027Remaining mortgage term,\\\u0027 \\\u0027Interest Rate Details,\\\u0027 and references to \\\u0027repayment type\\\u0027 and \\\u0027interest only mortgage.\\\u0027 These are specific to mortgage-related 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\": \"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=1766070545, 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=1107, total_tokens=1333, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_token"
                },
                "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 \u0027Remaining mortgage term,\u0027 \u0027Interest Rate Details,\u0027 and references to \u0027repayment type\u0027 and \u0027interest only mortgage.\u0027 These are specific to mortgage-related documents.",
                "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 \u0027Remaining mortgage term,\u0027 \u0027Interest Rate Details,\u0027 and references to \u0027repayment type\u0027 and \u0027interest only mortgage.\u0027 These are specific to mortgage-related 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\": \"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
                },
                "payroll": {
                  "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": 25,
          "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-Co9ulLEjESHM3iRCSYiMW1TNOmARw\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=1766070547, 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=1441, total_tokens=1696, 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
                },
                "payroll": {
                  "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": 26,
          "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 a running balance. It also includes monthly payment amounts and references to a mortgage account.\",\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\": null,\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-Co9uo2x89rw3J8i6x2I3isxvO6Gxq\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 running balance. It also includes monthly payment amounts and references to a mortgage account.\",\\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\": null,\\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=1766070550, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=223, prompt_tokens=1424, total_tokens=1647, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokens"
                },
                "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": null,
                  "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 running balance. It also includes monthly payment amounts and references to a mortgage account.",
                "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 running balance. It also includes monthly payment amounts and references to a mortgage account.\",\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\": null,\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
                },
                "payroll": {
                  "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": 27,
          "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 \u0027Closing balance\u0027. Additionally, it includes a mortgage account number and references to interest and payments, 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\": 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-Co9uqkhbu2X7iPomA2K4JmZyMRqX0\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 \\\u0027Closing balance\\\u0027. Additionally, it includes a mortgage account number and references to interest and payments, 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\": 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=1766070552, 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=1118, total_tokens=1362, 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": "\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 \u0027Closing balance\u0027. Additionally, it includes a mortgage account number and references to interest and payments, 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 \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and \u0027Closing balance\u0027. Additionally, it includes a mortgage account number and references to interest and payments, 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\": 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
                },
                "payroll": {
                  "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": 28,
          "text_length": 531
        }
      ],
      "start_page": 24
    },
    {
      "avg_confidence": 0.9166666666666666,
      "document_identifiers": {
        "agreement_date": null,
        "amount_financed": null,
        "annual_interest_rate": null,
        "completion_date": "Tbc",
        "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": "16 Hoylake Close CV11 6NJ",
        "purchase_price": "\u00a3241,000.00",
        "remaining_term_months": null,
        "seller_name": null,
        "statement_period": null,
        "total_amount": null
      },
      "document_type": "property_statement",
      "end_page": 31,
      "pages": [
        {
          "confidence_score": 0.95,
          "document_type": "property_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion Date\u0027, \u0027Purchase price\u0027, and \u0027Matter: Purchase of [property address]\u0027. These are specific to property transactions and align with the \u0027property_statement\u0027 category.\",\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\": \"16 Hoylake Close CV11 6NJ\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null,\n        \"completion_date\": \"Tbc\",\n        \"purchase_price\": \"\u00a3241,000.00\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Co9usDcGw4UKiDnv70alGbPw4IYdM\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"property_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Completion Statement\\\u0027 and includes key indicators such as \\\u0027Completion Date\\\u0027, \\\u0027Purchase price\\\u0027, and \\\u0027Matter: Purchase of [property address]\\\u0027. These are specific to property transactions and align with the \\\u0027property_statement\\\u0027 category.\",\\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\": \"16 Hoylake Close CV11 6NJ\",\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null,\\n        \"completion_date\": \"Tbc\",\\n        \"purchase_price\": \"\u00a3241,000.00\"\\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=1766070554, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=242, prompt_tokens=1421, total_tokens=1663, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "completion_date": "Tbc",
                  "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": "16 Hoylake Close CV11 6NJ",
                  "purchase_price": "\u00a3241,000.00",
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion Date\u0027, \u0027Purchase price\u0027, and \u0027Matter: Purchase of [property address]\u0027. These are specific to property transactions and align with the \u0027property_statement\u0027 category.",
                "raw_response": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion Date\u0027, \u0027Purchase price\u0027, and \u0027Matter: Purchase of [property address]\u0027. These are specific to property transactions and align with the \u0027property_statement\u0027 category.\",\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\": \"16 Hoylake Close CV11 6NJ\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null,\n        \"completion_date\": \"Tbc\",\n        \"purchase_price\": \"\u00a3241,000.00\"\n    }\n}\n```"
              },
              "type": "property_statement"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.22756410256410256,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.11764705882352941,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.12773109243697478
                },
                "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.16666666666666666,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.2042857142857143
                },
                "payroll": {
                  "keyword_score": 0.05,
                  "pattern_score": 0.0,
                  "total_score": 0.03
                },
                "property_statement": {
                  "keyword_score": 0.08333333333333333,
                  "pattern_score": 0.10256410256410256,
                  "total_score": 0.22756410256410256
                }
              },
              "type": "property_statement"
            }
          },
          "page_number": 29,
          "text_length": 1544
        },
        {
          "confidence_score": 0.95,
          "document_type": "property_statement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion date\u0027, \u0027Purchase price\u0027, and a property address (\u002712 Boswell Drive, Coventry, CV2 2DH\u0027). These are characteristic of property completion or conveyancing 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\": \"12 Boswell Drive, Coventry, CV2 2DH\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null,\n        \"completion_date\": \"1st May 2024\",\n        \"purchase_price\": \"\u00a3158,000.00\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Co9uuvZG1GKzCluAcCxGfBEopl3SW\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"property_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Completion Statement\\\u0027 and includes key indicators such as \\\u0027Completion date\\\u0027, \\\u0027Purchase price\\\u0027, and a property address (\\\u002712 Boswell Drive, Coventry, CV2 2DH\\\u0027). These are characteristic of property completion or conveyancing 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\": \"12 Boswell Drive, Coventry, CV2 2DH\",\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null,\\n        \"completion_date\": \"1st May 2024\",\\n        \"purchase_price\": \"\u00a3158,000.00\"\\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=1766070556, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=252, prompt_tokens=1442, total_tokens=1694, completion_tokens_details=CompletionTokensDetails(accepted_predicti"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "completion_date": "1st May 2024",
                  "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": "12 Boswell Drive, Coventry, CV2 2DH",
                  "purchase_price": "\u00a3158,000.00",
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion date\u0027, \u0027Purchase price\u0027, and a property address (\u002712 Boswell Drive, Coventry, CV2 2DH\u0027). These are characteristic of property completion or conveyancing statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion date\u0027, \u0027Purchase price\u0027, and a property address (\u002712 Boswell Drive, Coventry, CV2 2DH\u0027). These are characteristic of property completion or conveyancing 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\": \"12 Boswell Drive, Coventry, CV2 2DH\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null,\n        \"completion_date\": \"1st May 2024\",\n        \"purchase_price\": \"\u00a3158,000.00\"\n    }\n}\n```"
              },
              "type": "property_statement"
            },
            "method_used": "both_agree",
            "pattern_based": {
              "confidence": 0.3205128205128205,
              "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.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
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "property_statement": {
                  "keyword_score": 0.1111111111111111,
                  "pattern_score": 0.15384615384615385,
                  "total_score": 0.3205128205128205
                }
              },
              "type": "property_statement"
            }
          },
          "page_number": 30,
          "text_length": 1520
        },
        {
          "confidence_score": 0.85,
          "document_type": "property_statement",
          "features": {
            "llm_based": {
              "confidence": 0.85,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.85,\n    \"reasoning\": \"The document contains references to a solicitor\u0027s firm, payment instructions, and a file reference number, which are common in property completion or conveyancing statements. However, it lacks explicit details like a completion date or property address, which slightly reduces confidence.\",\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-Co9uy8rAc4Hmcjd5vepIN7DDzPuwe\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"property_statement\",\\n    \"confidence\": 0.85,\\n    \"reasoning\": \"The document contains references to a solicitor\\\u0027s firm, payment instructions, and a file reference number, which are common in property completion or conveyancing statements. However, it lacks explicit details like a completion date or property address, which slightly reduces confidence.\",\\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=1766070560, 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=1118, total_tokens=1330, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_de"
                },
                "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 a solicitor\u0027s firm, payment instructions, and a file reference number, which are common in property completion or conveyancing statements. However, it lacks explicit details like a completion date or property address, which slightly reduces confidence.",
                "raw_response": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.85,\n    \"reasoning\": \"The document contains references to a solicitor\u0027s firm, payment instructions, and a file reference number, which are common in property completion or conveyancing statements. However, it lacks explicit details like a completion date or property address, which slightly reduces confidence.\",\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": "property_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.2042857142857143,
              "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.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "nominal_ledger": {
                  "keyword_score": 0.16666666666666666,
                  "pattern_score": 0.14285714285714285,
                  "total_score": 0.2042857142857143
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "property_statement": {
                  "keyword_score": 0.05555555555555555,
                  "pattern_score": 0.05128205128205128,
                  "total_score": 0.13461538461538464
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 31,
          "text_length": 691
        }
      ],
      "start_page": 29
    }
  ],
  "page_classifications": [
    {
      "confidence_score": 0.95,
      "document_type": "bank_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, deposits, withdrawals, and balances. It also includes a summary of the account activity for a specific period and references to the bank (NatWest).\",\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\": \"01 JAN 2025 to 31 JAN 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-Co9tqb8FWRWHOIIvdpPTC94xtUIy3\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"bank_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, deposits, withdrawals, and balances. It also includes a summary of the account activity for a specific period and references to the bank (NatWest).\",\\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\": \"01 JAN 2025 to 31 JAN 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=1766070490, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=229, prompt_tokens=2056, total_tokens=2285, 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": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "01 JAN 2025 to 31 JAN 2025",
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, deposits, withdrawals, and balances. It also includes a summary of the account activity for a specific period and references to the bank (NatWest).",
            "raw_response": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, deposits, withdrawals, and balances. It also includes a summary of the account activity for a specific period and references to the bank (NatWest).\",\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\": \"01 JAN 2025 to 31 JAN 2025\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "bank_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.195,
          "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.13333333333333333,
              "pattern_score": 0.0,
              "total_score": 0.08
            },
            "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.0,
              "total_score": 0.025263157894736838
            },
            "nominal_ledger": {
              "keyword_score": 0.25,
              "pattern_score": 0.0,
              "total_score": 0.195
            },
            "payroll": {
              "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": 1,
      "text_length": 2962
    },
    {
      "confidence_score": 0.95,
      "document_type": "bank_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, 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-Co9tsFgddT0r1EHYHySnbhG4r80Ag\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"bank_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, 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=1766070492, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=214, prompt_tokens=2164, total_tokens=2378, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDe"
            },
            "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 bank statement, such as account numbers, sort codes, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, invoices, payroll, or other financial documents.",
            "raw_response": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, 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": "bank_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.13,
          "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.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.0,
              "total_score": 0.025263157894736838
            },
            "nominal_ledger": {
              "keyword_score": 0.16666666666666666,
              "pattern_score": 0.0,
              "total_score": 0.13
            },
            "payroll": {
              "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": 2,
      "text_length": 3154
    },
    {
      "confidence_score": 0.95,
      "document_type": "bank_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account name, account number, sort code, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There are no indicators of other document types like invoices, loan statements, or 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\": 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-Co9ttoxIGKADlO58y1kfgEXLbS2Cq\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"bank_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account name, account number, sort code, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There are no indicators of other document types like invoices, loan statements, or 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\": 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=1766070493, 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=2148, total_tokens=2364, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_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 key indicators of a bank statement, such as account name, account number, sort code, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There are no indicators of other document types like invoices, loan statements, or mortgage statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account name, account number, sort code, transaction dates, descriptions, amounts paid in and withdrawn, and running balances. There are no indicators of other document types like invoices, loan statements, or 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\": 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": "bank_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.195,
          "features": {
            "bank_statement": {
              "keyword_score": 0.17647058823529413,
              "pattern_score": 0.0,
              "total_score": 0.10588235294117647
            },
            "corporation_tax": {
              "keyword_score": 0.058823529411764705,
              "pattern_score": 0.1,
              "total_score": 0.0903529411764706
            },
            "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.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.25,
              "pattern_score": 0.0,
              "total_score": 0.195
            },
            "payroll": {
              "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": 3,
      "text_length": 3463
    },
    {
      "confidence_score": 0.95,
      "document_type": "bank_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, 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-Co9tw3KmmL0mL8Ixbxt2ulXbFjT96\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"bank_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, 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=1766070496, 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=2207, total_tokens=2422, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details"
            },
            "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 bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, invoices, payroll, or other financial documents.",
            "raw_response": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as account numbers, sort codes, transaction dates, descriptions of transactions, amounts paid in and withdrawn, and running balances. There is no mention of credit card details, 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": "bank_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.13,
          "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.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.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.16666666666666666,
              "pattern_score": 0.0,
              "total_score": 0.13
            },
            "payroll": {
              "keyword_score": 0.05,
              "pattern_score": 0.0,
              "total_score": 0.03
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 4,
      "text_length": 3080
    },
    {
      "confidence_score": 0.95,
      "document_type": "bank_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as an account name, account number, sort code, transaction descriptions, dates, amounts paid in and withdrawn, and running balances. It also includes references to charges and bill payments, which are typical of bank 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-Co9tySDyq7wwvk30GHrLz1tDtkHWo\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"bank_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as an account name, account number, sort code, transaction descriptions, dates, amounts paid in and withdrawn, and running balances. It also includes references to charges and bill payments, which are typical of bank 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=1766070498, 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=1394, total_tokens=1610, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_detai"
            },
            "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 bank statement, such as an account name, account number, sort code, transaction descriptions, dates, amounts paid in and withdrawn, and running balances. It also includes references to charges and bill payments, which are typical of bank statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as an account name, account number, sort code, transaction descriptions, dates, amounts paid in and withdrawn, and running balances. It also includes references to charges and bill payments, which are typical of bank 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": "bank_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.195,
          "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.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.25,
              "pattern_score": 0.0,
              "total_score": 0.195
            },
            "payroll": {
              "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": 5,
      "text_length": 1219
    },
    {
      "confidence_score": 0.95,
      "document_type": "bank_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as an account name (\u0027J \u0026 J MAINTENANCE (HOLDINGS) LTD\u0027), account number (\u002794161356\u0027), sort code (\u002760-17-21\u0027), and references to banking services and statements. There are no indicators of transactions, balances, or other financial categories like invoices, loans, or mortgages.\",\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-Co9u0g5PuCe1mtMfK9WamRF5h45JF\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"bank_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as an account name (\\\u0027J \u0026 J MAINTENANCE (HOLDINGS) LTD\\\u0027), account number (\\\u002794161356\\\u0027), sort code (\\\u002760-17-21\\\u0027), and references to banking services and statements. There are no indicators of transactions, balances, or other financial categories like invoices, loans, or mortgages.\",\\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=1766070500, 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=1624, total_tokens=1861, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_token"
            },
            "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 bank statement, such as an account name (\u0027J \u0026 J MAINTENANCE (HOLDINGS) LTD\u0027), account number (\u002794161356\u0027), sort code (\u002760-17-21\u0027), and references to banking services and statements. There are no indicators of transactions, balances, or other financial categories like invoices, loans, or mortgages.",
            "raw_response": "```json\n{\n    \"document_type\": \"bank_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a bank statement, such as an account name (\u0027J \u0026 J MAINTENANCE (HOLDINGS) LTD\u0027), account number (\u002794161356\u0027), sort code (\u002760-17-21\u0027), and references to banking services and statements. There are no indicators of transactions, balances, or other financial categories like invoices, loans, or mortgages.\",\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": "bank_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.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.08333333333333333,
              "pattern_score": 0.0,
              "total_score": 0.065
            },
            "payroll": {
              "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": 6,
      "text_length": 4017
    },
    {
      "confidence_score": 0.95,
      "document_type": "credit_card",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a membership number, a spending limit, a statement period, a payment due date, and a closing balance. Additionally, it includes transaction details and references to American Express, which is a credit card provider.\",\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\": \"From 27 May to 26 June 2024\",\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-Co9u2zAX1lO8PEBAEAEbwloGgPb5m\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"credit_card\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a membership number, a spending limit, a statement period, a payment due date, and a closing balance. Additionally, it includes transaction details and references to American Express, which is a credit card provider.\",\\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\": \"From 27 May to 26 June 2024\",\\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=1766070502, 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=1419, total_tokens=1647, 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": "From 27 May to 26 June 2024",
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a credit card statement, such as a membership number, a spending limit, a statement period, a payment due date, and a closing balance. Additionally, it includes transaction details and references to American Express, which is a credit card provider.",
            "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a membership number, a spending limit, a statement period, a payment due date, and a closing balance. Additionally, it includes transaction details and references to American Express, which is a credit card provider.\",\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\": \"From 27 May to 26 June 2024\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "credit_card"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.1411764705882353,
          "features": {
            "bank_statement": {
              "keyword_score": 0.23529411764705882,
              "pattern_score": 0.0,
              "total_score": 0.1411764705882353
            },
            "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.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.08333333333333333,
              "pattern_score": 0.0,
              "total_score": 0.065
            },
            "payroll": {
              "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": 1691
    },
    {
      "confidence_score": 0.95,
      "document_type": "credit_card",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a card number, transaction details with dates and amounts, foreign transaction fees, and payment instructions specific to a credit card account. It also references a \u0027Statement of Account\u0027 for a business credit card.\",\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\": \"26/06/24 to 26/07/24\",\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-Co9u4iimLHQCKvQp0RtbjOKRXlRhG\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"credit_card\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a card number, transaction details with dates and amounts, foreign transaction fees, and payment instructions specific to a credit card account. It also references a \\\u0027Statement of Account\\\u0027 for a business credit card.\",\\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\": \"26/06/24 to 26/07/24\",\\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=1766070504, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=227, prompt_tokens=1832, total_tokens=2059, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prom"
            },
            "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": "26/06/24 to 26/07/24",
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a credit card statement, such as a card number, transaction details with dates and amounts, foreign transaction fees, and payment instructions specific to a credit card account. It also references a \u0027Statement of Account\u0027 for a business credit card.",
            "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a card number, transaction details with dates and amounts, foreign transaction fees, and payment instructions specific to a credit card account. It also references a \u0027Statement of Account\u0027 for a business credit card.\",\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\": \"26/06/24 to 26/07/24\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "credit_card"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.2042857142857143,
          "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.0,
              "total_score": 0.025263157894736838
            },
            "nominal_ledger": {
              "keyword_score": 0.16666666666666666,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.2042857142857143
            },
            "payroll": {
              "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": 8,
      "text_length": 3498
    },
    {
      "confidence_score": 0.95,
      "document_type": "credit_card",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a membership number, transaction details, and a next statement date. It also includes a breakdown of transactions and a total spend amount, which are typical features of credit card 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-Co9u6jwU5dUvtOwZyMgmJGLaF0dyz\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"credit_card\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a membership number, transaction details, and a next statement date. It also includes a breakdown of transactions and a total spend amount, which are typical features of credit card 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=1766070506, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=210, prompt_tokens=1072, total_tokens=1282, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(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 key indicators of a credit card statement, such as a membership number, transaction details, and a next statement date. It also includes a breakdown of transactions and a total spend amount, which are typical features of credit card statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a membership number, transaction details, and a next statement date. It also includes a breakdown of transactions and a total spend amount, which are typical features of credit card 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": "credit_card"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.03529411764705882,
          "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.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
            },
            "payroll": {
              "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": 9,
      "text_length": 401
    },
    {
      "confidence_score": 0.95,
      "document_type": "credit_card",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a card type (\u0027SBS Platinum Charge Card\u0027), card number, membership rewards points, statement period (\u002720/05/24 to 19/06/24\u0027), and next statement date (\u002726/07/24\u0027). It also includes details about cardmember offers and travel insurance, which are typical of credit card 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\": \"20/05/24 to 19/06/24\",\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-Co9u8Mbo5O5kEBcDpFr65PTjBsuCs\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"credit_card\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a card type (\\\u0027SBS Platinum Charge Card\\\u0027), card number, membership rewards points, statement period (\\\u002720/05/24 to 19/06/24\\\u0027), and next statement date (\\\u002726/07/24\\\u0027). It also includes details about cardmember offers and travel insurance, which are typical of credit card 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\": \"20/05/24 to 19/06/24\",\\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=1766070508, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=251, prompt_tokens=1474, total_tokens=1725, 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": "20/05/24 to 19/06/24",
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a credit card statement, such as a card type (\u0027SBS Platinum Charge Card\u0027), card number, membership rewards points, statement period (\u002720/05/24 to 19/06/24\u0027), and next statement date (\u002726/07/24\u0027). It also includes details about cardmember offers and travel insurance, which are typical of credit card statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a credit card statement, such as a card type (\u0027SBS Platinum Charge Card\u0027), card number, membership rewards points, statement period (\u002720/05/24 to 19/06/24\u0027), and next statement date (\u002726/07/24\u0027). It also includes details about cardmember offers and travel insurance, which are typical of credit card 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\": \"20/05/24 to 19/06/24\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "credit_card"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.10588235294117647,
          "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.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.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll": {
              "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": 10,
      "text_length": 2145
    },
    {
      "confidence_score": 0.95,
      "document_type": "credit_card",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document mentions \u0027American Express Business Platinum Card\u0027, \u0027Statement of Account\u0027, and includes details such as \u0027Membership Number\u0027, \u0027Next Statement Date\u0027, and references to managing the card account online. These are clear indicators of a credit card 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-Co9uAVdfZuFiOFlACclyXW9Mx47P7\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"credit_card\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document mentions \\\u0027American Express Business Platinum Card\\\u0027, \\\u0027Statement of Account\\\u0027, and includes details such as \\\u0027Membership Number\\\u0027, \\\u0027Next Statement Date\\\u0027, and references to managing the card account online. These are clear indicators of a credit card 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=1766070510, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=210, prompt_tokens=1117, total_tokens=1327, 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 \u0027American Express Business Platinum Card\u0027, \u0027Statement of Account\u0027, and includes details such as \u0027Membership Number\u0027, \u0027Next Statement Date\u0027, and references to managing the card account online. These are clear indicators of a credit card statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document mentions \u0027American Express Business Platinum Card\u0027, \u0027Statement of Account\u0027, and includes details such as \u0027Membership Number\u0027, \u0027Next Statement Date\u0027, and references to managing the card account online. These are clear indicators of a credit card 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": "credit_card"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.03529411764705882,
          "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.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll": {
              "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": 11,
      "text_length": 682
    },
    {
      "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 explicitly mentions \u0027Hire Purchase Agreement\u0027 and includes key indicators such as \u0027amount financed\u0027, \u0027monthly payment\u0027, \u0027loan tenure\u0027, and other financial details specific to hire purchase agreements. It also includes terms like \u0027Option to Purchase Fee\u0027 and \u0027Balance financed\u0027, which are characteristic of HP 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-Co9uCNn3hNp9xaaugd9iLyrdhd7Zn\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 explicitly mentions \\\u0027Hire Purchase Agreement\\\u0027 and includes key indicators such as \\\u0027amount financed\\\u0027, \\\u0027monthly payment\\\u0027, \\\u0027loan tenure\\\u0027, and other financial details specific to hire purchase agreements. It also includes terms like \\\u0027Option to Purchase Fee\\\u0027 and \\\u0027Balance financed\\\u0027, which are characteristic of HP 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=1766070512, 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=1687, total_tokens=1921, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reaso"
            },
            "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 indicators such as \u0027amount financed\u0027, \u0027monthly payment\u0027, \u0027loan tenure\u0027, and other financial details specific to hire purchase agreements. It also includes terms like \u0027Option to Purchase Fee\u0027 and \u0027Balance financed\u0027, which are characteristic of HP agreements.",
            "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document explicitly mentions \u0027Hire Purchase Agreement\u0027 and includes key indicators such as \u0027amount financed\u0027, \u0027monthly payment\u0027, \u0027loan tenure\u0027, and other financial details specific to hire purchase agreements. It also includes terms like \u0027Option to Purchase Fee\u0027 and \u0027Balance financed\u0027, which are characteristic of HP 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
            },
            "payroll": {
              "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": 12,
      "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, \u0027Equipment\u0027, and declarations related to business purposes and financial arrangements. It also explicitly mentions the lender (Aldermore) providing finance for equipment, which is 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\": 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-Co9uFYvyb2pJD3XVUzU4zYK5Yc9C4\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, \\\u0027Equipment\\\u0027, and declarations related to business purposes and financial arrangements. It also explicitly mentions the lender (Aldermore) providing finance for equipment, which is 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\": 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=1766070515, 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=1558, total_tokens=1783, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoni"
            },
            "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, \u0027Equipment\u0027, and declarations related to business purposes and financial arrangements. It also explicitly mentions the lender (Aldermore) providing finance for equipment, which is characteristic of 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 \u0027Agreement\u0027, \u0027finance\u0027, \u0027Supplier\u0027, \u0027Equipment\u0027, and declarations related to business purposes and financial arrangements. It also explicitly mentions the lender (Aldermore) providing finance for equipment, which is 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\": 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
            },
            "payroll": {
              "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": 13,
      "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 \u0027Agreement\u0027, \u0027Equipment\u0027, \u0027Rentals\u0027, \u0027Direct Debit\u0027, and terms related to payment schedules and maintenance responsibilities. These are typical of 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\": \"date it is signed by Aldermore\",\n        \"amount_financed\": null,\n        \"monthly_payment\": \"Rentals and any other payments specified on page 1\",\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"5% per annum above Finance House Base Rate\",\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-Co9uIWYotd8cXpNvvQXZtvBLmnsDw\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, \\\u0027Equipment\\\u0027, \\\u0027Rentals\\\u0027, \\\u0027Direct Debit\\\u0027, and terms related to payment schedules and maintenance responsibilities. These are typical of 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\": \"date it is signed by Aldermore\",\\n        \"amount_financed\": null,\\n        \"monthly_payment\": \"Rentals and any other payments specified on page 1\",\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": \"5% per annum above Finance House Base Rate\",\\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=1766070518, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=241, prompt_tokens=1610, total_tokens=1851, completion_tokens_details=CompletionTokensDetails(accepted_pre"
            },
            "document_identifiers": {
              "agreement_date": "date it is signed by Aldermore",
              "amount_financed": null,
              "annual_interest_rate": "5% per annum above Finance House Base Rate",
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": "Rentals and any other payments specified on page 1",
              "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, \u0027Equipment\u0027, \u0027Rentals\u0027, \u0027Direct Debit\u0027, and terms related to payment schedules and maintenance responsibilities. These are typical of 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, \u0027Equipment\u0027, \u0027Rentals\u0027, \u0027Direct Debit\u0027, and terms related to payment schedules and maintenance responsibilities. These are typical of 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\": \"date it is signed by Aldermore\",\n        \"amount_financed\": null,\n        \"monthly_payment\": \"Rentals and any other payments specified on page 1\",\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"5% per annum above Finance House Base Rate\",\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
            },
            "payroll": {
              "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": "financial_statement"
        }
      },
      "page_number": 14,
      "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 terms related to termination and payment obligations. These are typical elements 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\": 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-Co9uLgsO0rpUSPHfnyR3LsPjYh5iE\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 terms related to termination and payment obligations. These are typical elements 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\": 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=1766070521, 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=1628, total_tokens=1843, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTok"
            },
            "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 terms related to termination and payment obligations. These are typical elements 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 \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and terms related to termination and payment obligations. These are typical elements 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\": 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
            },
            "payroll": {
              "keyword_score": 0.05,
              "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": 15,
      "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 like \u0027Agreement,\u0027 \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 and \u0027Equipment,\u0027 which are indicative of a hire purchase agreement. Additionally, it discusses terms such as \u0027termination of the hiring,\u0027 \u0027Option to Purchase Fee,\u0027 and \u0027amounts due under this Agreement,\u0027 which are specific to 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-Co9uNoaeyUXrrM6xSFGYjpYp6DgIZ\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 like \\\u0027Agreement,\\\u0027 \\\u0027Option to Purchase,\\\u0027 \\\u0027Rentals,\\\u0027 and \\\u0027Equipment,\\\u0027 which are indicative of a hire purchase agreement. Additionally, it discusses terms such as \\\u0027termination of the hiring,\\\u0027 \\\u0027Option to Purchase Fee,\\\u0027 and \\\u0027amounts due under this Agreement,\\\u0027 which are specific to 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=1766070523, 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=1583, total_tokens=1817, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, a"
            },
            "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 like \u0027Agreement,\u0027 \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 and \u0027Equipment,\u0027 which are indicative of a hire purchase agreement. Additionally, it discusses terms such as \u0027termination of the hiring,\u0027 \u0027Option to Purchase Fee,\u0027 and \u0027amounts due under this Agreement,\u0027 which are specific to hire purchase or finance agreements.",
            "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to terms like \u0027Agreement,\u0027 \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 and \u0027Equipment,\u0027 which are indicative of a hire purchase agreement. Additionally, it discusses terms such as \u0027termination of the hiring,\u0027 \u0027Option to Purchase Fee,\u0027 and \u0027amounts due under this Agreement,\u0027 which are specific to 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.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
            },
            "payroll": {
              "keyword_score": 0.05,
              "pattern_score": 0.0,
              "total_score": 0.03
            },
            "property_statement": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.02564102564102564,
              "total_score": 0.10897435897435898
            }
          },
          "type": "property_statement"
        }
      },
      "page_number": 16,
      "text_length": 10817
    },
    {
      "confidence_score": 0.7,
      "document_type": "unknown",
      "features": {
        "llm_based": {
          "confidence": 0.7,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"financial_statement\",\n    \"confidence\": 0.7,\n    \"reasoning\": \"The document discusses data protection, credit reference agencies, fraud prevention, and compliance with legal obligations, which are general financial and operational topics. However, it does not contain specific indicators of transactions, balances, or other details tied to the other categories like invoices, loan statements, or payroll. It aligns most closely with a general financial statement or policy 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-Co9uQOdaBRPyKjK01OQDycXde5DmK\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.7,\\n    \"reasoning\": \"The document discusses data protection, credit reference agencies, fraud prevention, and compliance with legal obligations, which are general financial and operational topics. However, it does not contain specific indicators of transactions, balances, or other details tied to the other categories like invoices, loan statements, or payroll. It aligns most closely with a general financial statement or policy 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=1766070526, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=232, prompt_tokens=1536, total_tokens=1768, completion_tokens_details=Completi"
            },
            "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 compliance with legal obligations, which are general financial and operational topics. However, it does not contain specific indicators of transactions, balances, or other details tied to the other categories like invoices, loan statements, or payroll. It aligns most closely with a general financial statement or policy document.",
            "raw_response": "```json\n{\n    \"document_type\": \"financial_statement\",\n    \"confidence\": 0.7,\n    \"reasoning\": \"The document discusses data protection, credit reference agencies, fraud prevention, and compliance with legal obligations, which are general financial and operational topics. However, it does not contain specific indicators of transactions, balances, or other details tied to the other categories like invoices, loan statements, or payroll. It aligns most closely with a general financial statement or policy 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
            },
            "payroll": {
              "keyword_score": 0.05,
              "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": 17,
      "text_length": 7424
    },
    {
      "confidence_score": 0.98,
      "document_type": "mortgage_statement",
      "features": {
        "llm_based": {
          "confidence": 0.98,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.98,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027remaining term\u0027, \u0027monthly payment\u0027, \u0027account balance\u0027, and \u0027interest rate\u0027. It also explicitly mentions \u0027annual mortgage statement\u0027 and provides details about the mortgage account and repayment terms.\",\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\": \"71019693\",\n        \"property_address\": \"160, Humber Avenue, Coventry, CV1 2AR\",\n        \"remaining_term_months\": 277,\n        \"monthly_payment_amount\": \"\u00a3804.94\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Co9uSV1mzRqJbW8K4k6UfuvOQ4Uph\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.98,\\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \\\u0027mortgage account number\\\u0027, \\\u0027property address\\\u0027, \\\u0027remaining term\\\u0027, \\\u0027monthly payment\\\u0027, \\\u0027account balance\\\u0027, and \\\u0027interest rate\\\u0027. It also explicitly mentions \\\u0027annual mortgage statement\\\u0027 and provides details about the mortgage account and repayment terms.\",\\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\": \"71019693\",\\n        \"property_address\": \"160, Humber Avenue, Coventry, CV1 2AR\",\\n        \"remaining_term_months\": 277,\\n        \"monthly_payment_amount\": \"\u00a3804.94\"\\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=1766070528, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=242, prompt_tokens=1480, total_tokens=1722, completion_tokens_details=CompletionTokensDetails(accepted_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": "\u00a3804.94",
              "mortgage_account_number": "71019693",
              "outstanding_balance": null,
              "property_address": "160, Humber Avenue, Coventry, CV1 2AR",
              "remaining_term_months": 277,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a mortgage statement, such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027remaining term\u0027, \u0027monthly payment\u0027, \u0027account balance\u0027, and \u0027interest rate\u0027. It also explicitly mentions \u0027annual mortgage statement\u0027 and provides details about the mortgage account and repayment terms.",
            "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.98,\n    \"reasoning\": \"The document contains key indicators of a mortgage statement, such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027remaining term\u0027, \u0027monthly payment\u0027, \u0027account balance\u0027, and \u0027interest rate\u0027. It also explicitly mentions \u0027annual mortgage statement\u0027 and provides details about the mortgage account and repayment terms.\",\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\": \"71019693\",\n        \"property_address\": \"160, Humber Avenue, Coventry, CV1 2AR\",\n        \"remaining_term_months\": 277,\n        \"monthly_payment_amount\": \"\u00a3804.94\"\n    }\n}\n```"
          },
          "type": "mortgage_statement"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.4912280701754386,
          "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.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.2894736842105263,
              "pattern_score": 0.3333333333333333,
              "total_score": 0.4912280701754386
            },
            "nominal_ledger": {
              "keyword_score": 0.08333333333333333,
              "pattern_score": 0.0,
              "total_score": 0.065
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.02564102564102564,
              "total_score": 0.02564102564102564
            }
          },
          "type": "mortgage_statement"
        }
      },
      "page_number": 18,
      "text_length": 2038
    },
    {
      "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 is titled \u0027Annual Statement\u0027 and includes key indicators such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027monthly payment amount\u0027, \u0027outstanding balance\u0027, and \u0027interest charge\u0027. These are typical elements 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\": \"\u00a3268,999.95\",\n        \"statement_period\": \"1 October 2023 - 30 September 2024\",\n        \"mortgage_account_number\": \"71019693\",\n        \"property_address\": \"160, Humber Avenue, Coventry, CV1 2AR\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3804.94\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Co9uVD2SJPVBAVPtynhKZoxEwdwNv\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 is titled \\\u0027Annual Statement\\\u0027 and includes key indicators such as \\\u0027mortgage account number\\\u0027, \\\u0027property address\\\u0027, \\\u0027monthly payment amount\\\u0027, \\\u0027outstanding balance\\\u0027, and \\\u0027interest charge\\\u0027. These are typical elements 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\": \"\u00a3268,999.95\",\\n        \"statement_period\": \"1 October 2023 - 30 September 2024\",\\n        \"mortgage_account_number\": \"71019693\",\\n        \"property_address\": \"160, Humber Avenue, Coventry, CV1 2AR\",\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a3804.94\"\\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=1766070531, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=248, prompt_tokens=1759, total_tokens=2007, 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": "\u00a3804.94",
              "mortgage_account_number": "71019693",
              "outstanding_balance": "\u00a3268,999.95",
              "property_address": "160, Humber Avenue, Coventry, CV1 2AR",
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "1 October 2023 - 30 September 2024",
              "total_amount": null
            },
            "llm_reasoning": "The document is titled \u0027Annual Statement\u0027 and includes key indicators such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027monthly payment amount\u0027, \u0027outstanding balance\u0027, and \u0027interest charge\u0027. These are typical elements of a mortgage statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"mortgage_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Annual Statement\u0027 and includes key indicators such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027monthly payment amount\u0027, \u0027outstanding balance\u0027, and \u0027interest charge\u0027. These are typical elements 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\": \"\u00a3268,999.95\",\n        \"statement_period\": \"1 October 2023 - 30 September 2024\",\n        \"mortgage_account_number\": \"71019693\",\n        \"property_address\": \"160, Humber Avenue, Coventry, CV1 2AR\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3804.94\"\n    }\n}\n```"
          },
          "type": "mortgage_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.1411764705882353,
          "features": {
            "bank_statement": {
              "keyword_score": 0.23529411764705882,
              "pattern_score": 0.0,
              "total_score": 0.1411764705882353
            },
            "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.07894736842105263,
              "pattern_score": 0.09523809523809523,
              "total_score": 0.13674185463659147
            },
            "nominal_ledger": {
              "keyword_score": 0.16666666666666666,
              "pattern_score": 0.0,
              "total_score": 0.13
            },
            "payroll": {
              "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": 19,
      "text_length": 2145
    },
    {
      "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\u0027, \u0027property may be repossessed\u0027, \u0027interest rate summary\u0027, \u0027closing balance\u0027, and \u0027instalment due\u0027. It also includes details like interest rate, outstanding balance, and payments made during the statement period, which are typical of 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.59%\",\n        \"outstanding_balance\": \"\u00a3268,984.99\",\n        \"statement_period\": \"1 October 2023 to 30 September 2024\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3804.94\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Co9uX0W0RRSlFGdff2ejzfLRZk1Ei\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\\\u0027, \\\u0027property may be repossessed\\\u0027, \\\u0027interest rate summary\\\u0027, \\\u0027closing balance\\\u0027, and \\\u0027instalment due\\\u0027. It also includes details like interest rate, outstanding balance, and payments made during the statement period, which are typical of 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.59%\",\\n        \"outstanding_balance\": \"\u00a3268,984.99\",\\n        \"statement_period\": \"1 October 2023 to 30 September 2024\",\\n        \"mortgage_account_number\": null,\\n        \"property_address\": null,\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": \"\u00a3804.94\"\\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=1766070533, 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=1129, total_tokens=1384, completion_tokens_details=CompletionTokensDetails(accepted_"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": "3.59%",
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": "\u00a3804.94",
              "mortgage_account_number": null,
              "outstanding_balance": "\u00a3268,984.99",
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "1 October 2023 to 30 September 2024",
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a mortgage statement, such as \u0027mortgage\u0027, \u0027property may be repossessed\u0027, \u0027interest rate summary\u0027, \u0027closing balance\u0027, and \u0027instalment due\u0027. It also includes details like interest rate, outstanding balance, and payments made during the statement period, which are typical of 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\u0027, \u0027property may be repossessed\u0027, \u0027interest rate summary\u0027, \u0027closing balance\u0027, and \u0027instalment due\u0027. It also includes details like interest rate, outstanding balance, and payments made during the statement period, which are typical of 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.59%\",\n        \"outstanding_balance\": \"\u00a3268,984.99\",\n        \"statement_period\": \"1 October 2023 to 30 September 2024\",\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": \"\u00a3804.94\"\n    }\n}\n```"
          },
          "type": "mortgage_statement"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.10626566416040101,
          "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.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.07894736842105263,
              "pattern_score": 0.047619047619047616,
              "total_score": 0.10626566416040101
            },
            "nominal_ledger": {
              "keyword_score": 0.08333333333333333,
              "pattern_score": 0.0,
              "total_score": 0.065
            },
            "payroll": {
              "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": 20,
      "text_length": 615
    },
    {
      "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 Account Statement\u0027 and includes key indicators such as \u0027Barclayloan for Business,\u0027 \u0027Annual Interest Rates,\u0027 \u0027Loan Account Statement,\u0027 and a detailed list of transactions with payments and interest. These are characteristic 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\": null,\n        \"loan_reference\": \"23653883476995\",\n        \"annual_interest_rate\": \"2.500%\",\n        \"outstanding_balance\": \"14966.52\",\n        \"statement_period\": \"10 August 2024 to 11 August 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-Co9uatLFwW8yPe8b1VHBl4Ep2Viqw\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 Account Statement\\\u0027 and includes key indicators such as \\\u0027Barclayloan for Business,\\\u0027 \\\u0027Annual Interest Rates,\\\u0027 \\\u0027Loan Account Statement,\\\u0027 and a detailed list of transactions with payments and interest. These are characteristic 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\": null,\\n        \"loan_reference\": \"23653883476995\",\\n        \"annual_interest_rate\": \"2.500%\",\\n        \"outstanding_balance\": \"14966.52\",\\n        \"statement_period\": \"10 August 2024 to 11 August 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=1766070536, 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=1435, total_tokens=1672, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_p"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": "2.500%",
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": "23653883476995",
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": "14966.52",
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "10 August 2024 to 11 August 2025",
              "total_amount": null
            },
            "llm_reasoning": "The document is titled \u0027Loan Account Statement\u0027 and includes key indicators such as \u0027Barclayloan for Business,\u0027 \u0027Annual Interest Rates,\u0027 \u0027Loan Account Statement,\u0027 and a detailed list of transactions with payments and interest. These are characteristic of loan statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan Account Statement\u0027 and includes key indicators such as \u0027Barclayloan for Business,\u0027 \u0027Annual Interest Rates,\u0027 \u0027Loan Account Statement,\u0027 and a detailed list of transactions with payments and interest. These are characteristic 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\": null,\n        \"loan_reference\": \"23653883476995\",\n        \"annual_interest_rate\": \"2.500%\",\n        \"outstanding_balance\": \"14966.52\",\n        \"statement_period\": \"10 August 2024 to 11 August 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.9272727272727272,
          "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.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.3333333333333333,
              "pattern_score": 0.2727272727272727,
              "strong_indicators": true,
              "total_score": 0.9272727272727272
            },
            "mortgage_statement": {
              "keyword_score": 0.05263157894736842,
              "pattern_score": 0.0,
              "total_score": 0.050526315789473676
            },
            "nominal_ledger": {
              "keyword_score": 0.16666666666666666,
              "pattern_score": 0.0,
              "total_score": 0.13
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "property_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.02564102564102564,
              "total_score": 0.02564102564102564
            }
          },
          "type": "loan_statement"
        }
      },
      "page_number": 21,
      "text_length": 1272
    },
    {
      "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 references to \u0027Direct Debit Payment,\u0027 \u0027Interest,\u0027 \u0027Closing Balance,\u0027 and a running balance in debit (DR). Additionally, it mentions obtaining a settlement figure and calculating interest daily, which are typical features 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\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"10833.49\",\n        \"statement_period\": \"17 Feb 2025 - 11 Aug 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-Co9ud0k7BdtCaI23r174rEd2jHBhA\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 references to \\\u0027Direct Debit Payment,\\\u0027 \\\u0027Interest,\\\u0027 \\\u0027Closing Balance,\\\u0027 and a running balance in debit (DR). Additionally, it mentions obtaining a settlement figure and calculating interest daily, which are typical features 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\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"10833.49\",\\n        \"statement_period\": \"17 Feb 2025 - 11 Aug 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=1766070539, 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=1409, total_tokens=1643, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_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": "10833.49",
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "17 Feb 2025 - 11 Aug 2025",
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a loan statement, such as references to \u0027Direct Debit Payment,\u0027 \u0027Interest,\u0027 \u0027Closing Balance,\u0027 and a running balance in debit (DR). Additionally, it mentions obtaining a settlement figure and calculating interest daily, which are typical features 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 references to \u0027Direct Debit Payment,\u0027 \u0027Interest,\u0027 \u0027Closing Balance,\u0027 and a running balance in debit (DR). Additionally, it mentions obtaining a settlement figure and calculating interest daily, which are typical features 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\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"10833.49\",\n        \"statement_period\": \"17 Feb 2025 - 11 Aug 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": "llm_preferred",
        "pattern_based": {
          "confidence": 0.13,
          "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.05555555555555555,
              "pattern_score": 0.0,
              "total_score": 0.03333333333333333
            },
            "loan_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "strong_indicators": true,
              "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
            },
            "payroll": {
              "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": 22,
      "text_length": 1598
    },
    {
      "confidence_score": 0.95,
      "document_type": "property_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion Date,\u0027 \u0027Sale price of the property,\u0027 and a detailed breakdown of payments and disbursements related to the sale of a property. Additionally, the property address is explicitly mentioned, which is a strong indicator of a property 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\": \"36 Noreen Avenue, Prestwich, Manchester, Greater Manchester, M25 ILT\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null,\n        \"completion_date\": \"15th July 2022\",\n        \"purchase_sale_price\": \"\u00a3192,600.00\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Co9uf8gsZbYPbfmhfdTpDdNsH056F\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"property_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Completion Statement\\\u0027 and includes key indicators such as \\\u0027Completion Date,\\\u0027 \\\u0027Sale price of the property,\\\u0027 and a detailed breakdown of payments and disbursements related to the sale of a property. Additionally, the property address is explicitly mentioned, which is a strong indicator of a property 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\": \"36 Noreen Avenue, Prestwich, Manchester, Greater Manchester, M25 ILT\",\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null,\\n        \"completion_date\": \"15th July 2022\",\\n        \"purchase_sale_price\": \"\u00a3192,600.00\"\\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=1766070541, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_token"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "completion_date": "15th July 2022",
              "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": "36 Noreen Avenue, Prestwich, Manchester, Greater Manchester, M25 ILT",
              "purchase_sale_price": "\u00a3192,600.00",
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion Date,\u0027 \u0027Sale price of the property,\u0027 and a detailed breakdown of payments and disbursements related to the sale of a property. Additionally, the property address is explicitly mentioned, which is a strong indicator of a property statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion Date,\u0027 \u0027Sale price of the property,\u0027 and a detailed breakdown of payments and disbursements related to the sale of a property. Additionally, the property address is explicitly mentioned, which is a strong indicator of a property 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\": \"36 Noreen Avenue, Prestwich, Manchester, Greater Manchester, M25 ILT\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null,\n        \"completion_date\": \"15th July 2022\",\n        \"purchase_sale_price\": \"\u00a3192,600.00\"\n    }\n}\n```"
          },
          "type": "property_statement"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.2532051282051282,
          "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.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.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "property_statement": {
              "keyword_score": 0.08333333333333333,
              "pattern_score": 0.1282051282051282,
              "total_score": 0.2532051282051282
            }
          },
          "type": "property_statement"
        }
      },
      "page_number": 23,
      "text_length": 853
    },
    {
      "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, \u0027Mortgage Account Number\u0027, and \u0027Property Address\u0027, which are key indicators of a mortgage statement. Additionally, it includes references to mortgage payments, a mortgage account number, and a property address, which are specific to this category.\",\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\": \"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-Co9uhJ8NRJ5y8ffo9bBTWI7rLGOUf\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, \\\u0027Mortgage Account Number\\\u0027, and \\\u0027Property Address\\\u0027, which are key indicators of a mortgage statement. Additionally, it includes references to mortgage payments, a mortgage account number, and a property address, which are specific to this category.\",\\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\": \"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=1766070543, 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=1312, total_tokens=1559, completion_tokens_details=CompletionTokensDetails(accepted_predict"
            },
            "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": null,
              "total_amount": null
            },
            "llm_reasoning": "The document explicitly mentions \u0027Your Buy To Let Mortgage Statement\u0027, \u0027Mortgage Account Number\u0027, and \u0027Property Address\u0027, which are key indicators of a mortgage statement. Additionally, it includes references to mortgage payments, a mortgage account number, and a property address, which are specific to this category.",
            "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, \u0027Mortgage Account Number\u0027, and \u0027Property Address\u0027, which are key indicators of a mortgage statement. Additionally, it includes references to mortgage payments, a mortgage account number, and a property address, which are specific to this category.\",\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\": \"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
            },
            "payroll": {
              "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": 24,
      "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 \u0027Remaining mortgage term,\u0027 \u0027Interest Rate Details,\u0027 and references to \u0027repayment type\u0027 and \u0027interest only mortgage.\u0027 These are specific to mortgage-related 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\": \"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-Co9ujaXe38xeqCXGonO665FUoX3B5\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 \\\u0027Remaining mortgage term,\\\u0027 \\\u0027Interest Rate Details,\\\u0027 and references to \\\u0027repayment type\\\u0027 and \\\u0027interest only mortgage.\\\u0027 These are specific to mortgage-related 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\": \"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=1766070545, 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=1107, total_tokens=1333, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_token"
            },
            "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 \u0027Remaining mortgage term,\u0027 \u0027Interest Rate Details,\u0027 and references to \u0027repayment type\u0027 and \u0027interest only mortgage.\u0027 These are specific to mortgage-related documents.",
            "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 \u0027Remaining mortgage term,\u0027 \u0027Interest Rate Details,\u0027 and references to \u0027repayment type\u0027 and \u0027interest only mortgage.\u0027 These are specific to mortgage-related 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\": \"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
            },
            "payroll": {
              "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": 25,
      "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-Co9ulLEjESHM3iRCSYiMW1TNOmARw\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=1766070547, 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=1441, total_tokens=1696, 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
            },
            "payroll": {
              "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": 26,
      "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 a running balance. It also includes monthly payment amounts and references to a mortgage account.\",\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\": null,\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-Co9uo2x89rw3J8i6x2I3isxvO6Gxq\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 running balance. It also includes monthly payment amounts and references to a mortgage account.\",\\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\": null,\\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=1766070550, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=223, prompt_tokens=1424, total_tokens=1647, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokens"
            },
            "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": null,
              "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 running balance. It also includes monthly payment amounts and references to a mortgage account.",
            "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 running balance. It also includes monthly payment amounts and references to a mortgage account.\",\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\": null,\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
            },
            "payroll": {
              "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": 27,
      "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 \u0027Closing balance\u0027. Additionally, it includes a mortgage account number and references to interest and payments, 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\": 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-Co9uqkhbu2X7iPomA2K4JmZyMRqX0\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 \\\u0027Closing balance\\\u0027. Additionally, it includes a mortgage account number and references to interest and payments, 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\": 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=1766070552, 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=1118, total_tokens=1362, 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": "\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 \u0027Closing balance\u0027. Additionally, it includes a mortgage account number and references to interest and payments, 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 \u0027Mortgage Account Number\u0027, \u0027Interest Charged\u0027, \u0027Payment received by DD\u0027, and \u0027Closing balance\u0027. Additionally, it includes a mortgage account number and references to interest and payments, 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\": 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
            },
            "payroll": {
              "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": 28,
      "text_length": 531
    },
    {
      "confidence_score": 0.95,
      "document_type": "property_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion Date\u0027, \u0027Purchase price\u0027, and \u0027Matter: Purchase of [property address]\u0027. These are specific to property transactions and align with the \u0027property_statement\u0027 category.\",\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\": \"16 Hoylake Close CV11 6NJ\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null,\n        \"completion_date\": \"Tbc\",\n        \"purchase_price\": \"\u00a3241,000.00\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Co9usDcGw4UKiDnv70alGbPw4IYdM\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"property_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Completion Statement\\\u0027 and includes key indicators such as \\\u0027Completion Date\\\u0027, \\\u0027Purchase price\\\u0027, and \\\u0027Matter: Purchase of [property address]\\\u0027. These are specific to property transactions and align with the \\\u0027property_statement\\\u0027 category.\",\\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\": \"16 Hoylake Close CV11 6NJ\",\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null,\\n        \"completion_date\": \"Tbc\",\\n        \"purchase_price\": \"\u00a3241,000.00\"\\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=1766070554, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=242, prompt_tokens=1421, total_tokens=1663, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "completion_date": "Tbc",
              "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": "16 Hoylake Close CV11 6NJ",
              "purchase_price": "\u00a3241,000.00",
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion Date\u0027, \u0027Purchase price\u0027, and \u0027Matter: Purchase of [property address]\u0027. These are specific to property transactions and align with the \u0027property_statement\u0027 category.",
            "raw_response": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion Date\u0027, \u0027Purchase price\u0027, and \u0027Matter: Purchase of [property address]\u0027. These are specific to property transactions and align with the \u0027property_statement\u0027 category.\",\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\": \"16 Hoylake Close CV11 6NJ\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null,\n        \"completion_date\": \"Tbc\",\n        \"purchase_price\": \"\u00a3241,000.00\"\n    }\n}\n```"
          },
          "type": "property_statement"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.22756410256410256,
          "features": {
            "bank_statement": {
              "keyword_score": 0.11764705882352941,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.12773109243697478
            },
            "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.16666666666666666,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.2042857142857143
            },
            "payroll": {
              "keyword_score": 0.05,
              "pattern_score": 0.0,
              "total_score": 0.03
            },
            "property_statement": {
              "keyword_score": 0.08333333333333333,
              "pattern_score": 0.10256410256410256,
              "total_score": 0.22756410256410256
            }
          },
          "type": "property_statement"
        }
      },
      "page_number": 29,
      "text_length": 1544
    },
    {
      "confidence_score": 0.95,
      "document_type": "property_statement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion date\u0027, \u0027Purchase price\u0027, and a property address (\u002712 Boswell Drive, Coventry, CV2 2DH\u0027). These are characteristic of property completion or conveyancing 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\": \"12 Boswell Drive, Coventry, CV2 2DH\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null,\n        \"completion_date\": \"1st May 2024\",\n        \"purchase_price\": \"\u00a3158,000.00\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Co9uuvZG1GKzCluAcCxGfBEopl3SW\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"property_statement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document is titled \\\u0027Completion Statement\\\u0027 and includes key indicators such as \\\u0027Completion date\\\u0027, \\\u0027Purchase price\\\u0027, and a property address (\\\u002712 Boswell Drive, Coventry, CV2 2DH\\\u0027). These are characteristic of property completion or conveyancing 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\": \"12 Boswell Drive, Coventry, CV2 2DH\",\\n        \"remaining_term_months\": null,\\n        \"monthly_payment_amount\": null,\\n        \"completion_date\": \"1st May 2024\",\\n        \"purchase_price\": \"\u00a3158,000.00\"\\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=1766070556, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=252, prompt_tokens=1442, total_tokens=1694, completion_tokens_details=CompletionTokensDetails(accepted_predicti"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "completion_date": "1st May 2024",
              "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": "12 Boswell Drive, Coventry, CV2 2DH",
              "purchase_price": "\u00a3158,000.00",
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion date\u0027, \u0027Purchase price\u0027, and a property address (\u002712 Boswell Drive, Coventry, CV2 2DH\u0027). These are characteristic of property completion or conveyancing statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Completion Statement\u0027 and includes key indicators such as \u0027Completion date\u0027, \u0027Purchase price\u0027, and a property address (\u002712 Boswell Drive, Coventry, CV2 2DH\u0027). These are characteristic of property completion or conveyancing 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\": \"12 Boswell Drive, Coventry, CV2 2DH\",\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null,\n        \"completion_date\": \"1st May 2024\",\n        \"purchase_price\": \"\u00a3158,000.00\"\n    }\n}\n```"
          },
          "type": "property_statement"
        },
        "method_used": "both_agree",
        "pattern_based": {
          "confidence": 0.3205128205128205,
          "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.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
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "property_statement": {
              "keyword_score": 0.1111111111111111,
              "pattern_score": 0.15384615384615385,
              "total_score": 0.3205128205128205
            }
          },
          "type": "property_statement"
        }
      },
      "page_number": 30,
      "text_length": 1520
    },
    {
      "confidence_score": 0.85,
      "document_type": "property_statement",
      "features": {
        "llm_based": {
          "confidence": 0.85,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.85,\n    \"reasoning\": \"The document contains references to a solicitor\u0027s firm, payment instructions, and a file reference number, which are common in property completion or conveyancing statements. However, it lacks explicit details like a completion date or property address, which slightly reduces confidence.\",\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-Co9uy8rAc4Hmcjd5vepIN7DDzPuwe\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"property_statement\",\\n    \"confidence\": 0.85,\\n    \"reasoning\": \"The document contains references to a solicitor\\\u0027s firm, payment instructions, and a file reference number, which are common in property completion or conveyancing statements. However, it lacks explicit details like a completion date or property address, which slightly reduces confidence.\",\\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=1766070560, 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=1118, total_tokens=1330, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_de"
            },
            "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 a solicitor\u0027s firm, payment instructions, and a file reference number, which are common in property completion or conveyancing statements. However, it lacks explicit details like a completion date or property address, which slightly reduces confidence.",
            "raw_response": "```json\n{\n    \"document_type\": \"property_statement\",\n    \"confidence\": 0.85,\n    \"reasoning\": \"The document contains references to a solicitor\u0027s firm, payment instructions, and a file reference number, which are common in property completion or conveyancing statements. However, it lacks explicit details like a completion date or property address, which slightly reduces confidence.\",\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": "property_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.2042857142857143,
          "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.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "nominal_ledger": {
              "keyword_score": 0.16666666666666666,
              "pattern_score": 0.14285714285714285,
              "total_score": 0.2042857142857143
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "property_statement": {
              "keyword_score": 0.05555555555555555,
              "pattern_score": 0.05128205128205128,
              "total_score": 0.13461538461538464
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 31,
      "text_length": 691
    }
  ],
  "processing_timestamp": "2025-12-18T15:09:22.696066"
}