Skip to main content

Gil (Python — iyulab-gil)

Gil answers the decided attributes of a record from the records people have already settled, and chooses — by replaying them in the order they were settled — how far each answer can be trusted and how often a trusted one will be right.

This package binds its Rust decision core: replay settled records to choose how far each layer's answers for a schema attribute can be trusted, and get back the decision records the choice rests on.

pip install iyulab-gil
import gil

schema = gil.Schema.from_dict(
    {
        "name": "ticket",
        "attributes": [
            {"name": "product", "role": "observed"},
            {"name": "summary", "role": "observed"},
            {"name": "team", "role": "decided"},
        ],
    }
)
records = gil.read_records(
    "settled.jsonl"
)  # one JSON object per line, in settlement order
thresholds, decisions = gil.select_layers(
    schema, "team", records, target_precision=0.8
)
print(thresholds["key"]["chosen"], len(decisions))

Before choosing thresholds, narrow the attributes that key the decided attribute. An attribute that happened to settle with one value for a while would otherwise key every later record that shares it:

choice = gil.select_key_fields(schema, "team", records, target_precision=0.8, minimum_answered=30)
definition = {
    "name": "ticket",
    "attributes": [
        {"name": "product", "role": "observed"},
        {"name": "summary", "role": "observed"},
        {"name": "team", "role": "decided", "key_fields": choice["key_fields"]},
    ],
}
thresholds, decisions = gil.select_layers(
    gil.Schema.from_dict(definition), "team", records, target_precision=0.8
)

key_fields is None when no narrower set did better than every attribute — leave it unset then.

The other settings follow the same pattern — choose, then set on the attribute: select_key_concentrations (set as key_concentrations, after key_fields) and, for an attribute with a coarse level ("coarse": {"prefix": 2}), select_coarse once its value thresholds are set.

Answering a record while its values arrive

A decider holds the settled records; an open record asks it each time a value arrives or is settled, and hands back the answers that changed. Times are 100-nanosecond ticks since the Unix epoch, UTC.

decider = gil.Decider(schema, records)
record = gil.OpenRecord(schema, "t9", settled_at=now)
(team,) = record.observe(decider, "summary", "vpn drops every hour")
if team["answered"]:  # shown to the person, who keeps it
    record.settle(decider, "team", "Accept", now, value=team["candidates"][0]["value"])
else:  # nothing shown: the person types it
    record.settle(decider, "team", "Enter", now, value="network")
saved = record.snapshot()  # save it; gil.OpenRecord.reopen(schema, saved) picks it up again

Settle with the kind that says what the person saw: Accept / Correct for the answer shown, Enter with nothing shown, AcceptOther / CorrectOther when the suggestion shown was not the decider's (your own model's, a default), Fill when the application settled it with no person. Choosing thresholds and gil.usage read the kinds.

When an answer carries needs_external, no memory had evidence: ask your model about those (attribute, value) pairs and pass its ranked values back with record.offer_external(decider, "team", [{"value": ..., "probability": ..., "trusted": ...}]).

Keeping a tuning

gil.capture_tuning(schema, settled, target_precision) keeps the chosen settings (gil.record_promise adds what each layer replay promised), gil.apply_tuning puts them back on a schema, and gil.tuning_stale says when to choose again — another package version, a changed setting, or a tenth more (or fewer) settled records. gil.usage(decisions) counts, without content, how the answers shown were settled and the precision they realized against the promise.

Status: early. The API may change within 0.x — each change is listed in CHANGELOG.md with what to do about it.

Apache-2.0 — see LICENSE.

Metadata

Release files for iyulab-gil 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iyulab-gil 0.5.0
File Size Uploaded Provenance
iyulab_gil-0.5.0.tar.gz 86.9 kB Without provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for iyulab-gil 0.5.0
File
iyulab_gil-0.5.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details
iyulab_gil-0.5.0-cp311-abi3-musllinux_1_2_x86_64.whl CPython 3.11 abi3 Linux musl 1.2+ x86-64 Details
iyulab_gil-0.5.0-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details
iyulab_gil-0.5.0-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details
iyulab_gil-0.5.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details
iyulab_gil-0.5.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details

Total release size: 5.3 MB

Release files / iyulab_gil-0.5.0.tar.gz

Download URL iyulab_gil-0.5.0.tar.gz
Size 86.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a90edd92346f128a57747352fc9cd8dcd3a66db53ed1a0b057cc1c563c84aa1a
BLAKE2b-256 checksum
How to use checksums
c313b22e6825df221a302f5e98726b58d952b30d12d9a1f0c8e5ac60204c4cda
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / iyulab_gil-0.5.0-cp311-abi3-win_amd64.whl

Download URL iyulab_gil-0.5.0-cp311-abi3-win_amd64.whl
Size 713.0 kB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
13c5a5b61cc02d0686dd64d894ebe3aeae80fdf6233dfe74c40b1594c3f7493d
BLAKE2b-256 checksum
How to use checksums
568c53fe00220a2be43a20524542e0a17d8dd6654dc0e1cc712e0992422d55b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / iyulab_gil-0.5.0-cp311-abi3-musllinux_1_2_x86_64.whl

Download URL iyulab_gil-0.5.0-cp311-abi3-musllinux_1_2_x86_64.whl
Size 1.1 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
3efcccc4520da953ce53bd194a0b101f5333da1f61656b52d8e69c26110ec10b
BLAKE2b-256 checksum
How to use checksums
467bd21f5eb085089825f9a54931060c1236b9423fb39a579d77bb76ba3c163e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / iyulab_gil-0.5.0-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL iyulab_gil-0.5.0-cp311-abi3-manylinux_2_28_x86_64.whl
Size 890.4 kB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
8461e7f75bd2a08dad617701682435dd4430baf5adb691fb2112c0f1bddc4613
BLAKE2b-256 checksum
How to use checksums
1637bef74341c42d46325dbe91ab693f42c42d02d11e111dcb03db6468330676
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / iyulab_gil-0.5.0-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL iyulab_gil-0.5.0-cp311-abi3-manylinux_2_28_aarch64.whl
Size 848.6 kB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
178eecc5f00b7b9a001dd3704850a49733b111c0ab71eb2d9a3951ffdf70166a
BLAKE2b-256 checksum
How to use checksums
0701f811394017f5107c422dd5b3f541272cbe5a0a91bcf6fce6aa169eb68224
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / iyulab_gil-0.5.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL iyulab_gil-0.5.0-cp311-abi3-macosx_11_0_arm64.whl
Size 786.8 kB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d67d4ed50df1757b628a9447011eeeeff3616079b093551c8f6b158a9b1f5643
BLAKE2b-256 checksum
How to use checksums
65d7e6df3bd7ad7aec3f9ea180e75d06fcbea2f84de329fbccebc1b0cc11e7fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / iyulab_gil-0.5.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL iyulab_gil-0.5.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 832.9 kB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
84d4cbfa736a9cc5fa54b7b92bc102001aca6767452fd0331de75657af98d500
BLAKE2b-256 checksum
How to use checksums
45cb5fa973e6e60e7ea49f33f51e8d05bd8e88ed884701af23fab3e866e822e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for iyulab-gil 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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