Merged PDF Processing Results

Back to Dashboard
PDF Information
Original Filename: testing_sample_merged_1.pdf
Upload Date: November 27, 2025 at 07:18 AM
Total Pages: 16
Processing Status: Completed
Extraction Summary
Total Documents: 5
Credit Cards: 1
Hp Agreements: 1
Loan Statements: 2
Mortgage Statements: 1
Page Classification Results
Page 1

Credit Card

95%
Page 2

Credit Card

95%
Page 3

Credit Card

95%
Page 4

Credit Card

95%
Page 5

Credit Card

95%
Page 6

Hp Agreement

95%
Page 7

Hp Agreement

95%
Page 8

Hp Agreement

95%
Page 9

Hp Agreement

95%
Page 10

Hp Agreement

95%
Page 11

Loan Statement

85%
Page 12

Mortgage Statement

98%
Page 13

Mortgage Statement

95%
Page 14

Mortgage Statement

95%
Page 15

Loan Statement

95%
Page 16

Loan Statement

95%
Extracted Documents 5
Document Type Pages Confidence Processing Status Created Actions
Credit Card 1-5 (5 pages) 95% Processed 2025-11-27 07:18 View
Hp Agreement 6-10 (5 pages) 95% Processed 2025-11-27 07:18 View
Loan Statement 11 (1 page) 85% Processed 2025-11-27 07:18 View
Mortgage Statement 12-14 (3 pages) 96% Processed 2025-11-27 07:18 View
Loan Statement 15-16 (2 pages) 95% Processed 2025-11-27 07:19 View
{
  "document_groups": [
    {
      "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": "1081.76",
        "property_address": null,
        "remaining_term_months": null,
        "seller_name": null,
        "statement_period": "27 May to 26 June 2024",
        "total_amount": null
      },
      "document_type": "credit_card",
      "end_page": 5,
      "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 payment due date, a statement period, and transaction details including a payment received. Additionally, the document references an \u0027American Express Business Platinum Card\u0027 and includes a closing balance and payment due amount, 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\": \"1081.76\",\n        \"statement_period\": \"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-CgQYFr6jSt3P3XJIiQLV7Zs5eBtTM\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 payment due date, a statement period, and transaction details including a payment received. Additionally, the document references an \\\u0027American Express Business Platinum Card\\\u0027 and includes a closing balance and payment due amount, 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\": \"1081.76\",\\n        \"statement_period\": \"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=1764227875, 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=1370, total_tokens=1614, completion_tokens_details=CompletionTokensDet"
                },
                "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": "1081.76",
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": "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 payment due date, a statement period, and transaction details including a payment received. Additionally, the document references an \u0027American Express Business Platinum Card\u0027 and includes a closing balance and payment due amount, 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 membership number, a spending limit, a payment due date, a statement period, and transaction details including a payment received. Additionally, the document references an \u0027American Express Business Platinum Card\u0027 and includes a closing balance and payment due amount, 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\": \"1081.76\",\n        \"statement_period\": \"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.125,
                  "pattern_score": 0.0,
                  "total_score": 0.0975
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "bank_statement"
            }
          },
          "page_number": 1,
          "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 details of a credit card statement, including a cardholder\u0027s name, card number, transaction details, transaction dates, merchant names, and amounts. It also includes payment instructions specific to a credit card account, such as direct debit and internet banking details. These are key 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-CgQYHHSHroY4MN1l2VMFxRQdL97qH\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 details of a credit card statement, including a cardholder\\\u0027s name, card number, transaction details, transaction dates, merchant names, and amounts. It also includes payment instructions specific to a credit card account, such as direct debit and internet banking details. These are key 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=1764227877, 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=1783, total_tokens=2008, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_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 details of a credit card statement, including a cardholder\u0027s name, card number, transaction details, transaction dates, merchant names, and amounts. It also includes payment instructions specific to a credit card account, such as direct debit and internet banking details. These are key indicators of a credit card statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains details of a credit card statement, including a cardholder\u0027s name, card number, transaction details, transaction dates, merchant names, and amounts. It also includes payment instructions specific to a credit card account, such as direct debit and internet banking details. These are key 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.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.0,
                  "total_score": 0.025263157894736838
                },
                "nominal_ledger": {
                  "keyword_score": 0.125,
                  "pattern_score": 0.0,
                  "total_score": 0.0975
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "bank_statement"
            }
          },
          "page_number": 2,
          "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 references to a credit card statement, including a membership number, a next statement date, transaction details, and a total spend amount. These are key 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-CgQYIKCCVrX7NxRKS4JPba8moytyI\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 references to a credit card statement, including a membership number, a next statement date, transaction details, and a total spend amount. These are key 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=1764227878, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=201, prompt_tokens=1023, total_tokens=1224, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(audio_tokens=0, cached_tokens=0)), prompt_filter_results="
                },
                "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 credit card statement, including a membership number, a next statement date, transaction details, and a total spend amount. These are key indicators of a credit card statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to a credit card statement, including a membership number, a next statement date, transaction details, and a total spend amount. These are key 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.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
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "bank_statement"
            }
          },
          "page_number": 3,
          "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 references to a credit card statement, including a card type (SBS Platinum Charge Card), card number (masked), membership number, statement period, and points earned. It also includes details about the next statement date and cardmember offers, which are typical of credit card statements. There is no mention of transactions, balances, or other indicators of a bank statement, invoice, or other document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"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-CgQYK5Wv6nD2iaoGQsrS8yieNgTi5\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 references to a credit card statement, including a card type (SBS Platinum Charge Card), card number (masked), membership number, statement period, and points earned. It also includes details about the next statement date and cardmember offers, which are typical of credit card statements. There is no mention of transactions, balances, or other indicators of a bank statement, invoice, or other document types.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": \"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=1764227880, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=256, prompt_tokens=1425, total_tokens=1681, completio"
                },
                "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 references to a credit card statement, including a card type (SBS Platinum Charge Card), card number (masked), membership number, statement period, and points earned. It also includes details about the next statement date and cardmember offers, which are typical of credit card statements. There is no mention of transactions, balances, or other indicators of a bank statement, invoice, or other document types.",
                "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to a credit card statement, including a card type (SBS Platinum Charge Card), card number (masked), membership number, statement period, and points earned. It also includes details about the next statement date and cardmember offers, which are typical of credit card statements. There is no mention of transactions, balances, or other indicators of a bank statement, invoice, or other document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"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
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "bank_statement"
            }
          },
          "page_number": 4,
          "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 contains references to a credit card account, including terms like \u0027American Express Business Platinum Card,\u0027 \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 and \u0027Next Statement Date.\u0027 These are key indicators of a credit card statement. There is no mention of transactions, balances, or other details that would classify it as a bank statement or other document type.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\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-CgQYMAGWFh3efnwHmHvhA0jjpEgNE\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 references to a credit card account, including terms like \\\u0027American Express Business Platinum Card,\\\u0027 \\\u0027Statement of Account,\\\u0027 \\\u0027Membership Number,\\\u0027 and \\\u0027Next Statement Date.\\\u0027 These are key indicators of a credit card statement. There is no mention of transactions, balances, or other details that would classify it as a bank statement or other document type.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\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=1764227882, 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=1068, total_tokens=1300, completion_tokens_details=CompletionTokensDetails(accepted_prediction_toke"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains references to a credit card account, including terms like \u0027American Express Business Platinum Card,\u0027 \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 and \u0027Next Statement Date.\u0027 These are key indicators of a credit card statement. There is no mention of transactions, balances, or other details that would classify it as a bank statement or other document type.",
                "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to a credit card account, including terms like \u0027American Express Business Platinum Card,\u0027 \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 and \u0027Next Statement Date.\u0027 These are key indicators of a credit card statement. There is no mention of transactions, balances, or other details that would classify it as a bank statement or other document type.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\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
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "bank_statement"
            }
          },
          "page_number": 5,
          "text_length": 682
        }
      ],
      "start_page": 1
    },
    {
      "avg_confidence": 0.95,
      "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
      },
      "document_type": "hp_agreement",
      "end_page": 10,
      "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 \u0027Agreement Number\u0027, \u0027Balance financed\u0027, \u0027Monthly payment\u0027, \u0027Hire Period\u0027, and \u0027Option to Purchase Fee\u0027. These are specific to hire purchase agreements and not found in other document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": \"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-CgQYNiCcorEHf0FYwtfg4K0fXQdmI\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 \\\u0027Agreement Number\\\u0027, \\\u0027Balance financed\\\u0027, \\\u0027Monthly payment\\\u0027, \\\u0027Hire Period\\\u0027, and \\\u0027Option to Purchase Fee\\\u0027. These are specific to hire purchase agreements and not found in other document types.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": \"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=1764227883, 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=1638, total_tokens=1865, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), pro"
                },
                "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 \u0027Agreement Number\u0027, \u0027Balance financed\u0027, \u0027Monthly payment\u0027, \u0027Hire Period\u0027, and \u0027Option to Purchase Fee\u0027. These are specific to hire purchase agreements and not found in other document types.",
                "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 \u0027Agreement Number\u0027, \u0027Balance financed\u0027, \u0027Monthly payment\u0027, \u0027Hire Period\u0027, and \u0027Option to Purchase Fee\u0027. These are specific to hire purchase agreements and not found in other document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": \"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": "both_agree",
            "pattern_based": {
              "confidence": 0.18653846153846151,
              "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.125,
                  "pattern_score": 0.0,
                  "total_score": 0.0975
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "hp_agreement"
            }
          },
          "page_number": 6,
          "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 multiple references to an \u0027Agreement,\u0027 mentions of \u0027finance,\u0027 \u0027Supplier,\u0027 and \u0027Equipment,\u0027 and includes terms like \u0027settlement amount,\u0027 \u0027finance,\u0027 and \u0027declaration for exemption relating to businesses.\u0027 These are key indicators of a hire purchase or finance agreement. Additionally, the document explicitly states that Aldermore is providing finance for equipment, which aligns with the characteristics of a hire purchase 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-CgQYPTJ56DdHqlvnWAGTIW7T26MvI\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 an \\\u0027Agreement,\\\u0027 mentions of \\\u0027finance,\\\u0027 \\\u0027Supplier,\\\u0027 and \\\u0027Equipment,\\\u0027 and includes terms like \\\u0027settlement amount,\\\u0027 \\\u0027finance,\\\u0027 and \\\u0027declaration for exemption relating to businesses.\\\u0027 These are key indicators of a hire purchase or finance agreement. Additionally, the document explicitly states that Aldermore is providing finance for equipment, which aligns with the characteristics of a hire purchase 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=1764227885, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=246, prompt_tokens=1509, total_toke"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains multiple references to an \u0027Agreement,\u0027 mentions of \u0027finance,\u0027 \u0027Supplier,\u0027 and \u0027Equipment,\u0027 and includes terms like \u0027settlement amount,\u0027 \u0027finance,\u0027 and \u0027declaration for exemption relating to businesses.\u0027 These are key indicators of a hire purchase or finance agreement. Additionally, the document explicitly states that Aldermore is providing finance for equipment, which aligns with the characteristics of a hire purchase agreement.",
                "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to an \u0027Agreement,\u0027 mentions of \u0027finance,\u0027 \u0027Supplier,\u0027 and \u0027Equipment,\u0027 and includes terms like \u0027settlement amount,\u0027 \u0027finance,\u0027 and \u0027declaration for exemption relating to businesses.\u0027 These are key indicators of a hire purchase or finance agreement. Additionally, the document explicitly states that Aldermore is providing finance for equipment, which aligns with the characteristics of a hire purchase 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.0975,
              "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.125,
                  "pattern_score": 0.0,
                  "total_score": 0.0975
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 7,
          "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, \u0027Hire\u0027, \u0027Equipment\u0027, \u0027Payment of Rentals\u0027, \u0027Direct Debit\u0027, \u0027Amount Financed\u0027, and \u0027Monthly Payment\u0027. These terms 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-CgQYRBBotkA0oE8qyEo3NvoQKLOh0\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, \\\u0027Hire\\\u0027, \\\u0027Equipment\\\u0027, \\\u0027Payment of Rentals\\\u0027, \\\u0027Direct Debit\\\u0027, \\\u0027Amount Financed\\\u0027, and \\\u0027Monthly Payment\\\u0027. These terms 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=1764227887, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=218, prompt_tokens=1561, total_tokens=1779, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTo"
                },
                "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, \u0027Hire\u0027, \u0027Equipment\u0027, \u0027Payment of Rentals\u0027, \u0027Direct Debit\u0027, \u0027Amount Financed\u0027, and \u0027Monthly Payment\u0027. These terms 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 key indicators of a hire purchase agreement, such as references to \u0027Agreement\u0027, \u0027Hire\u0027, \u0027Equipment\u0027, \u0027Payment of Rentals\u0027, \u0027Direct Debit\u0027, \u0027Amount Financed\u0027, and \u0027Monthly Payment\u0027. These terms 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.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.125,
                  "pattern_score": 0.0,
                  "total_score": 0.0975
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "financial_statement"
            }
          },
          "page_number": 8,
          "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 multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Equipment\u0027, \u0027Rentals\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, and \u0027Termination\u0027. Additionally, it mentions financial obligations like payments, insurance, and termination clauses, which are typical 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-CgQYSaxOzm1AZv1xGRex1brnCZunK\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \\\u0027Equipment\\\u0027, \\\u0027Rentals\\\u0027, \\\u0027Insurance monies\\\u0027, \\\u0027Total Loss\\\u0027, and \\\u0027Termination\\\u0027. Additionally, it mentions financial obligations like payments, insurance, and termination clauses, which are typical 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=1764227888, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=224, prompt_tokens=1579, total_tokens=1803, 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": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Equipment\u0027, \u0027Rentals\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, and \u0027Termination\u0027. Additionally, it mentions financial obligations like payments, insurance, and termination clauses, which are typical of hire purchase agreements.",
                "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Equipment\u0027, \u0027Rentals\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, and \u0027Termination\u0027. Additionally, it mentions financial obligations like payments, insurance, and termination clauses, which are typical 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.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.125,
                  "pattern_score": 0.0,
                  "total_score": 0.0975
                },
                "payroll": {
                  "keyword_score": 0.05,
                  "pattern_score": 0.0,
                  "total_score": 0.03
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "invoice"
            }
          },
          "page_number": 9,
          "text_length": 11405
        },
        {
          "confidence_score": 0.95,
          "document_type": "hp_agreement",
          "features": {
            "llm_based": {
              "confidence": 0.95,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027termination of this Agreement.\u0027 Additionally, it mentions financing terms like \u0027amounts payable,\u0027 \u0027costs incurred,\u0027 and \u0027commission to Introducer,\u0027 which are indicative 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-CgQYUaTGuOEuttCTK4RRSvJ5N3OjR\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \\\u0027Option to Purchase,\\\u0027 \\\u0027Rentals,\\\u0027 \\\u0027Option to Purchase Fee,\\\u0027 \\\u0027hiring of the Equipment,\\\u0027 and \\\u0027termination of this Agreement.\\\u0027 Additionally, it mentions financing terms like \\\u0027amounts payable,\\\u0027 \\\u0027costs incurred,\\\u0027 and \\\u0027commission to Introducer,\\\u0027 which are indicative 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=1764227890, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=245, prompt_tokens=1534, total_tokens=1779, completion_tokens_details=Compl"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027termination of this Agreement.\u0027 Additionally, it mentions financing terms like \u0027amounts payable,\u0027 \u0027costs incurred,\u0027 and \u0027commission to Introducer,\u0027 which are indicative 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 multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027termination of this Agreement.\u0027 Additionally, it mentions financing terms like \u0027amounts payable,\u0027 \u0027costs incurred,\u0027 and \u0027commission to Introducer,\u0027 which are indicative 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.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.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.125,
                  "pattern_score": 0.0,
                  "total_score": 0.0975
                },
                "payroll": {
                  "keyword_score": 0.05,
                  "pattern_score": 0.0,
                  "total_score": 0.03
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "bank_statement"
            }
          },
          "page_number": 10,
          "text_length": 10817
        }
      ],
      "start_page": 6
    },
    {
      "avg_confidence": 0.85,
      "document_identifiers": {
        "agreement_date": null,
        "amount_financed": null,
        "annual_interest_rate": null,
        "invoice_date": null,
        "invoice_number": null,
        "loan_reference": null,
        "loan_tenure": null,
        "monthly_payment": null,
        "monthly_payment_amount": null,
        "mortgage_account_number": null,
        "outstanding_balance": null,
        "property_address": null,
        "remaining_term_months": null,
        "seller_name": null,
        "statement_period": null,
        "total_amount": null
      },
      "document_type": "loan_statement",
      "end_page": 11,
      "pages": [
        {
          "confidence_score": 0.85,
          "document_type": "loan_statement",
          "features": {
            "llm_based": {
              "confidence": 0.85,
              "features": {
                "api_response_debug": {
                  "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.85,\n    \"reasoning\": \"The document contains references to loan-related terms such as \u0027creditworthiness,\u0027 \u0027manage your account,\u0027 \u0027trace and recover debts,\u0027 and \u0027loan application.\u0027 Additionally, it mentions the use of credit reference agencies (CRAs) and financial history, which are common in loan statements. However, the document lacks specific transactional details, which slightly lowers the confidence level.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\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-CgQYWwN5VAk8iDTlSmvjm92GXkqXK\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.85,\\n    \"reasoning\": \"The document contains references to loan-related terms such as \\\u0027creditworthiness,\\\u0027 \\\u0027manage your account,\\\u0027 \\\u0027trace and recover debts,\\\u0027 and \\\u0027loan application.\\\u0027 Additionally, it mentions the use of credit reference agencies (CRAs) and financial history, which are common in loan statements. However, the document lacks specific transactional details, which slightly lowers the confidence level.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\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=1764227892, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=233, prompt_tokens=1487, total_tokens=1720, completion_tokens_details=CompletionTokensDetails(accepted_"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": null,
                  "mortgage_account_number": null,
                  "outstanding_balance": null,
                  "property_address": null,
                  "remaining_term_months": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains references to loan-related terms such as \u0027creditworthiness,\u0027 \u0027manage your account,\u0027 \u0027trace and recover debts,\u0027 and \u0027loan application.\u0027 Additionally, it mentions the use of credit reference agencies (CRAs) and financial history, which are common in loan statements. However, the document lacks specific transactional details, which slightly lowers the confidence level.",
                "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.85,\n    \"reasoning\": \"The document contains references to loan-related terms such as \u0027creditworthiness,\u0027 \u0027manage your account,\u0027 \u0027trace and recover debts,\u0027 and \u0027loan application.\u0027 Additionally, it mentions the use of credit reference agencies (CRAs) and financial history, which are common in loan statements. However, the document lacks specific transactional details, which slightly lowers the confidence level.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
              },
              "type": "loan_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.07058823529411765,
              "features": {
                "bank_statement": {
                  "keyword_score": 0.11764705882352941,
                  "pattern_score": 0.0,
                  "total_score": 0.07058823529411765
                },
                "corporation_tax": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "credit_card": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "financial_statement": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "hp_agreement": {
                  "keyword_score": 0.038461538461538464,
                  "pattern_score": 0.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
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "bank_statement"
            }
          },
          "page_number": 11,
          "text_length": 7424
        }
      ],
      "start_page": 11
    },
    {
      "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": "268,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": 14,
      "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 \u0027current interest rate\u0027. Additionally, it 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-CgQYXKRA61Juc6OkyRbE4o8mfc0wu\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 \\\u0027current interest rate\\\u0027. Additionally, it 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=1764227893, 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=1431, total_tokens=1675, completion_tokens_details=CompletionTokensDetails(accepted_"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": "\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 \u0027current interest rate\u0027. Additionally, it 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 \u0027current interest rate\u0027. Additionally, it 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.125,
                  "pattern_score": 0.0,
                  "total_score": 0.0975
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "mortgage_statement"
            }
          },
          "page_number": 12,
          "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 of a mortgage statement such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027monthly payment amount\u0027, \u0027outstanding balance\u0027, and \u0027interest charge\u0027. Additionally, it mentions \u0027instalment due\u0027 and provides a detailed breakdown of payments and interest charges over a specific period, which is characteristic 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\": \"268,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\": \"804.94\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CgQYZ9AykzAYY4GUutabW6cyd2N0o\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 of a mortgage statement such as \\\u0027mortgage account number\\\u0027, \\\u0027property address\\\u0027, \\\u0027monthly payment amount\\\u0027, \\\u0027outstanding balance\\\u0027, and \\\u0027interest charge\\\u0027. Additionally, it mentions \\\u0027instalment due\\\u0027 and provides a detailed breakdown of payments and interest charges over a specific period, which is characteristic 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\": \"268,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\": \"804.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=1764227895, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_to"
                },
                "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": "804.94",
                  "mortgage_account_number": "71019693",
                  "outstanding_balance": "268,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 of a mortgage statement such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027monthly payment amount\u0027, \u0027outstanding balance\u0027, and \u0027interest charge\u0027. Additionally, it mentions \u0027instalment due\u0027 and provides a detailed breakdown of payments and interest charges over a specific period, which is characteristic 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 of a mortgage statement such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027monthly payment amount\u0027, \u0027outstanding balance\u0027, and \u0027interest charge\u0027. Additionally, it mentions \u0027instalment due\u0027 and provides a detailed breakdown of payments and interest charges over a specific period, which is characteristic 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\": \"268,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\": \"804.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.125,
                  "pattern_score": 0.0,
                  "total_score": 0.0975
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "bank_statement"
            }
          },
          "page_number": 13,
          "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, \u0027interest charge\u0027, \u0027arrears balance\u0027, \u0027instalment due\u0027, and \u0027closing balance\u0027. Additionally, it includes details like interest rate, outstanding balance, and monthly payment amounts, which are specific to mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"3.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-CgQYbgLjvpSPJDx87etR3GaxtOyEJ\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, \\\u0027interest charge\\\u0027, \\\u0027arrears balance\\\u0027, \\\u0027instalment due\\\u0027, and \\\u0027closing balance\\\u0027. Additionally, it includes details like interest rate, outstanding balance, and monthly payment amounts, which are specific to mortgage statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": \"3.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=1764227897, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=261, prompt_tokens=1080, total_tokens=1341, completion_tokens_details="
                },
                "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, \u0027interest charge\u0027, \u0027arrears balance\u0027, \u0027instalment due\u0027, and \u0027closing balance\u0027. Additionally, it includes details like interest rate, outstanding balance, and monthly payment amounts, 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\u0027, \u0027property may be repossessed\u0027, \u0027interest rate summary\u0027, \u0027interest charge\u0027, \u0027arrears balance\u0027, \u0027instalment due\u0027, and \u0027closing balance\u0027. Additionally, it includes details like interest rate, outstanding balance, and monthly payment amounts, which are specific to mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"3.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.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "mortgage_statement"
            }
          },
          "page_number": 14,
          "text_length": 615
        }
      ],
      "start_page": 12
    },
    {
      "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": "Approximately 860-863",
        "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": 16,
      "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 \u0027Direct Debit Payment,\u0027 and \u0027Interest.\u0027 It also provides a loan account reference number, annual interest rate, outstanding balance, and a statement period, which are specific to 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-CgQYdUaI0BfN2s8GaakRDDmCr478Q\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 \\\u0027Direct Debit Payment,\\\u0027 and \\\u0027Interest.\\\u0027 It also provides a loan account reference number, annual interest rate, outstanding balance, and a statement period, which are specific to 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=1764227899, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=256, prompt_tokens=1386, total_tokens=1642, completion_tokens_details=Completio"
                },
                "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 \u0027Direct Debit Payment,\u0027 and \u0027Interest.\u0027 It also provides a loan account reference number, annual interest rate, outstanding balance, and a statement period, which are specific to 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 \u0027Direct Debit Payment,\u0027 and \u0027Interest.\u0027 It also provides a loan account reference number, annual interest rate, outstanding balance, and a statement period, which are specific to 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.125,
                  "pattern_score": 0.0,
                  "total_score": 0.0975
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "loan_statement"
            }
          },
          "page_number": 15,
          "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 \u0027settlement figure.\u0027 It also includes a running balance with \u0027DR\u0027 (debit) amounts, which is typical for loan repayment tracking. Additionally, the document mentions Barclays Bank, which is a financial institution, further supporting the classification as a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"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\": \"Approximately 860-863\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-CgQYf4hit8Jwj4WrzSH5GpLiIIWd1\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 \\\u0027settlement figure.\\\u0027 It also includes a running balance with \\\u0027DR\\\u0027 (debit) amounts, which is typical for loan repayment tracking. Additionally, the document mentions Barclays Bank, which is a financial institution, further supporting the classification as a loan statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"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\": \"Approximately 860-863\"\\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=1764227901, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=262, prompt_tokens=1360, total_t"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "monthly_payment_amount": "Approximately 860-863",
                  "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 \u0027settlement figure.\u0027 It also includes a running balance with \u0027DR\u0027 (debit) amounts, which is typical for loan repayment tracking. Additionally, the document mentions Barclays Bank, which is a financial institution, further supporting the classification as a loan statement.",
                "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 \u0027settlement figure.\u0027 It also includes a running balance with \u0027DR\u0027 (debit) amounts, which is typical for loan repayment tracking. Additionally, the document mentions Barclays Bank, which is a financial institution, further supporting the classification as a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"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\": \"Approximately 860-863\"\n    }\n}\n```"
              },
              "type": "loan_statement"
            },
            "method_used": "llm_preferred",
            "pattern_based": {
              "confidence": 0.0975,
              "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.125,
                  "pattern_score": 0.0,
                  "total_score": 0.0975
                },
                "payroll": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                },
                "trial_balance": {
                  "keyword_score": 0.0,
                  "pattern_score": 0.0,
                  "total_score": 0.0
                }
              },
              "type": "nominal_ledger"
            }
          },
          "page_number": 16,
          "text_length": 1598
        }
      ],
      "start_page": 15
    }
  ],
  "page_classifications": [
    {
      "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 payment due date, a statement period, and transaction details including a payment received. Additionally, the document references an \u0027American Express Business Platinum Card\u0027 and includes a closing balance and payment due amount, 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\": \"1081.76\",\n        \"statement_period\": \"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-CgQYFr6jSt3P3XJIiQLV7Zs5eBtTM\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 payment due date, a statement period, and transaction details including a payment received. Additionally, the document references an \\\u0027American Express Business Platinum Card\\\u0027 and includes a closing balance and payment due amount, 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\": \"1081.76\",\\n        \"statement_period\": \"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=1764227875, 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=1370, total_tokens=1614, completion_tokens_details=CompletionTokensDet"
            },
            "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": "1081.76",
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": "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 payment due date, a statement period, and transaction details including a payment received. Additionally, the document references an \u0027American Express Business Platinum Card\u0027 and includes a closing balance and payment due amount, 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 membership number, a spending limit, a payment due date, a statement period, and transaction details including a payment received. Additionally, the document references an \u0027American Express Business Platinum Card\u0027 and includes a closing balance and payment due amount, 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\": \"1081.76\",\n        \"statement_period\": \"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.125,
              "pattern_score": 0.0,
              "total_score": 0.0975
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 1,
      "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 details of a credit card statement, including a cardholder\u0027s name, card number, transaction details, transaction dates, merchant names, and amounts. It also includes payment instructions specific to a credit card account, such as direct debit and internet banking details. These are key 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-CgQYHHSHroY4MN1l2VMFxRQdL97qH\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 details of a credit card statement, including a cardholder\\\u0027s name, card number, transaction details, transaction dates, merchant names, and amounts. It also includes payment instructions specific to a credit card account, such as direct debit and internet banking details. These are key 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=1764227877, 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=1783, total_tokens=2008, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_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 details of a credit card statement, including a cardholder\u0027s name, card number, transaction details, transaction dates, merchant names, and amounts. It also includes payment instructions specific to a credit card account, such as direct debit and internet banking details. These are key indicators of a credit card statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains details of a credit card statement, including a cardholder\u0027s name, card number, transaction details, transaction dates, merchant names, and amounts. It also includes payment instructions specific to a credit card account, such as direct debit and internet banking details. These are key 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.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.0,
              "total_score": 0.025263157894736838
            },
            "nominal_ledger": {
              "keyword_score": 0.125,
              "pattern_score": 0.0,
              "total_score": 0.0975
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 2,
      "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 references to a credit card statement, including a membership number, a next statement date, transaction details, and a total spend amount. These are key 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-CgQYIKCCVrX7NxRKS4JPba8moytyI\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 references to a credit card statement, including a membership number, a next statement date, transaction details, and a total spend amount. These are key 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=1764227878, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=201, prompt_tokens=1023, total_tokens=1224, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(audio_tokens=0, cached_tokens=0)), prompt_filter_results="
            },
            "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 credit card statement, including a membership number, a next statement date, transaction details, and a total spend amount. These are key indicators of a credit card statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to a credit card statement, including a membership number, a next statement date, transaction details, and a total spend amount. These are key 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.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
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 3,
      "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 references to a credit card statement, including a card type (SBS Platinum Charge Card), card number (masked), membership number, statement period, and points earned. It also includes details about the next statement date and cardmember offers, which are typical of credit card statements. There is no mention of transactions, balances, or other indicators of a bank statement, invoice, or other document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"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-CgQYK5Wv6nD2iaoGQsrS8yieNgTi5\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 references to a credit card statement, including a card type (SBS Platinum Charge Card), card number (masked), membership number, statement period, and points earned. It also includes details about the next statement date and cardmember offers, which are typical of credit card statements. There is no mention of transactions, balances, or other indicators of a bank statement, invoice, or other document types.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": \"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=1764227880, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=256, prompt_tokens=1425, total_tokens=1681, completio"
            },
            "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 references to a credit card statement, including a card type (SBS Platinum Charge Card), card number (masked), membership number, statement period, and points earned. It also includes details about the next statement date and cardmember offers, which are typical of credit card statements. There is no mention of transactions, balances, or other indicators of a bank statement, invoice, or other document types.",
            "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to a credit card statement, including a card type (SBS Platinum Charge Card), card number (masked), membership number, statement period, and points earned. It also includes details about the next statement date and cardmember offers, which are typical of credit card statements. There is no mention of transactions, balances, or other indicators of a bank statement, invoice, or other document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"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
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 4,
      "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 contains references to a credit card account, including terms like \u0027American Express Business Platinum Card,\u0027 \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 and \u0027Next Statement Date.\u0027 These are key indicators of a credit card statement. There is no mention of transactions, balances, or other details that would classify it as a bank statement or other document type.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\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-CgQYMAGWFh3efnwHmHvhA0jjpEgNE\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 references to a credit card account, including terms like \\\u0027American Express Business Platinum Card,\\\u0027 \\\u0027Statement of Account,\\\u0027 \\\u0027Membership Number,\\\u0027 and \\\u0027Next Statement Date.\\\u0027 These are key indicators of a credit card statement. There is no mention of transactions, balances, or other details that would classify it as a bank statement or other document type.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\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=1764227882, 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=1068, total_tokens=1300, completion_tokens_details=CompletionTokensDetails(accepted_prediction_toke"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains references to a credit card account, including terms like \u0027American Express Business Platinum Card,\u0027 \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 and \u0027Next Statement Date.\u0027 These are key indicators of a credit card statement. There is no mention of transactions, balances, or other details that would classify it as a bank statement or other document type.",
            "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains references to a credit card account, including terms like \u0027American Express Business Platinum Card,\u0027 \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 and \u0027Next Statement Date.\u0027 These are key indicators of a credit card statement. There is no mention of transactions, balances, or other details that would classify it as a bank statement or other document type.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\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
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 5,
      "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 \u0027Agreement Number\u0027, \u0027Balance financed\u0027, \u0027Monthly payment\u0027, \u0027Hire Period\u0027, and \u0027Option to Purchase Fee\u0027. These are specific to hire purchase agreements and not found in other document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": \"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-CgQYNiCcorEHf0FYwtfg4K0fXQdmI\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 \\\u0027Agreement Number\\\u0027, \\\u0027Balance financed\\\u0027, \\\u0027Monthly payment\\\u0027, \\\u0027Hire Period\\\u0027, and \\\u0027Option to Purchase Fee\\\u0027. These are specific to hire purchase agreements and not found in other document types.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": \"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=1764227883, 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=1638, total_tokens=1865, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), pro"
            },
            "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 \u0027Agreement Number\u0027, \u0027Balance financed\u0027, \u0027Monthly payment\u0027, \u0027Hire Period\u0027, and \u0027Option to Purchase Fee\u0027. These are specific to hire purchase agreements and not found in other document types.",
            "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 \u0027Agreement Number\u0027, \u0027Balance financed\u0027, \u0027Monthly payment\u0027, \u0027Hire Period\u0027, and \u0027Option to Purchase Fee\u0027. These are specific to hire purchase agreements and not found in other document types.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": \"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": "both_agree",
        "pattern_based": {
          "confidence": 0.18653846153846151,
          "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.125,
              "pattern_score": 0.0,
              "total_score": 0.0975
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "hp_agreement"
        }
      },
      "page_number": 6,
      "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 multiple references to an \u0027Agreement,\u0027 mentions of \u0027finance,\u0027 \u0027Supplier,\u0027 and \u0027Equipment,\u0027 and includes terms like \u0027settlement amount,\u0027 \u0027finance,\u0027 and \u0027declaration for exemption relating to businesses.\u0027 These are key indicators of a hire purchase or finance agreement. Additionally, the document explicitly states that Aldermore is providing finance for equipment, which aligns with the characteristics of a hire purchase 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-CgQYPTJ56DdHqlvnWAGTIW7T26MvI\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 an \\\u0027Agreement,\\\u0027 mentions of \\\u0027finance,\\\u0027 \\\u0027Supplier,\\\u0027 and \\\u0027Equipment,\\\u0027 and includes terms like \\\u0027settlement amount,\\\u0027 \\\u0027finance,\\\u0027 and \\\u0027declaration for exemption relating to businesses.\\\u0027 These are key indicators of a hire purchase or finance agreement. Additionally, the document explicitly states that Aldermore is providing finance for equipment, which aligns with the characteristics of a hire purchase 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=1764227885, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=246, prompt_tokens=1509, total_toke"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains multiple references to an \u0027Agreement,\u0027 mentions of \u0027finance,\u0027 \u0027Supplier,\u0027 and \u0027Equipment,\u0027 and includes terms like \u0027settlement amount,\u0027 \u0027finance,\u0027 and \u0027declaration for exemption relating to businesses.\u0027 These are key indicators of a hire purchase or finance agreement. Additionally, the document explicitly states that Aldermore is providing finance for equipment, which aligns with the characteristics of a hire purchase agreement.",
            "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to an \u0027Agreement,\u0027 mentions of \u0027finance,\u0027 \u0027Supplier,\u0027 and \u0027Equipment,\u0027 and includes terms like \u0027settlement amount,\u0027 \u0027finance,\u0027 and \u0027declaration for exemption relating to businesses.\u0027 These are key indicators of a hire purchase or finance agreement. Additionally, the document explicitly states that Aldermore is providing finance for equipment, which aligns with the characteristics of a hire purchase 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.0975,
          "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.125,
              "pattern_score": 0.0,
              "total_score": 0.0975
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 7,
      "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, \u0027Hire\u0027, \u0027Equipment\u0027, \u0027Payment of Rentals\u0027, \u0027Direct Debit\u0027, \u0027Amount Financed\u0027, and \u0027Monthly Payment\u0027. These terms 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-CgQYRBBotkA0oE8qyEo3NvoQKLOh0\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, \\\u0027Hire\\\u0027, \\\u0027Equipment\\\u0027, \\\u0027Payment of Rentals\\\u0027, \\\u0027Direct Debit\\\u0027, \\\u0027Amount Financed\\\u0027, and \\\u0027Monthly Payment\\\u0027. These terms 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=1764227887, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=218, prompt_tokens=1561, total_tokens=1779, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTo"
            },
            "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, \u0027Hire\u0027, \u0027Equipment\u0027, \u0027Payment of Rentals\u0027, \u0027Direct Debit\u0027, \u0027Amount Financed\u0027, and \u0027Monthly Payment\u0027. These terms 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 key indicators of a hire purchase agreement, such as references to \u0027Agreement\u0027, \u0027Hire\u0027, \u0027Equipment\u0027, \u0027Payment of Rentals\u0027, \u0027Direct Debit\u0027, \u0027Amount Financed\u0027, and \u0027Monthly Payment\u0027. These terms 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.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.125,
              "pattern_score": 0.0,
              "total_score": 0.0975
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "financial_statement"
        }
      },
      "page_number": 8,
      "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 multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Equipment\u0027, \u0027Rentals\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, and \u0027Termination\u0027. Additionally, it mentions financial obligations like payments, insurance, and termination clauses, which are typical 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-CgQYSaxOzm1AZv1xGRex1brnCZunK\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \\\u0027Equipment\\\u0027, \\\u0027Rentals\\\u0027, \\\u0027Insurance monies\\\u0027, \\\u0027Total Loss\\\u0027, and \\\u0027Termination\\\u0027. Additionally, it mentions financial obligations like payments, insurance, and termination clauses, which are typical 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=1764227888, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=224, prompt_tokens=1579, total_tokens=1803, 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": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Equipment\u0027, \u0027Rentals\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, and \u0027Termination\u0027. Additionally, it mentions financial obligations like payments, insurance, and termination clauses, which are typical of hire purchase agreements.",
            "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Equipment\u0027, \u0027Rentals\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, and \u0027Termination\u0027. Additionally, it mentions financial obligations like payments, insurance, and termination clauses, which are typical 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.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.125,
              "pattern_score": 0.0,
              "total_score": 0.0975
            },
            "payroll": {
              "keyword_score": 0.05,
              "pattern_score": 0.0,
              "total_score": 0.03
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "invoice"
        }
      },
      "page_number": 9,
      "text_length": 11405
    },
    {
      "confidence_score": 0.95,
      "document_type": "hp_agreement",
      "features": {
        "llm_based": {
          "confidence": 0.95,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027termination of this Agreement.\u0027 Additionally, it mentions financing terms like \u0027amounts payable,\u0027 \u0027costs incurred,\u0027 and \u0027commission to Introducer,\u0027 which are indicative 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-CgQYUaTGuOEuttCTK4RRSvJ5N3OjR\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \\\u0027Option to Purchase,\\\u0027 \\\u0027Rentals,\\\u0027 \\\u0027Option to Purchase Fee,\\\u0027 \\\u0027hiring of the Equipment,\\\u0027 and \\\u0027termination of this Agreement.\\\u0027 Additionally, it mentions financing terms like \\\u0027amounts payable,\\\u0027 \\\u0027costs incurred,\\\u0027 and \\\u0027commission to Introducer,\\\u0027 which are indicative 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=1764227890, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=245, prompt_tokens=1534, total_tokens=1779, completion_tokens_details=Compl"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027termination of this Agreement.\u0027 Additionally, it mentions financing terms like \u0027amounts payable,\u0027 \u0027costs incurred,\u0027 and \u0027commission to Introducer,\u0027 which are indicative 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 multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027termination of this Agreement.\u0027 Additionally, it mentions financing terms like \u0027amounts payable,\u0027 \u0027costs incurred,\u0027 and \u0027commission to Introducer,\u0027 which are indicative 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.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.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.125,
              "pattern_score": 0.0,
              "total_score": 0.0975
            },
            "payroll": {
              "keyword_score": 0.05,
              "pattern_score": 0.0,
              "total_score": 0.03
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 10,
      "text_length": 10817
    },
    {
      "confidence_score": 0.85,
      "document_type": "loan_statement",
      "features": {
        "llm_based": {
          "confidence": 0.85,
          "features": {
            "api_response_debug": {
              "content_preview": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.85,\n    \"reasoning\": \"The document contains references to loan-related terms such as \u0027creditworthiness,\u0027 \u0027manage your account,\u0027 \u0027trace and recover debts,\u0027 and \u0027loan application.\u0027 Additionally, it mentions the use of credit reference agencies (CRAs) and financial history, which are common in loan statements. However, the document lacks specific transactional details, which slightly lowers the confidence level.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\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-CgQYWwN5VAk8iDTlSmvjm92GXkqXK\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.85,\\n    \"reasoning\": \"The document contains references to loan-related terms such as \\\u0027creditworthiness,\\\u0027 \\\u0027manage your account,\\\u0027 \\\u0027trace and recover debts,\\\u0027 and \\\u0027loan application.\\\u0027 Additionally, it mentions the use of credit reference agencies (CRAs) and financial history, which are common in loan statements. However, the document lacks specific transactional details, which slightly lowers the confidence level.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\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=1764227892, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=233, prompt_tokens=1487, total_tokens=1720, completion_tokens_details=CompletionTokensDetails(accepted_"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": null,
              "mortgage_account_number": null,
              "outstanding_balance": null,
              "property_address": null,
              "remaining_term_months": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains references to loan-related terms such as \u0027creditworthiness,\u0027 \u0027manage your account,\u0027 \u0027trace and recover debts,\u0027 and \u0027loan application.\u0027 Additionally, it mentions the use of credit reference agencies (CRAs) and financial history, which are common in loan statements. However, the document lacks specific transactional details, which slightly lowers the confidence level.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.85,\n    \"reasoning\": \"The document contains references to loan-related terms such as \u0027creditworthiness,\u0027 \u0027manage your account,\u0027 \u0027trace and recover debts,\u0027 and \u0027loan application.\u0027 Additionally, it mentions the use of credit reference agencies (CRAs) and financial history, which are common in loan statements. However, the document lacks specific transactional details, which slightly lowers the confidence level.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null,\n        \"mortgage_account_number\": null,\n        \"property_address\": null,\n        \"remaining_term_months\": null,\n        \"monthly_payment_amount\": null\n    }\n}\n```"
          },
          "type": "loan_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.07058823529411765,
          "features": {
            "bank_statement": {
              "keyword_score": 0.11764705882352941,
              "pattern_score": 0.0,
              "total_score": 0.07058823529411765
            },
            "corporation_tax": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "credit_card": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "financial_statement": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "hp_agreement": {
              "keyword_score": 0.038461538461538464,
              "pattern_score": 0.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
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 11,
      "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 \u0027current interest rate\u0027. Additionally, it 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-CgQYXKRA61Juc6OkyRbE4o8mfc0wu\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 \\\u0027current interest rate\\\u0027. Additionally, it 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=1764227893, 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=1431, total_tokens=1675, completion_tokens_details=CompletionTokensDetails(accepted_"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": "\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 \u0027current interest rate\u0027. Additionally, it 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 \u0027current interest rate\u0027. Additionally, it 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.125,
              "pattern_score": 0.0,
              "total_score": 0.0975
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "mortgage_statement"
        }
      },
      "page_number": 12,
      "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 of a mortgage statement such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027monthly payment amount\u0027, \u0027outstanding balance\u0027, and \u0027interest charge\u0027. Additionally, it mentions \u0027instalment due\u0027 and provides a detailed breakdown of payments and interest charges over a specific period, which is characteristic 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\": \"268,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\": \"804.94\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CgQYZ9AykzAYY4GUutabW6cyd2N0o\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 of a mortgage statement such as \\\u0027mortgage account number\\\u0027, \\\u0027property address\\\u0027, \\\u0027monthly payment amount\\\u0027, \\\u0027outstanding balance\\\u0027, and \\\u0027interest charge\\\u0027. Additionally, it mentions \\\u0027instalment due\\\u0027 and provides a detailed breakdown of payments and interest charges over a specific period, which is characteristic 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\": \"268,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\": \"804.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=1764227895, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_to"
            },
            "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": "804.94",
              "mortgage_account_number": "71019693",
              "outstanding_balance": "268,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 of a mortgage statement such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027monthly payment amount\u0027, \u0027outstanding balance\u0027, and \u0027interest charge\u0027. Additionally, it mentions \u0027instalment due\u0027 and provides a detailed breakdown of payments and interest charges over a specific period, which is characteristic 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 of a mortgage statement such as \u0027mortgage account number\u0027, \u0027property address\u0027, \u0027monthly payment amount\u0027, \u0027outstanding balance\u0027, and \u0027interest charge\u0027. Additionally, it mentions \u0027instalment due\u0027 and provides a detailed breakdown of payments and interest charges over a specific period, which is characteristic 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\": \"268,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\": \"804.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.125,
              "pattern_score": 0.0,
              "total_score": 0.0975
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "bank_statement"
        }
      },
      "page_number": 13,
      "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, \u0027interest charge\u0027, \u0027arrears balance\u0027, \u0027instalment due\u0027, and \u0027closing balance\u0027. Additionally, it includes details like interest rate, outstanding balance, and monthly payment amounts, which are specific to mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"3.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-CgQYbgLjvpSPJDx87etR3GaxtOyEJ\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, \\\u0027interest charge\\\u0027, \\\u0027arrears balance\\\u0027, \\\u0027instalment due\\\u0027, and \\\u0027closing balance\\\u0027. Additionally, it includes details like interest rate, outstanding balance, and monthly payment amounts, which are specific to mortgage statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": \"3.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=1764227897, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=261, prompt_tokens=1080, total_tokens=1341, completion_tokens_details="
            },
            "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, \u0027interest charge\u0027, \u0027arrears balance\u0027, \u0027instalment due\u0027, and \u0027closing balance\u0027. Additionally, it includes details like interest rate, outstanding balance, and monthly payment amounts, 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\u0027, \u0027property may be repossessed\u0027, \u0027interest rate summary\u0027, \u0027interest charge\u0027, \u0027arrears balance\u0027, \u0027instalment due\u0027, and \u0027closing balance\u0027. Additionally, it includes details like interest rate, outstanding balance, and monthly payment amounts, which are specific to mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"3.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.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "mortgage_statement"
        }
      },
      "page_number": 14,
      "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 \u0027Direct Debit Payment,\u0027 and \u0027Interest.\u0027 It also provides a loan account reference number, annual interest rate, outstanding balance, and a statement period, which are specific to 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-CgQYdUaI0BfN2s8GaakRDDmCr478Q\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 \\\u0027Direct Debit Payment,\\\u0027 and \\\u0027Interest.\\\u0027 It also provides a loan account reference number, annual interest rate, outstanding balance, and a statement period, which are specific to 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=1764227899, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=256, prompt_tokens=1386, total_tokens=1642, completion_tokens_details=Completio"
            },
            "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 \u0027Direct Debit Payment,\u0027 and \u0027Interest.\u0027 It also provides a loan account reference number, annual interest rate, outstanding balance, and a statement period, which are specific to 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 \u0027Direct Debit Payment,\u0027 and \u0027Interest.\u0027 It also provides a loan account reference number, annual interest rate, outstanding balance, and a statement period, which are specific to 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.125,
              "pattern_score": 0.0,
              "total_score": 0.0975
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "loan_statement"
        }
      },
      "page_number": 15,
      "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 \u0027settlement figure.\u0027 It also includes a running balance with \u0027DR\u0027 (debit) amounts, which is typical for loan repayment tracking. Additionally, the document mentions Barclays Bank, which is a financial institution, further supporting the classification as a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"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\": \"Approximately 860-863\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-CgQYf4hit8Jwj4WrzSH5GpLiIIWd1\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 \\\u0027settlement figure.\\\u0027 It also includes a running balance with \\\u0027DR\\\u0027 (debit) amounts, which is typical for loan repayment tracking. Additionally, the document mentions Barclays Bank, which is a financial institution, further supporting the classification as a loan statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"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\": \"Approximately 860-863\"\\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=1764227901, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=262, prompt_tokens=1360, total_t"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "monthly_payment_amount": "Approximately 860-863",
              "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 \u0027settlement figure.\u0027 It also includes a running balance with \u0027DR\u0027 (debit) amounts, which is typical for loan repayment tracking. Additionally, the document mentions Barclays Bank, which is a financial institution, further supporting the classification as a loan statement.",
            "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 \u0027settlement figure.\u0027 It also includes a running balance with \u0027DR\u0027 (debit) amounts, which is typical for loan repayment tracking. Additionally, the document mentions Barclays Bank, which is a financial institution, further supporting the classification as a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"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\": \"Approximately 860-863\"\n    }\n}\n```"
          },
          "type": "loan_statement"
        },
        "method_used": "llm_preferred",
        "pattern_based": {
          "confidence": 0.0975,
          "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.125,
              "pattern_score": 0.0,
              "total_score": 0.0975
            },
            "payroll": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            },
            "trial_balance": {
              "keyword_score": 0.0,
              "pattern_score": 0.0,
              "total_score": 0.0
            }
          },
          "type": "nominal_ledger"
        }
      },
      "page_number": 16,
      "text_length": 1598
    }
  ],
  "processing_timestamp": "2025-11-27T07:18:22.883421"
}