Merged PDF Processing Results

Back to Dashboard
PDF Information
Original Filename: testing_sample_merged_1.pdf
Upload Date: November 26, 2025 at 07:03 AM
Total Pages: 16
Processing Status: Completed
Extraction Summary
Total Documents: 3
Credit Cards: 1
Hp Agreements: 1
Loan 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

Loan Statement

95%
Page 13

Loan Statement

95%
Page 14

Loan Statement

95%
Page 15

Loan Statement

95%
Page 16

Loan Statement

95%
Extracted Documents 3
Document Type Pages Confidence Processing Status Created Actions
Credit Card 1-5 (5 pages) 95% Processed 2025-11-26 07:03 View
Hp Agreement 6-10 (5 pages) 95% Processed 2025-11-26 07:04 View
Loan Statement 11-16 (6 pages) 93% Processed 2025-11-26 07:04 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,
        "outstanding_balance": "\u00a31,081.76",
        "seller_name": null,
        "statement_period": "From 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, a closing balance, and transaction details. It also references a card type (American Express Business Platinum Card) and includes a payment received entry.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a31,081.76\",\n        \"statement_period\": \"From 27 May to 26 June 2024\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qfriD720laFHQG8xGFkcRNw5Ry\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, a closing balance, and transaction details. It also references a card type (American Express Business Platinum Card) and includes a payment received entry.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a31,081.76\",\\n        \"statement_period\": \"From 27 May to 26 June 2024\"\\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=1764140605, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=205, prompt_tokens=1216, total_tokens=1421, 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=[{\u0027prompt_index\u0027: 0, \u0027content_fi"
                },
                "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,
                  "outstanding_balance": "\u00a31,081.76",
                  "seller_name": null,
                  "statement_period": "From 27 May to 26 June 2024",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a credit card statement, such as a membership number, a spending limit, a payment due date, a statement period, a closing balance, and transaction details. It also references a card type (American Express Business Platinum Card) and includes a payment received entry.",
                "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, a closing balance, and transaction details. It also references a card type (American Express Business Platinum Card) and includes a payment received entry.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a31,081.76\",\n        \"statement_period\": \"From 27 May to 26 June 2024\"\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
                },
                "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 is a credit card statement as it includes a cardholder\u0027s name, card number (partially redacted), transaction details with dates, merchant names, amounts, and foreign transaction fees. It also includes payment instructions and a next statement date, which are typical features 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    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qgQfBR5iaAyqsghGHiR79liunX\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 is a credit card statement as it includes a cardholder\\\u0027s name, card number (partially redacted), transaction details with dates, merchant names, amounts, and foreign transaction fees. It also includes payment instructions and a next statement date, which are typical features 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    }\\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=1764140606, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=189, prompt_tokens=1629, total_tokens=1818, 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=[{\u0027prompt_index\u0027: 0, \u0027content_filter_results\u0027: {\u0027hate\u0027:"
                },
                "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,
                  "outstanding_balance": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document is a credit card statement as it includes a cardholder\u0027s name, card number (partially redacted), transaction details with dates, merchant names, amounts, and foreign transaction fees. It also includes payment instructions and a next statement date, which are typical features of a credit card statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is a credit card statement as it includes a cardholder\u0027s name, card number (partially redacted), transaction details with dates, merchant names, amounts, and foreign transaction fees. It also includes payment instructions and a next statement date, which are typical features 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    }\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
                },
                "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 terms like \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 \u0027Next Statement Date,\u0027 and transaction details such as \u0027Transaction Date,\u0027 \u0027Transaction Details,\u0027 and amounts. Additionally, the document mentions a specific card type (American Express Business Platinum Card) and includes a cardholder\u0027s name and membership number, which are typical of credit card statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"26/06/24 to 26/07/24\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qiiMS9QVNdTnIl4VlHkQN5rSk3\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 terms like \\\u0027Statement of Account,\\\u0027 \\\u0027Membership Number,\\\u0027 \\\u0027Next Statement Date,\\\u0027 and transaction details such as \\\u0027Transaction Date,\\\u0027 \\\u0027Transaction Details,\\\u0027 and amounts. Additionally, the document mentions a specific card type (American Express Business Platinum Card) and includes a cardholder\\\u0027s name and membership number, which are typical of credit card statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": \"26/06/24 to 26/07/24\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1764140608, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=220, prompt_tokens=869, total_tokens=1089, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), promp"
                },
                "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,
                  "outstanding_balance": null,
                  "seller_name": null,
                  "statement_period": "26/06/24 to 26/07/24",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains references to a credit card statement, including terms like \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 \u0027Next Statement Date,\u0027 and transaction details such as \u0027Transaction Date,\u0027 \u0027Transaction Details,\u0027 and amounts. Additionally, the document mentions a specific card type (American Express Business Platinum Card) and includes a cardholder\u0027s name and membership number, 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 references to a credit card statement, including terms like \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 \u0027Next Statement Date,\u0027 and transaction details such as \u0027Transaction Date,\u0027 \u0027Transaction Details,\u0027 and amounts. Additionally, the document mentions a specific card type (American Express Business Platinum Card) and includes a cardholder\u0027s name and membership number, which are typical of credit card statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"26/06/24 to 26/07/24\"\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
                },
                "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, 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.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\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    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qkLZ6gd8fknlcLg1EfEMne0Qrw\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, 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.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\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    }\\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=1764140610, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=197, prompt_tokens=1271, total_tokens=1468, 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=[{\u0027prompt_index\u0027: 0, \u0027content_filter_results\u0027: {\u0027hat"
                },
                "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,
                  "outstanding_balance": 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, 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.",
                "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, 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.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\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    }\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
                },
                "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 is a statement for an American Express Business Platinum Card, which is a credit card. Key indicators include \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 \u0027Next Statement Date,\u0027 and references to managing the card account online. There are no mentions of bank transactions, invoices, payroll, hire purchase agreements, loans, or financial statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qlWF1KnHI3ir6ssz5NL2cy9taJ\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 is a statement for an American Express Business Platinum Card, which is a credit card. Key indicators include \\\u0027Statement of Account,\\\u0027 \\\u0027Membership Number,\\\u0027 \\\u0027Next Statement Date,\\\u0027 and references to managing the card account online. There are no mentions of bank transactions, invoices, payroll, hire purchase agreements, loans, or financial statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null\\n    }\\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=1764140611, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=196, prompt_tokens=914, total_tokens=1110, 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=[{\u0027p"
                },
                "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,
                  "outstanding_balance": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document is a statement for an American Express Business Platinum Card, which is a credit card. Key indicators include \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 \u0027Next Statement Date,\u0027 and references to managing the card account online. There are no mentions of bank transactions, invoices, payroll, hire purchase agreements, loans, or financial statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is a statement for an American Express Business Platinum Card, which is a credit card. Key indicators include \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 \u0027Next Statement Date,\u0027 and references to managing the card account online. There are no mentions of bank transactions, invoices, payroll, hire purchase agreements, loans, or financial statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\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
                },
                "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": "not explicitly mentioned in the text",
        "amount_financed": "54,256.58",
        "annual_interest_rate": "5% above Finance House Base Rate",
        "invoice_date": null,
        "invoice_number": null,
        "loan_reference": null,
        "loan_tenure": "36 months",
        "monthly_payment": "1,760.08",
        "outstanding_balance": 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 characteristic 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\": \"54,256.58\",\n        \"monthly_payment\": \"1,760.08\",\n        \"loan_tenure\": \"36 months\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qnhiO0FNCc5cct6L7cHxIjhcWK\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 characteristic 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\": \"54,256.58\",\\n        \"monthly_payment\": \"1,760.08\",\\n        \"loan_tenure\": \"36 months\",\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": 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=1764140613, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=190, prompt_tokens=1484, total_tokens=1674, 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=[{\u0027prompt_index\u0027: 0, \u0027content_filter_results\u0027: {\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027"
                },
                "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 months",
                  "monthly_payment": "1,760.08",
                  "outstanding_balance": 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 characteristic of a hire purchase agreement.",
                "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 characteristic 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\": \"54,256.58\",\n        \"monthly_payment\": \"1,760.08\",\n        \"loan_tenure\": \"36 months\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": 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
                },
                "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 key indicators of a hire purchase agreement, such as references to \u0027Agreement\u0027, \u0027finance\u0027, \u0027Supplier\u0027, \u0027Equipment\u0027, and \u0027settlement amount\u0027. Additionally, it includes terms like \u0027amount financed\u0027, \u0027declaration for exemption\u0027, and references to the Financial Services and Markets Act, which are typical of hire purchase or finance agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qo25GKJhNWPl2swItqb3bKLphW\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \\\u0027Agreement\\\u0027, \\\u0027finance\\\u0027, \\\u0027Supplier\\\u0027, \\\u0027Equipment\\\u0027, and \\\u0027settlement amount\\\u0027. Additionally, it includes terms like \\\u0027amount financed\\\u0027, \\\u0027declaration for exemption\\\u0027, and references to the Financial Services and Markets Act, which are typical of hire purchase or finance agreements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": 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=1764140614, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=199, prompt_tokens=1355, total_tokens=1554, 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_re"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "outstanding_balance": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a hire purchase agreement, such as references to \u0027Agreement\u0027, \u0027finance\u0027, \u0027Supplier\u0027, \u0027Equipment\u0027, and \u0027settlement amount\u0027. Additionally, it includes terms like \u0027amount financed\u0027, \u0027declaration for exemption\u0027, and references to the Financial Services and Markets Act, which are typical of hire purchase or finance agreements.",
                "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027Agreement\u0027, \u0027finance\u0027, \u0027Supplier\u0027, \u0027Equipment\u0027, and \u0027settlement amount\u0027. Additionally, it includes terms like \u0027amount financed\u0027, \u0027declaration for exemption\u0027, and references to the Financial Services and Markets Act, which are typical of hire purchase or finance agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": 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
                },
                "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. Additionally, the document outlines terms for equipment delivery, maintenance, and payment schedules, which are typical of HP agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": \"not explicitly mentioned in the text\",\n        \"amount_financed\": \"not explicitly mentioned in the text\",\n        \"monthly_payment\": \"not explicitly mentioned in the text\",\n        \"loan_tenure\": \"not explicitly mentioned in the text\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"5% above Finance House Base Rate\",\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qqXFhKwjvR4j8NJsXKrrQzUzJT\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. Additionally, the document outlines terms for equipment delivery, maintenance, and payment schedules, which are typical of HP agreements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": \"not explicitly mentioned in the text\",\\n        \"amount_financed\": \"not explicitly mentioned in the text\",\\n        \"monthly_payment\": \"not explicitly mentioned in the text\",\\n        \"loan_tenure\": \"not explicitly mentioned in the text\",\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": \"5% above Finance House Base Rate\",\\n        \"outstanding_balance\": null,\\n        \"statement_period\": 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=1764140616, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=238, prompt_tokens=1407, total_tokens=1645, completion_tokens_details=Compl"
                },
                "document_identifiers": {
                  "agreement_date": "not explicitly mentioned in the text",
                  "amount_financed": "not explicitly mentioned in the text",
                  "annual_interest_rate": "5% above Finance House Base Rate",
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": "not explicitly mentioned in the text",
                  "monthly_payment": "not explicitly mentioned in the text",
                  "outstanding_balance": 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. Additionally, the document outlines terms for equipment delivery, maintenance, and payment schedules, which are typical of HP 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. Additionally, the document outlines terms for equipment delivery, maintenance, and payment schedules, which are typical of HP agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": \"not explicitly mentioned in the text\",\n        \"amount_financed\": \"not explicitly mentioned in the text\",\n        \"monthly_payment\": \"not explicitly mentioned in the text\",\n        \"loan_tenure\": \"not explicitly mentioned in the text\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"5% above Finance House Base Rate\",\n        \"outstanding_balance\": null,\n        \"statement_period\": 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
                },
                "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 key indicators of a hire purchase agreement, such as references to \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and terms like \u0027hiring of the Equipment under this Agreement\u0027. These terms are specific to hire purchase or finance agreements, particularly for equipment or assets.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qs2oUTQEWQKzeh9jJs9lW3G0S8\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \\\u0027Equipment\\\u0027, \\\u0027Insurance monies\\\u0027, \\\u0027Total Loss\\\u0027, \\\u0027Rentals\\\u0027, and terms like \\\u0027hiring of the Equipment under this Agreement\\\u0027. These terms are specific to hire purchase or finance agreements, particularly for equipment or assets.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": 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=1764140618, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=191, prompt_tokens=1425, total_tokens=1616, 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=[{\u0027prompt_index\u0027: 0, \u0027content_filter_results\u0027: {"
                },
                "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,
                  "outstanding_balance": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a hire purchase agreement, such as references to \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and terms like \u0027hiring of the Equipment under this Agreement\u0027. These terms are specific to hire purchase or finance agreements, particularly for equipment or assets.",
                "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and terms like \u0027hiring of the Equipment under this Agreement\u0027. These terms are specific to hire purchase or finance agreements, particularly for equipment or assets.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": 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
                },
                "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 These are key indicators of a hire purchase agreement. Additionally, the document mentions terms like \u0027amounts payable,\u0027 \u0027commission,\u0027 and \u0027repossession,\u0027 which are commonly associated with 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    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qtgjF2w2wZQkBw7rP3ffuJ5nGr\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 These are key indicators of a hire purchase agreement. Additionally, the document mentions terms like \\\u0027amounts payable,\\\u0027 \\\u0027commission,\\\u0027 and \\\u0027repossession,\\\u0027 which are commonly associated with 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    }\\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=1764140619, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=216, prompt_tokens=1380, total_tokens=1596, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prom"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "outstanding_balance": 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 These are key indicators of a hire purchase agreement. Additionally, the document mentions terms like \u0027amounts payable,\u0027 \u0027commission,\u0027 and \u0027repossession,\u0027 which are commonly associated with hire purchase agreements.",
                "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027termination of this Agreement.\u0027 These are key indicators of a hire purchase agreement. Additionally, the document mentions terms like \u0027amounts payable,\u0027 \u0027commission,\u0027 and \u0027repossession,\u0027 which are commonly associated with 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    }\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
                },
                "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.9333333333333332,
      "document_identifiers": {
        "agreement_date": null,
        "amount_financed": null,
        "annual_interest_rate": "3.59%",
        "invoice_date": null,
        "invoice_number": null,
        "loan_reference": "71019693",
        "loan_tenure": "300 months (25 years)",
        "monthly_payment": null,
        "outstanding_balance": "\u00a3268,984.99",
        "seller_name": null,
        "statement_period": "1 October 2023 to 30 September 2024",
        "total_amount": null
      },
      "document_type": "loan_statement",
      "end_page": 16,
      "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 \u0027account,\u0027 \u0027debts,\u0027 \u0027financial history,\u0027 and \u0027CRAs (Credit Reference Agencies).\u0027 It also discusses the processing of applications, account management, and debt recovery, which are indicative of a loan statement. However, the document does not explicitly include numerical details like loan reference, interest rate, or outstanding balance, which slightly reduces confidence.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qvJzM6jEh2Ljq3esp513xin3l6\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 \\\u0027account,\\\u0027 \\\u0027debts,\\\u0027 \\\u0027financial history,\\\u0027 and \\\u0027CRAs (Credit Reference Agencies).\\\u0027 It also discusses the processing of applications, account management, and debt recovery, which are indicative of a loan statement. However, the document does not explicitly include numerical details like loan reference, interest rate, or outstanding balance, which slightly reduces confidence.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null\\n    }\\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=1764140621, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=212, prompt_tokens=1333, total_tokens=1545, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), p"
                },
                "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,
                  "outstanding_balance": null,
                  "seller_name": null,
                  "statement_period": null,
                  "total_amount": null
                },
                "llm_reasoning": "The document contains references to loan-related terms such as \u0027creditworthiness,\u0027 \u0027account,\u0027 \u0027debts,\u0027 \u0027financial history,\u0027 and \u0027CRAs (Credit Reference Agencies).\u0027 It also discusses the processing of applications, account management, and debt recovery, which are indicative of a loan statement. However, the document does not explicitly include numerical details like loan reference, interest rate, or outstanding balance, which slightly reduces confidence.",
                "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 \u0027account,\u0027 \u0027debts,\u0027 \u0027financial history,\u0027 and \u0027CRAs (Credit Reference Agencies).\u0027 It also discusses the processing of applications, account management, and debt recovery, which are indicative of a loan statement. However, the document does not explicitly include numerical details like loan reference, interest rate, or outstanding balance, which slightly reduces confidence.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\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
                },
                "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.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 \u0027mortgage account number\u0027, \u0027annual mortgage statement\u0027, \u0027interest-only mortgage\u0027, \u0027original amount borrowed\u0027, \u0027current interest rate\u0027, \u0027arrears balance\u0027, \u0027account balance\u0027, and \u0027cost to repay the loan\u0027. These terms are specific to loan or mortgage account 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\": \"300 months (25 years)\",\n        \"loan_reference\": \"71019693\",\n        \"annual_interest_rate\": \"3.59%\",\n        \"outstanding_balance\": \"\u00a3268,984.99\",\n        \"statement_period\": \"1 October 2023 to 30 September 2024\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qxTwtzcxuQxe2eT39hEvk5FuKz\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 \\\u0027mortgage account number\\\u0027, \\\u0027annual mortgage statement\\\u0027, \\\u0027interest-only mortgage\\\u0027, \\\u0027original amount borrowed\\\u0027, \\\u0027current interest rate\\\u0027, \\\u0027arrears balance\\\u0027, \\\u0027account balance\\\u0027, and \\\u0027cost to repay the loan\\\u0027. These terms are specific to loan or mortgage account 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\": \"300 months (25 years)\",\\n        \"loan_reference\": \"71019693\",\\n        \"annual_interest_rate\": \"3.59%\",\\n        \"outstanding_balance\": \"\u00a3268,984.99\",\\n        \"statement_period\": \"1 October 2023 to 30 September 2024\"\\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=1764140623, 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=1277, total_tokens=1501, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(audio_t"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": "3.59%",
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": "71019693",
                  "loan_tenure": "300 months (25 years)",
                  "monthly_payment": null,
                  "outstanding_balance": "\u00a3268,984.99",
                  "seller_name": null,
                  "statement_period": "1 October 2023 to 30 September 2024",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a loan statement, such as \u0027mortgage account number\u0027, \u0027annual mortgage statement\u0027, \u0027interest-only mortgage\u0027, \u0027original amount borrowed\u0027, \u0027current interest rate\u0027, \u0027arrears balance\u0027, \u0027account balance\u0027, and \u0027cost to repay the loan\u0027. These terms are specific to loan or mortgage account statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as \u0027mortgage account number\u0027, \u0027annual mortgage statement\u0027, \u0027interest-only mortgage\u0027, \u0027original amount borrowed\u0027, \u0027current interest rate\u0027, \u0027arrears balance\u0027, \u0027account balance\u0027, and \u0027cost to repay the loan\u0027. These terms are specific to loan or mortgage account 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\": \"300 months (25 years)\",\n        \"loan_reference\": \"71019693\",\n        \"annual_interest_rate\": \"3.59%\",\n        \"outstanding_balance\": \"\u00a3268,984.99\",\n        \"statement_period\": \"1 October 2023 to 30 September 2024\"\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.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
                },
                "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": 12,
          "text_length": 2038
        },
        {
          "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 \u0027Annual Statement\u0027 and includes key indicators of a loan statement such as an account number, a statement period, a series of transactions (direct debits and interest charges), an outstanding balance, and references to instalments due. Additionally, the document mentions \u0027arrears balance\u0027 and \u0027interest charge,\u0027 which are typical of loan statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": \"71019693\",\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3268,999.95\",\n        \"statement_period\": \"1 October 2023 - 30 September 2024\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qzzaUo4DNDNqv6vusXEMzWvas2\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 \\\u0027Annual Statement\\\u0027 and includes key indicators of a loan statement such as an account number, a statement period, a series of transactions (direct debits and interest charges), an outstanding balance, and references to instalments due. Additionally, the document mentions \\\u0027arrears balance\\\u0027 and \\\u0027interest charge,\\\u0027 which are typical of loan statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": \"71019693\",\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a3268,999.95\",\\n        \"statement_period\": \"1 October 2023 - 30 September 2024\"\\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=1764140625, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=221, prompt_tokens=1556, total_tokens=1777, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails("
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": null,
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": "71019693",
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "outstanding_balance": "\u00a3268,999.95",
                  "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 loan statement such as an account number, a statement period, a series of transactions (direct debits and interest charges), an outstanding balance, and references to instalments due. Additionally, the document mentions \u0027arrears balance\u0027 and \u0027interest charge,\u0027 which are typical of loan statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Annual Statement\u0027 and includes key indicators of a loan statement such as an account number, a statement period, a series of transactions (direct debits and interest charges), an outstanding balance, and references to instalments due. Additionally, the document mentions \u0027arrears balance\u0027 and \u0027interest charge,\u0027 which are typical of loan statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": \"71019693\",\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3268,999.95\",\n        \"statement_period\": \"1 October 2023 - 30 September 2024\"\n    }\n}\n```"
              },
              "type": "loan_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
                },
                "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": "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 \u0027Direct debit\u0027, \u0027Interest charge\u0027, \u0027Instalment due\u0027, \u0027Closing balance\u0027, \u0027Outstanding balance\u0027, and \u0027Interest rate summary\u0027. Additionally, it mentions \u0027Your property may be repossessed if you don\u0027t keep up repayments on your mortgage\u0027, which is a common warning in loan or mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"3.59% a year\",\n        \"outstanding_balance\": \"\u00a3268,984.99\",\n        \"statement_period\": \"1 October 2023 to 30 September 2024\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3r0XPGkTJyKDUIySGqWzjddxncx\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 \\\u0027Direct debit\\\u0027, \\\u0027Interest charge\\\u0027, \\\u0027Instalment due\\\u0027, \\\u0027Closing balance\\\u0027, \\\u0027Outstanding balance\\\u0027, and \\\u0027Interest rate summary\\\u0027. Additionally, it mentions \\\u0027Your property may be repossessed if you don\\\u0027t keep up repayments on your mortgage\\\u0027, which is a common warning in loan or mortgage statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": \"3.59% a year\",\\n        \"outstanding_balance\": \"\u00a3268,984.99\",\\n        \"statement_period\": \"1 October 2023 to 30 September 2024\"\\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=1764140626, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=226, prompt_tokens=926, total_tokens=1152, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(au"
                },
                "document_identifiers": {
                  "agreement_date": null,
                  "amount_financed": null,
                  "annual_interest_rate": "3.59% a year",
                  "invoice_date": null,
                  "invoice_number": null,
                  "loan_reference": null,
                  "loan_tenure": null,
                  "monthly_payment": null,
                  "outstanding_balance": "\u00a3268,984.99",
                  "seller_name": null,
                  "statement_period": "1 October 2023 to 30 September 2024",
                  "total_amount": null
                },
                "llm_reasoning": "The document contains key indicators of a loan statement, such as \u0027Direct debit\u0027, \u0027Interest charge\u0027, \u0027Instalment due\u0027, \u0027Closing balance\u0027, \u0027Outstanding balance\u0027, and \u0027Interest rate summary\u0027. Additionally, it mentions \u0027Your property may be repossessed if you don\u0027t keep up repayments on your mortgage\u0027, which is a common warning in loan or mortgage statements.",
                "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as \u0027Direct debit\u0027, \u0027Interest charge\u0027, \u0027Instalment due\u0027, \u0027Closing balance\u0027, \u0027Outstanding balance\u0027, and \u0027Interest rate summary\u0027. Additionally, it mentions \u0027Your property may be repossessed if you don\u0027t keep up repayments on your mortgage\u0027, which is a common warning in loan or mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"3.59% a year\",\n        \"outstanding_balance\": \"\u00a3268,984.99\",\n        \"statement_period\": \"1 October 2023 to 30 September 2024\"\n    }\n}\n```"
              },
              "type": "loan_statement"
            },
            "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.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
                },
                "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": 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 a detailed list of transactions with balances. These are characteristic of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": \"23653883476995\",\n        \"annual_interest_rate\": \"2.500%\",\n        \"outstanding_balance\": \"14966.52 DR\",\n        \"statement_period\": \"10 August 2024 to 11 August 2025\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3r2zJDlFhtBMHUHx1pT8RXqZjn3\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 a detailed list of transactions with balances. These are characteristic of a loan statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": \"23653883476995\",\\n        \"annual_interest_rate\": \"2.500%\",\\n        \"outstanding_balance\": \"14966.52 DR\",\\n        \"statement_period\": \"10 August 2024 to 11 August 2025\"\\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=1764140628, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=209, prompt_tokens=1232, total_tokens=1441, 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=[{\u0027prompt_index\u0027: 0, "
                },
                "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,
                  "outstanding_balance": "14966.52 DR",
                  "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 a detailed list of transactions with balances. These are characteristic of a loan statement.",
                "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan 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 a detailed list of transactions with balances. These are characteristic of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": \"23653883476995\",\n        \"annual_interest_rate\": \"2.500%\",\n        \"outstanding_balance\": \"14966.52 DR\",\n        \"statement_period\": \"10 August 2024 to 11 August 2025\"\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
                },
                "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 in debit (DR), which is typical for loan repayment statements. 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 DR\",\n        \"statement_period\": \"17 Feb 2025 - 11 Aug 2025\"\n    }\n}\n```",
                  "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3r464Je53mqSeB97UR5y70iBHju\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 in debit (DR), which is typical for loan repayment statements. 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 DR\",\\n        \"statement_period\": \"17 Feb 2025 - 11 Aug 2025\"\\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=1764140630, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=220, prompt_tokens=1206, total_tokens=1426, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=Promp"
                },
                "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,
                  "outstanding_balance": "10833.49 DR",
                  "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 in debit (DR), which is typical for loan repayment statements. 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 in debit (DR), which is typical for loan repayment statements. 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 DR\",\n        \"statement_period\": \"17 Feb 2025 - 11 Aug 2025\"\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
                },
                "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": 11
    }
  ],
  "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, a closing balance, and transaction details. It also references a card type (American Express Business Platinum Card) and includes a payment received entry.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a31,081.76\",\n        \"statement_period\": \"From 27 May to 26 June 2024\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qfriD720laFHQG8xGFkcRNw5Ry\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, a closing balance, and transaction details. It also references a card type (American Express Business Platinum Card) and includes a payment received entry.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a31,081.76\",\\n        \"statement_period\": \"From 27 May to 26 June 2024\"\\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=1764140605, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=205, prompt_tokens=1216, total_tokens=1421, 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=[{\u0027prompt_index\u0027: 0, \u0027content_fi"
            },
            "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,
              "outstanding_balance": "\u00a31,081.76",
              "seller_name": null,
              "statement_period": "From 27 May to 26 June 2024",
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a credit card statement, such as a membership number, a spending limit, a payment due date, a statement period, a closing balance, and transaction details. It also references a card type (American Express Business Platinum Card) and includes a payment received entry.",
            "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, a closing balance, and transaction details. It also references a card type (American Express Business Platinum Card) and includes a payment received entry.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a31,081.76\",\n        \"statement_period\": \"From 27 May to 26 June 2024\"\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
            },
            "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 is a credit card statement as it includes a cardholder\u0027s name, card number (partially redacted), transaction details with dates, merchant names, amounts, and foreign transaction fees. It also includes payment instructions and a next statement date, which are typical features 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    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qgQfBR5iaAyqsghGHiR79liunX\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 is a credit card statement as it includes a cardholder\\\u0027s name, card number (partially redacted), transaction details with dates, merchant names, amounts, and foreign transaction fees. It also includes payment instructions and a next statement date, which are typical features 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    }\\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=1764140606, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=189, prompt_tokens=1629, total_tokens=1818, 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=[{\u0027prompt_index\u0027: 0, \u0027content_filter_results\u0027: {\u0027hate\u0027:"
            },
            "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,
              "outstanding_balance": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document is a credit card statement as it includes a cardholder\u0027s name, card number (partially redacted), transaction details with dates, merchant names, amounts, and foreign transaction fees. It also includes payment instructions and a next statement date, which are typical features of a credit card statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is a credit card statement as it includes a cardholder\u0027s name, card number (partially redacted), transaction details with dates, merchant names, amounts, and foreign transaction fees. It also includes payment instructions and a next statement date, which are typical features 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    }\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
            },
            "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 terms like \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 \u0027Next Statement Date,\u0027 and transaction details such as \u0027Transaction Date,\u0027 \u0027Transaction Details,\u0027 and amounts. Additionally, the document mentions a specific card type (American Express Business Platinum Card) and includes a cardholder\u0027s name and membership number, which are typical of credit card statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"26/06/24 to 26/07/24\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qiiMS9QVNdTnIl4VlHkQN5rSk3\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 terms like \\\u0027Statement of Account,\\\u0027 \\\u0027Membership Number,\\\u0027 \\\u0027Next Statement Date,\\\u0027 and transaction details such as \\\u0027Transaction Date,\\\u0027 \\\u0027Transaction Details,\\\u0027 and amounts. Additionally, the document mentions a specific card type (American Express Business Platinum Card) and includes a cardholder\\\u0027s name and membership number, which are typical of credit card statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": \"26/06/24 to 26/07/24\"\\n    }\\n}\\n```\u0027, refusal=None, role=\u0027assistant\u0027, annotations=[], audio=None, function_call=None, tool_calls=None), content_filter_results={\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027protected_material_code\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027protected_material_text\u0027: {\u0027filtered\u0027: False, \u0027detected\u0027: False}, \u0027self_harm\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027sexual\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}, \u0027violence\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027: \u0027safe\u0027}})], created=1764140608, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=220, prompt_tokens=869, total_tokens=1089, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), promp"
            },
            "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,
              "outstanding_balance": null,
              "seller_name": null,
              "statement_period": "26/06/24 to 26/07/24",
              "total_amount": null
            },
            "llm_reasoning": "The document contains references to a credit card statement, including terms like \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 \u0027Next Statement Date,\u0027 and transaction details such as \u0027Transaction Date,\u0027 \u0027Transaction Details,\u0027 and amounts. Additionally, the document mentions a specific card type (American Express Business Platinum Card) and includes a cardholder\u0027s name and membership number, 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 references to a credit card statement, including terms like \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 \u0027Next Statement Date,\u0027 and transaction details such as \u0027Transaction Date,\u0027 \u0027Transaction Details,\u0027 and amounts. Additionally, the document mentions a specific card type (American Express Business Platinum Card) and includes a cardholder\u0027s name and membership number, which are typical of credit card statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": \"26/06/24 to 26/07/24\"\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
            },
            "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, 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.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\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    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qkLZ6gd8fknlcLg1EfEMne0Qrw\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, 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.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\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    }\\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=1764140610, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=197, prompt_tokens=1271, total_tokens=1468, 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=[{\u0027prompt_index\u0027: 0, \u0027content_filter_results\u0027: {\u0027hat"
            },
            "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,
              "outstanding_balance": 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, 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.",
            "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, 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.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\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    }\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
            },
            "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 is a statement for an American Express Business Platinum Card, which is a credit card. Key indicators include \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 \u0027Next Statement Date,\u0027 and references to managing the card account online. There are no mentions of bank transactions, invoices, payroll, hire purchase agreements, loans, or financial statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qlWF1KnHI3ir6ssz5NL2cy9taJ\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 is a statement for an American Express Business Platinum Card, which is a credit card. Key indicators include \\\u0027Statement of Account,\\\u0027 \\\u0027Membership Number,\\\u0027 \\\u0027Next Statement Date,\\\u0027 and references to managing the card account online. There are no mentions of bank transactions, invoices, payroll, hire purchase agreements, loans, or financial statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null\\n    }\\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=1764140611, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=196, prompt_tokens=914, total_tokens=1110, 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=[{\u0027p"
            },
            "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,
              "outstanding_balance": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document is a statement for an American Express Business Platinum Card, which is a credit card. Key indicators include \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 \u0027Next Statement Date,\u0027 and references to managing the card account online. There are no mentions of bank transactions, invoices, payroll, hire purchase agreements, loans, or financial statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"credit_card\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is a statement for an American Express Business Platinum Card, which is a credit card. Key indicators include \u0027Statement of Account,\u0027 \u0027Membership Number,\u0027 \u0027Next Statement Date,\u0027 and references to managing the card account online. There are no mentions of bank transactions, invoices, payroll, hire purchase agreements, loans, or financial statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\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
            },
            "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 characteristic 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\": \"54,256.58\",\n        \"monthly_payment\": \"1,760.08\",\n        \"loan_tenure\": \"36 months\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qnhiO0FNCc5cct6L7cHxIjhcWK\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 characteristic 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\": \"54,256.58\",\\n        \"monthly_payment\": \"1,760.08\",\\n        \"loan_tenure\": \"36 months\",\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": 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=1764140613, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=190, prompt_tokens=1484, total_tokens=1674, 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=[{\u0027prompt_index\u0027: 0, \u0027content_filter_results\u0027: {\u0027hate\u0027: {\u0027filtered\u0027: False, \u0027severity\u0027"
            },
            "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 months",
              "monthly_payment": "1,760.08",
              "outstanding_balance": 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 characteristic of a hire purchase agreement.",
            "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 characteristic 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\": \"54,256.58\",\n        \"monthly_payment\": \"1,760.08\",\n        \"loan_tenure\": \"36 months\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": 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
            },
            "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 key indicators of a hire purchase agreement, such as references to \u0027Agreement\u0027, \u0027finance\u0027, \u0027Supplier\u0027, \u0027Equipment\u0027, and \u0027settlement amount\u0027. Additionally, it includes terms like \u0027amount financed\u0027, \u0027declaration for exemption\u0027, and references to the Financial Services and Markets Act, which are typical of hire purchase or finance agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qo25GKJhNWPl2swItqb3bKLphW\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \\\u0027Agreement\\\u0027, \\\u0027finance\\\u0027, \\\u0027Supplier\\\u0027, \\\u0027Equipment\\\u0027, and \\\u0027settlement amount\\\u0027. Additionally, it includes terms like \\\u0027amount financed\\\u0027, \\\u0027declaration for exemption\\\u0027, and references to the Financial Services and Markets Act, which are typical of hire purchase or finance agreements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": 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=1764140614, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=199, prompt_tokens=1355, total_tokens=1554, 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_re"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "outstanding_balance": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a hire purchase agreement, such as references to \u0027Agreement\u0027, \u0027finance\u0027, \u0027Supplier\u0027, \u0027Equipment\u0027, and \u0027settlement amount\u0027. Additionally, it includes terms like \u0027amount financed\u0027, \u0027declaration for exemption\u0027, and references to the Financial Services and Markets Act, which are typical of hire purchase or finance agreements.",
            "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027Agreement\u0027, \u0027finance\u0027, \u0027Supplier\u0027, \u0027Equipment\u0027, and \u0027settlement amount\u0027. Additionally, it includes terms like \u0027amount financed\u0027, \u0027declaration for exemption\u0027, and references to the Financial Services and Markets Act, which are typical of hire purchase or finance agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": 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
            },
            "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. Additionally, the document outlines terms for equipment delivery, maintenance, and payment schedules, which are typical of HP agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": \"not explicitly mentioned in the text\",\n        \"amount_financed\": \"not explicitly mentioned in the text\",\n        \"monthly_payment\": \"not explicitly mentioned in the text\",\n        \"loan_tenure\": \"not explicitly mentioned in the text\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"5% above Finance House Base Rate\",\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qqXFhKwjvR4j8NJsXKrrQzUzJT\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. Additionally, the document outlines terms for equipment delivery, maintenance, and payment schedules, which are typical of HP agreements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": \"not explicitly mentioned in the text\",\\n        \"amount_financed\": \"not explicitly mentioned in the text\",\\n        \"monthly_payment\": \"not explicitly mentioned in the text\",\\n        \"loan_tenure\": \"not explicitly mentioned in the text\",\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": \"5% above Finance House Base Rate\",\\n        \"outstanding_balance\": null,\\n        \"statement_period\": 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=1764140616, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=238, prompt_tokens=1407, total_tokens=1645, completion_tokens_details=Compl"
            },
            "document_identifiers": {
              "agreement_date": "not explicitly mentioned in the text",
              "amount_financed": "not explicitly mentioned in the text",
              "annual_interest_rate": "5% above Finance House Base Rate",
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": "not explicitly mentioned in the text",
              "monthly_payment": "not explicitly mentioned in the text",
              "outstanding_balance": 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. Additionally, the document outlines terms for equipment delivery, maintenance, and payment schedules, which are typical of HP 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. Additionally, the document outlines terms for equipment delivery, maintenance, and payment schedules, which are typical of HP agreements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": \"not explicitly mentioned in the text\",\n        \"amount_financed\": \"not explicitly mentioned in the text\",\n        \"monthly_payment\": \"not explicitly mentioned in the text\",\n        \"loan_tenure\": \"not explicitly mentioned in the text\",\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"5% above Finance House Base Rate\",\n        \"outstanding_balance\": null,\n        \"statement_period\": 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
            },
            "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 key indicators of a hire purchase agreement, such as references to \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and terms like \u0027hiring of the Equipment under this Agreement\u0027. These terms are specific to hire purchase or finance agreements, particularly for equipment or assets.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qs2oUTQEWQKzeh9jJs9lW3G0S8\u0027, choices=[Choice(finish_reason=\u0027stop\u0027, index=0, logprobs=None, message=ChatCompletionMessage(content=\u0027```json\\n{\\n    \"document_type\": \"hp_agreement\",\\n    \"confidence\": 0.95,\\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \\\u0027Equipment\\\u0027, \\\u0027Insurance monies\\\u0027, \\\u0027Total Loss\\\u0027, \\\u0027Rentals\\\u0027, and terms like \\\u0027hiring of the Equipment under this Agreement\\\u0027. These terms are specific to hire purchase or finance agreements, particularly for equipment or assets.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null, \\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": 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=1764140618, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=191, prompt_tokens=1425, total_tokens=1616, 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=[{\u0027prompt_index\u0027: 0, \u0027content_filter_results\u0027: {"
            },
            "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,
              "outstanding_balance": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a hire purchase agreement, such as references to \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and terms like \u0027hiring of the Equipment under this Agreement\u0027. These terms are specific to hire purchase or finance agreements, particularly for equipment or assets.",
            "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a hire purchase agreement, such as references to \u0027Equipment\u0027, \u0027Insurance monies\u0027, \u0027Total Loss\u0027, \u0027Rentals\u0027, and terms like \u0027hiring of the Equipment under this Agreement\u0027. These terms are specific to hire purchase or finance agreements, particularly for equipment or assets.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null, \n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": 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
            },
            "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 These are key indicators of a hire purchase agreement. Additionally, the document mentions terms like \u0027amounts payable,\u0027 \u0027commission,\u0027 and \u0027repossession,\u0027 which are commonly associated with 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    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qtgjF2w2wZQkBw7rP3ffuJ5nGr\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 These are key indicators of a hire purchase agreement. Additionally, the document mentions terms like \\\u0027amounts payable,\\\u0027 \\\u0027commission,\\\u0027 and \\\u0027repossession,\\\u0027 which are commonly associated with 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    }\\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=1764140619, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=216, prompt_tokens=1380, total_tokens=1596, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prom"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "outstanding_balance": 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 These are key indicators of a hire purchase agreement. Additionally, the document mentions terms like \u0027amounts payable,\u0027 \u0027commission,\u0027 and \u0027repossession,\u0027 which are commonly associated with hire purchase agreements.",
            "raw_response": "```json\n{\n    \"document_type\": \"hp_agreement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains multiple references to terms and conditions related to a hire purchase agreement, such as \u0027Option to Purchase,\u0027 \u0027Rentals,\u0027 \u0027Option to Purchase Fee,\u0027 \u0027hiring of the Equipment,\u0027 and \u0027termination of this Agreement.\u0027 These are key indicators of a hire purchase agreement. Additionally, the document mentions terms like \u0027amounts payable,\u0027 \u0027commission,\u0027 and \u0027repossession,\u0027 which are commonly associated with 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    }\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
            },
            "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 \u0027account,\u0027 \u0027debts,\u0027 \u0027financial history,\u0027 and \u0027CRAs (Credit Reference Agencies).\u0027 It also discusses the processing of applications, account management, and debt recovery, which are indicative of a loan statement. However, the document does not explicitly include numerical details like loan reference, interest rate, or outstanding balance, which slightly reduces confidence.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qvJzM6jEh2Ljq3esp513xin3l6\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 \\\u0027account,\\\u0027 \\\u0027debts,\\\u0027 \\\u0027financial history,\\\u0027 and \\\u0027CRAs (Credit Reference Agencies).\\\u0027 It also discusses the processing of applications, account management, and debt recovery, which are indicative of a loan statement. However, the document does not explicitly include numerical details like loan reference, interest rate, or outstanding balance, which slightly reduces confidence.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": null,\\n        \"statement_period\": null\\n    }\\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=1764140621, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=212, prompt_tokens=1333, total_tokens=1545, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), p"
            },
            "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,
              "outstanding_balance": null,
              "seller_name": null,
              "statement_period": null,
              "total_amount": null
            },
            "llm_reasoning": "The document contains references to loan-related terms such as \u0027creditworthiness,\u0027 \u0027account,\u0027 \u0027debts,\u0027 \u0027financial history,\u0027 and \u0027CRAs (Credit Reference Agencies).\u0027 It also discusses the processing of applications, account management, and debt recovery, which are indicative of a loan statement. However, the document does not explicitly include numerical details like loan reference, interest rate, or outstanding balance, which slightly reduces confidence.",
            "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 \u0027account,\u0027 \u0027debts,\u0027 \u0027financial history,\u0027 and \u0027CRAs (Credit Reference Agencies).\u0027 It also discusses the processing of applications, account management, and debt recovery, which are indicative of a loan statement. However, the document does not explicitly include numerical details like loan reference, interest rate, or outstanding balance, which slightly reduces confidence.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": null,\n        \"statement_period\": null\n    }\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
            },
            "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.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 \u0027mortgage account number\u0027, \u0027annual mortgage statement\u0027, \u0027interest-only mortgage\u0027, \u0027original amount borrowed\u0027, \u0027current interest rate\u0027, \u0027arrears balance\u0027, \u0027account balance\u0027, and \u0027cost to repay the loan\u0027. These terms are specific to loan or mortgage account 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\": \"300 months (25 years)\",\n        \"loan_reference\": \"71019693\",\n        \"annual_interest_rate\": \"3.59%\",\n        \"outstanding_balance\": \"\u00a3268,984.99\",\n        \"statement_period\": \"1 October 2023 to 30 September 2024\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qxTwtzcxuQxe2eT39hEvk5FuKz\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 \\\u0027mortgage account number\\\u0027, \\\u0027annual mortgage statement\\\u0027, \\\u0027interest-only mortgage\\\u0027, \\\u0027original amount borrowed\\\u0027, \\\u0027current interest rate\\\u0027, \\\u0027arrears balance\\\u0027, \\\u0027account balance\\\u0027, and \\\u0027cost to repay the loan\\\u0027. These terms are specific to loan or mortgage account 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\": \"300 months (25 years)\",\\n        \"loan_reference\": \"71019693\",\\n        \"annual_interest_rate\": \"3.59%\",\\n        \"outstanding_balance\": \"\u00a3268,984.99\",\\n        \"statement_period\": \"1 October 2023 to 30 September 2024\"\\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=1764140623, 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=1277, total_tokens=1501, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(audio_t"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": "3.59%",
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": "71019693",
              "loan_tenure": "300 months (25 years)",
              "monthly_payment": null,
              "outstanding_balance": "\u00a3268,984.99",
              "seller_name": null,
              "statement_period": "1 October 2023 to 30 September 2024",
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a loan statement, such as \u0027mortgage account number\u0027, \u0027annual mortgage statement\u0027, \u0027interest-only mortgage\u0027, \u0027original amount borrowed\u0027, \u0027current interest rate\u0027, \u0027arrears balance\u0027, \u0027account balance\u0027, and \u0027cost to repay the loan\u0027. These terms are specific to loan or mortgage account statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as \u0027mortgage account number\u0027, \u0027annual mortgage statement\u0027, \u0027interest-only mortgage\u0027, \u0027original amount borrowed\u0027, \u0027current interest rate\u0027, \u0027arrears balance\u0027, \u0027account balance\u0027, and \u0027cost to repay the loan\u0027. These terms are specific to loan or mortgage account 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\": \"300 months (25 years)\",\n        \"loan_reference\": \"71019693\",\n        \"annual_interest_rate\": \"3.59%\",\n        \"outstanding_balance\": \"\u00a3268,984.99\",\n        \"statement_period\": \"1 October 2023 to 30 September 2024\"\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.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
            },
            "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": 12,
      "text_length": 2038
    },
    {
      "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 \u0027Annual Statement\u0027 and includes key indicators of a loan statement such as an account number, a statement period, a series of transactions (direct debits and interest charges), an outstanding balance, and references to instalments due. Additionally, the document mentions \u0027arrears balance\u0027 and \u0027interest charge,\u0027 which are typical of loan statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": \"71019693\",\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3268,999.95\",\n        \"statement_period\": \"1 October 2023 - 30 September 2024\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3qzzaUo4DNDNqv6vusXEMzWvas2\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 \\\u0027Annual Statement\\\u0027 and includes key indicators of a loan statement such as an account number, a statement period, a series of transactions (direct debits and interest charges), an outstanding balance, and references to instalments due. Additionally, the document mentions \\\u0027arrears balance\\\u0027 and \\\u0027interest charge,\\\u0027 which are typical of loan statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": \"71019693\",\\n        \"annual_interest_rate\": null,\\n        \"outstanding_balance\": \"\u00a3268,999.95\",\\n        \"statement_period\": \"1 October 2023 - 30 September 2024\"\\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=1764140625, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=221, prompt_tokens=1556, total_tokens=1777, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails("
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": null,
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": "71019693",
              "loan_tenure": null,
              "monthly_payment": null,
              "outstanding_balance": "\u00a3268,999.95",
              "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 loan statement such as an account number, a statement period, a series of transactions (direct debits and interest charges), an outstanding balance, and references to instalments due. Additionally, the document mentions \u0027arrears balance\u0027 and \u0027interest charge,\u0027 which are typical of loan statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Annual Statement\u0027 and includes key indicators of a loan statement such as an account number, a statement period, a series of transactions (direct debits and interest charges), an outstanding balance, and references to instalments due. Additionally, the document mentions \u0027arrears balance\u0027 and \u0027interest charge,\u0027 which are typical of loan statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": \"71019693\",\n        \"annual_interest_rate\": null,\n        \"outstanding_balance\": \"\u00a3268,999.95\",\n        \"statement_period\": \"1 October 2023 - 30 September 2024\"\n    }\n}\n```"
          },
          "type": "loan_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
            },
            "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": "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 \u0027Direct debit\u0027, \u0027Interest charge\u0027, \u0027Instalment due\u0027, \u0027Closing balance\u0027, \u0027Outstanding balance\u0027, and \u0027Interest rate summary\u0027. Additionally, it mentions \u0027Your property may be repossessed if you don\u0027t keep up repayments on your mortgage\u0027, which is a common warning in loan or mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"3.59% a year\",\n        \"outstanding_balance\": \"\u00a3268,984.99\",\n        \"statement_period\": \"1 October 2023 to 30 September 2024\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3r0XPGkTJyKDUIySGqWzjddxncx\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 \\\u0027Direct debit\\\u0027, \\\u0027Interest charge\\\u0027, \\\u0027Instalment due\\\u0027, \\\u0027Closing balance\\\u0027, \\\u0027Outstanding balance\\\u0027, and \\\u0027Interest rate summary\\\u0027. Additionally, it mentions \\\u0027Your property may be repossessed if you don\\\u0027t keep up repayments on your mortgage\\\u0027, which is a common warning in loan or mortgage statements.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": null,\\n        \"annual_interest_rate\": \"3.59% a year\",\\n        \"outstanding_balance\": \"\u00a3268,984.99\",\\n        \"statement_period\": \"1 October 2023 to 30 September 2024\"\\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=1764140626, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=226, prompt_tokens=926, total_tokens=1152, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=PromptTokensDetails(au"
            },
            "document_identifiers": {
              "agreement_date": null,
              "amount_financed": null,
              "annual_interest_rate": "3.59% a year",
              "invoice_date": null,
              "invoice_number": null,
              "loan_reference": null,
              "loan_tenure": null,
              "monthly_payment": null,
              "outstanding_balance": "\u00a3268,984.99",
              "seller_name": null,
              "statement_period": "1 October 2023 to 30 September 2024",
              "total_amount": null
            },
            "llm_reasoning": "The document contains key indicators of a loan statement, such as \u0027Direct debit\u0027, \u0027Interest charge\u0027, \u0027Instalment due\u0027, \u0027Closing balance\u0027, \u0027Outstanding balance\u0027, and \u0027Interest rate summary\u0027. Additionally, it mentions \u0027Your property may be repossessed if you don\u0027t keep up repayments on your mortgage\u0027, which is a common warning in loan or mortgage statements.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document contains key indicators of a loan statement, such as \u0027Direct debit\u0027, \u0027Interest charge\u0027, \u0027Instalment due\u0027, \u0027Closing balance\u0027, \u0027Outstanding balance\u0027, and \u0027Interest rate summary\u0027. Additionally, it mentions \u0027Your property may be repossessed if you don\u0027t keep up repayments on your mortgage\u0027, which is a common warning in loan or mortgage statements.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": null,\n        \"annual_interest_rate\": \"3.59% a year\",\n        \"outstanding_balance\": \"\u00a3268,984.99\",\n        \"statement_period\": \"1 October 2023 to 30 September 2024\"\n    }\n}\n```"
          },
          "type": "loan_statement"
        },
        "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.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
            },
            "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": 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 a detailed list of transactions with balances. These are characteristic of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": \"23653883476995\",\n        \"annual_interest_rate\": \"2.500%\",\n        \"outstanding_balance\": \"14966.52 DR\",\n        \"statement_period\": \"10 August 2024 to 11 August 2025\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3r2zJDlFhtBMHUHx1pT8RXqZjn3\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 a detailed list of transactions with balances. These are characteristic of a loan statement.\",\\n    \"document_identifiers\": {\\n        \"invoice_number\": null,\\n        \"seller_name\": null,\\n        \"invoice_date\": null,\\n        \"total_amount\": null,\\n        \"agreement_date\": null,\\n        \"amount_financed\": null,\\n        \"monthly_payment\": null,\\n        \"loan_tenure\": null,\\n        \"loan_reference\": \"23653883476995\",\\n        \"annual_interest_rate\": \"2.500%\",\\n        \"outstanding_balance\": \"14966.52 DR\",\\n        \"statement_period\": \"10 August 2024 to 11 August 2025\"\\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=1764140628, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=209, prompt_tokens=1232, total_tokens=1441, 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=[{\u0027prompt_index\u0027: 0, "
            },
            "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,
              "outstanding_balance": "14966.52 DR",
              "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 a detailed list of transactions with balances. These are characteristic of a loan statement.",
            "raw_response": "```json\n{\n    \"document_type\": \"loan_statement\",\n    \"confidence\": 0.95,\n    \"reasoning\": \"The document is titled \u0027Loan 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 a detailed list of transactions with balances. These are characteristic of a loan statement.\",\n    \"document_identifiers\": {\n        \"invoice_number\": null,\n        \"seller_name\": null,\n        \"invoice_date\": null,\n        \"total_amount\": null,\n        \"agreement_date\": null,\n        \"amount_financed\": null,\n        \"monthly_payment\": null,\n        \"loan_tenure\": null,\n        \"loan_reference\": \"23653883476995\",\n        \"annual_interest_rate\": \"2.500%\",\n        \"outstanding_balance\": \"14966.52 DR\",\n        \"statement_period\": \"10 August 2024 to 11 August 2025\"\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
            },
            "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 in debit (DR), which is typical for loan repayment statements. 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 DR\",\n        \"statement_period\": \"17 Feb 2025 - 11 Aug 2025\"\n    }\n}\n```",
              "response_repr": "ChatCompletion(id=\u0027chatcmpl-Cg3r464Je53mqSeB97UR5y70iBHju\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 in debit (DR), which is typical for loan repayment statements. 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 DR\",\\n        \"statement_period\": \"17 Feb 2025 - 11 Aug 2025\"\\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=1764140630, model=\u0027gpt-4o-2024-11-20\u0027, object=\u0027chat.completion\u0027, service_tier=None, system_fingerprint=\u0027fp_b54fe76834\u0027, usage=CompletionUsage(completion_tokens=220, prompt_tokens=1206, total_tokens=1426, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=0, audio_tokens=0, reasoning_tokens=0, rejected_prediction_tokens=0), prompt_tokens_details=Promp"
            },
            "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,
              "outstanding_balance": "10833.49 DR",
              "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 in debit (DR), which is typical for loan repayment statements. 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 in debit (DR), which is typical for loan repayment statements. 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 DR\",\n        \"statement_period\": \"17 Feb 2025 - 11 Aug 2025\"\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
            },
            "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-26T07:03:51.230582"
}