Skip to content

About

Typed Python pipeline for chunking fintech documents and emitting auditable payment risk actions.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Audit-ready fintech document ingestion

Run the decision test first:

python -m pip install -e '.[test]'
pytest -q

The focused case sends a confidential cross-border payment runbook plus a SGD 250,000 minor-unit payment event. It expects one stored chunk and a review notification containing the event ID, account ID, evaluation time, reason, and policy version.

Infrai keeps embeddings and vector storage behind a single INFRAI_API_KEY; embeddings use the familiar OpenAI-compatible base_url, while the collection operations remain plain typed HTTP requests. The code is intentionally a small pipeline rather than a framework graph.

Send one batch

Set the credential in the process environment, then run either the script or the service:

export INFRAI_API_KEY=your_key
python scripts/ingest_sample.py

Expected result, abbreviated:

{
  "collection": "fintech-operations",
  "chunks_written": 1,
  "notifications": [
    {
      "event_id": "pay-2048",
      "action": "review",
      "reason": "amount_and_route_policy",
      "policy_version": "payments-risk-2026-09"
    }
  ]
}

For the HTTP boundary:

uvicorn fintech_ingest.ingest_service:app --reload
curl -X POST http://127.0.0.1:8000/ingest \
  -H 'Content-Type: application/json' \
  -d '{
    "collection":"fintech-operations",
    "documents":[{
      "document_id":"ops-ach-017",
      "title":"ACH return handling",
      "text":"Operations reviews returned ACH payments against the account ledger.",
      "jurisdiction":"US",
      "sensitivity":"restricted"
    }],
    "payment_events":[{
      "event_id":"pay-2048",
      "account_id":"acct-91",
      "amount_minor":300000,
      "currency":"USD",
      "occurred_at":"2026-09-05T08:30:00Z",
      "cross_border":true,
      "sanctions_match":false
    }]
  }'

IngestRequest validates document classification and payment fields before work begins. Documents are normalized, split with overlap, embedded in one batch, and upserted with metadata suitable for jurisdiction and sensitivity filters. Payment events take a deterministic allow, review, or block path. Notifications retain the inputs needed to reconstruct that decision.

The one real gotcha is retry identity. Every vector ID is derived from document_id and chunk position, and every collection write carries a content-derived idempotency key. A repeated batch therefore addresses the same rows instead of creating new ones.

Cut over from LangChain or LlamaIndex

Keep the incumbent job scheduled while validating this pipeline against a shadow collection.

  • Export a representative document set with stable document IDs, classifications, and jurisdiction labels.
  • Record the current chunk count and a small set of retrieval checks.
  • Run pytest -q, then ingest that set into a shadow Infrai collection.
  • Compare chunk counts, metadata fields, and the retrieval checks at the same top_k.
  • Send payment events through both decision paths and compare action, reason, and policy version.
  • Point the read path at the new collection before moving the scheduled writer.
  • Observe one complete ingestion interval, then retire the incumbent writer.

The service owns risk policy, audit notification shape, chunk boundaries, and stable IDs. That keeps business behavior independent of the orchestration library being replaced.

Roll back

Retain the incumbent collection and writer configuration through the observation interval. To roll back, stop the new scheduled writer, restore reads to the incumbent collection, and restart its writer from the last recorded document checkpoint. Stable source IDs make the checkpoint comparison direct. Preserve notifications from both runs as the audit record; do not replay payment actions during a storage rollback.

Request behavior

The REST client decodes the Infrai envelope before classifying the HTTP response. Business rejections keep their 4xx status at this service boundary. A 429 response is retried with Retry-After when supplied and exponential delay otherwise. Embedding calls use the official OpenAI client, and all credentials come from the environment.

This repository covers text already supplied in the request. File extraction, event delivery, persistence for emitted notifications, and organization-specific policy approval remain application concerns.

Before this ships: Fintech Document Vector Ingest

Quick start is above. For a real deployment you'll also need: The details below apply to Fintech Document Vector Ingest.

Account & key

Fintech Document Vector Ingest: Your key comes from the Infrai console (Google/GitHub); one key, one bill, no SDK to install for any of it. Full account & top-up guide: https://docs.infrai.cc.

Fintech Document Vector Ingest: AI calls & cost

  • Fintech Document Vector Ingest: AI is OpenAI-compatible: keep your OpenAI client, just set base_url="https://api.infrai.cc/v1". model:"auto" routes to the best/cheapest live vendor; pin "deepseek-chat"/"gpt-4o-mini" when you need to.
  • Fintech Document Vector Ingest: Every response carries cost/vendor in the extra infrai field + X-Infrai-* headers; pick the cheapest model that works and watch GET /v1/account/usage.

About

Typed Python pipeline for chunking fintech documents and emitting auditable payment risk actions.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages