Skip to main content

varga

Two questions about one document. guess_type answers the first from cue phrases and countable evidence, with no model unless two kinds tie. as_schema and structured answer the second against a shape you name or invent.

Install

uv add varga            # doctypes; no model, no network
uv add 'varga[llm]'     # ...and `structured`, which asks one

What is it

INVOICE = '''# INVOICE
Invoice No: ACM-2024-0117
Date: 2024-03-01
Bill to: Contoso GmbH, Berlin
From: Acme Supplies Ltd
Total due: 1,240.00 EUR
Payment terms: net 30
'''
r = guess_type(INVOICE)
r.doctype, r.decisive, round(r.margin, 2)
('invoice', True, 0.4)

decisive is the whole point: it says whether the cues settled it. When two kinds tie, margin is 0 and a caller knows to spend a model call. Nothing else here costs one.

signals(INVOICE).counts
{'money': 1, 'date': 1, 'ref': 1, 'heading': 1, 'org': 2}

What is in it

from dataclasses import fields
[f.name for f in fields(as_schema('invoice'))]
['number',
 'date',
 'due_date',
 'vendor',
 'vendor_tax_id',
 'bill_to',
 'ship_to',
 'currency',
 'subtotal',
 'tax',
 'total',
 'payment_terms',
 'items']

Ten shapes are built in: invoice, purchase_order, quote, receipt, catalogue, contract, resume, paper, meeting_notes, other. Or write one on the spot:

[(f.name, f.type.__name__) for f in fields(as_schema('vendor:str, total:float, items:list'))]
[('vendor', 'str'), ('total', 'float'), ('items', 'list')]

structured(chat, prompt, schema) fills it. It prefers the model’s constrained mode and falls back to a JSON reply when that raises, so a model without tool calling still answers.

The doctypes

len(DOCTYPES), sorted(DOCTYPES)

Ten of them are work-product labels: proposal, presentation, requirements_spec, technical_design, regulatory_guidance, procedure, qa_artifact, roadmap, claim, clinical_record, and each is decisive on its own text without a model. Prose that merely borrows the vocabulary scores under 0.2 against every one of them.

What it depends on

fastcore and rahasya, for the honorific-anchored name regex the entity leg shares with the privacy gate. One definition of what a name is.

rishi is needed only by structured. vruksha adds keyphrases to signals().ents and is display only: no doctype score reads them, and signals works without it.

Development

The notebooks in nbs/ are the source; the modules are generated.

pip install -e .
nbdev_prepare

Download files

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

Source Distribution

varga-0.0.4.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

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

varga-0.0.4-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file varga-0.0.4.tar.gz.

File metadata

  • Download URL: varga-0.0.4.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for varga-0.0.4.tar.gz
Algorithm Hash digest
SHA256 c571e6b0fe32ec8d64a64a9bd995a2ae812a491009dd13404a3caa7a50bcf446
MD5 3ffbef43bbbc3701497b3144656db164
BLAKE2b-256 7b9f6b6192bfbc36fde4fd062ba6d60a707f56bdf108a784da78f16be39d761f

See more details on using hashes here.

File details

Details for the file varga-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: varga-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for varga-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 390ba63b9edb03a1459ec978d7c6a3a5507ba5ee3e794282622816f56a7de7e0
MD5 d3bb6e02dcdba7b2d7f1f65d33c7d779
BLAKE2b-256 e6bec540d9e45bba8833f471bdaef4b6bb3a5d430915fda3d7ad6a7b86e17adb

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page