Skip to main content

Sinapsis templates for bank/ERP reconciliation and LLM adjudication of fuzzy reference matches.

Project description



Sinapsis Bank Reconciliation

Sinapsis templates for bank/ERP reconciliation and LLM adjudication of fuzzy reference matches

🐍 Installation🚀 Templates📚 Usage🔍 License

This package provides the use-case-specific Sinapsis templates for reconciling a bank statement against an ERP/accounting export. It consumes the reference-match output produced upstream by a matching pipeline (e.g. sinapsis-polyfuzz's ExactMatch and pair matchers) and turns it into a settled, flagged reconciliation — escalating only the genuinely ambiguous fuzzy cases to an LLM adjudicator.

🐍 Installation

Install using your package manager of choice. We encourage the use of uv

Example with uv:

  uv pip install sinapsis-bank-reconciliation --extra-index-url https://pypi.sinapsis.tech

or with raw pip:

  pip install sinapsis-bank-reconciliation --extra-index-url https://pypi.sinapsis.tech

🚀 Templates

Template Purpose
BankReconciliation Groups rows by matched reference, compares amounts, and deterministically settles the clear-cut fuzzy cases via classify_identity, emitting reconciliation flags.
AdjudicationCaseBuilder Turns the residual needs_human fuzzy cases into prompts for an LLM judge that decides document identity.
AdjudicationResolver Resolves the final flags from the judge's verdicts (mirroring bank-side flags onto matched ERP rows).
ReconciliationSummaryTable Emits a condensed, human-readable summary table of the reconciled result.

📚 Usage

These templates are referenced by class_name in a Sinapsis agent config. See the bank-reconciliation demo in sinapsis-demos for end-to-end light/heavy pipelines that wire matching → reconciliation → adjudication.

Below is a minimal example wiring the four templates this package provides. The upstream CSV reading and reference matching come from other Sinapsis packages (sinapsis-data-readers and sinapsis-polyfuzz); the values are placeholders — adapt the sources, column names and the LLM template to your data.

agent:
  name: bank_reconciliation
  description: Reconcile a bank statement against an ERP export, escalating ambiguous fuzzy matches to an LLM judge.

templates:
  - template_name: InputTemplate
    class_name: InputTemplate
    attributes: {}

  # --- Upstream: read both sources, then produce exact + fuzzy reference matches ---
  - template_name: BankCSVReader
    class_name: CSVDatasetReader
    template_input: InputTemplate
    attributes:
      root_dir: "artifacts"
      path_to_csv: "sample_bank.csv"

  - template_name: ERPCSVReader
    class_name: CSVDatasetReader
    template_input: BankCSVReader
    attributes:
      root_dir: "artifacts"
      path_to_csv: "sample_erp.csv"

  - template_name: ExactMatcher
    class_name: ExactMatch
    template_input: ERPCSVReader
    attributes:
      from_source: "BankCSVReader_x_dataset"
      from_column: "Reference1"
      to_source: "ERPCSVReader_x_dataset"
      to_column: "Reference1"
      exact_matches_source: "exact_matches"
      no_exact_matches_source: "no_exact_matches"

  - template_name: FuzzyMatcher
    class_name: RapidFuzzPairWrapper
    template_input: ExactMatcher
    attributes:
      from_source: "no_exact_matches"
      from_column: "Reference1"
      to_source: "ERPCSVReader_x_dataset"
      to_column: "Reference1"
      matches_source: "fuzzy_matches"
      min_similarity: 0.8

  - template_name: Reconcile
    class_name: BankReconciliation
    template_input: FuzzyMatcher
    attributes:
      bank_source: "BankCSVReader_x_dataset"
      erp_source: "ERPCSVReader_x_dataset"
      bank_ref_col: "Reference1"
      bank_amount_col: "Amount"
      erp_ref_col: "Reference1"
      erp_debit_col: "Debits"
      erp_credit_col: "Credits"
      match_min_similarity: 1.0
      resolve_identity: true
      overwrite: true

  - template_name: CaseBuilder
    class_name: AdjudicationCaseBuilder
    template_input: Reconcile
    attributes:
      bank_source: "BankCSVReader_x_dataset"
      bank_ref_col: "Reference1"
      prompt_path: "artifacts/adjudication_prompt.txt"

  - template_name: Judge
    class_name: LLaMACPPTextCompletion
    template_input: CaseBuilder
    attributes:
      init_args:
        llm_model_name: bartowski/Qwen2.5-3B-Instruct-GGUF
        llm_model_file: Qwen2.5-3B-Instruct-Q4_K_M.gguf
      completion_args:
        temperature: 0.1
        response_format:
          type: json_object

  - template_name: Resolver
    class_name: AdjudicationResolver
    template_input: Judge
    attributes:
      bank_source: "BankCSVReader_x_dataset"
      erp_source: "ERPCSVReader_x_dataset"
      erp_ref_col: "Reference1"

  - template_name: SummaryTable
    class_name: ReconciliationSummaryTable
    template_input: Resolver
    attributes:
      bank_source: "BankCSVReader_x_dataset"
      bank_ref_col: "Reference1"
      summary_source: "reconciliation_summary"

🔍 License

This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.

For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sinapsis_bank_reconciliation-0.1.0.tar.gz (34.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sinapsis_bank_reconciliation-0.1.0-py3-none-any.whl (38.7 kB view details)

Uploaded Python 3

File details

Details for the file sinapsis_bank_reconciliation-0.1.0.tar.gz.

File metadata

File hashes

Hashes for sinapsis_bank_reconciliation-0.1.0.tar.gz
Algorithm Hash digest
SHA256 63b5d38abbe659cfbaf312601d08f68d1f6e8453530f0c62f4c053a7b415fed1
MD5 7f64e80e09106b5be5c89d0283c811d8
BLAKE2b-256 4aad662f53b48f6903a9cda9dd8cf83941b3aaaf5f8da214301fa30bf88ccfd7

See more details on using hashes here.

File details

Details for the file sinapsis_bank_reconciliation-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sinapsis_bank_reconciliation-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0eb3c334bc22a24e0276a96e5500878abaff9f71ee54840307257be689132a3
MD5 a21ba5c7dd5206d325a72ff5c12fee5e
BLAKE2b-256 a831e58af166a780a73dd53d40a2eb4d04d28704c98eb4b133ad8d4bb2eb0516

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page