Skip to main content

fuzzy-jev for Python

Python bindings for fuzzy-jev: ask OpenRouter's decision models, TypeSafe's Jev by default, typed questions about text or images, and get probabilities back — a Choice between named options, a Score on an ordered scale, or a Noul, the probability that something is true. Rules then combine those answers by fuzzy logic into decisions and amounts, and draw themselves as SVG.

The package is fuzzy-jev; it is imported as jev. It is the Rust library underneath, so a question, a reply and a rules file mean exactly what they mean to the jev command.

Install

pip install fuzzy-jev

Wheels are built for Linux and macOS (x86_64 and arm64), for CPython 3.10 and later. Anywhere else pip builds from source, which needs a Rust toolchain. From a checkout of this repository:

pip install ./python          # or: uv pip install ./python

For development, maturin develop builds it into the active virtual environment.

Ask

import jev

client = jev.Client()  # the key from OPENROUTER_API_KEY; or jev.Client("sk-or-...")
reply = client.decide(
    "Help! My payouts have been failing for 3 days.",
    {
        "is_urgent": jev.Question.noul(
            "Does this message convey urgency?", yes="Explicitly time-sensitive", no="No urgency expressed"
        ),
        "department": jev.Question.choice(
            "Which team should handle this?",
            {"billing": "Payments, invoicing, refunds", "technical": "Bugs, outages, integrations", "sales": "Pricing"},
        ),
        "frustration": jev.Question.score("How frustrated is the customer?", ["Calm", "Frustrated", "Very angry"]),
    },
)

reply.noul("is_urgent")                  # 0.95
department = reply.choice("department")  # ChoiceAnswer: .choice, .confidence, .probabilities
reply.score("frustration").score         # 1.04, between levels 1 and 2
print(reply.render("table"))             # as `jev --table` prints it
reply.usage.cost                         # in US dollars

The state can be a string, a dict or a list; instructions and criteria can be any JSON value too. Questions are a dict of id to Question, or (id, question) pairs; a question can also be a dict in the endpoint's shape ({"type": "noul", "instructions": ...}), and jev.load_questions(text) reads a jev -q questions file.

decide releases the GIL while it waits, so threads ask in parallel; await client.decide_async(...) is the same for asyncio. client.request(state, questions) is the request body decide would send, without sending it.

Errors are all jev.JevError: StatusError (with .status), HttpError, DecodeError, InvalidQuestionError (raised before any call), MissingAnswerError, WrongTypeError, BadAnswerError, NumericalError and RulesError.

Rules

questions = jev.load_questions(open("examples/rules/triage.json").read())
rules = jev.Rules(open("examples/rules/triage.toml").read(), questions)  # checked now, before a call

reply = client.decide(ticket, questions)
outcome = rules.evaluate(reply)
outcome.yes                              # ["page on-call", ...]: the items at or over the threshold
outcome["reply_within"].value            # an output's crisp value, in hours here
print(outcome.text())

open("triage.svg", "w").write(rules.graph_svg(reply))

See docs/rules.md for the whole of the rules file.

More

The whole guide: questions, the reply, rules, drawings, errors, threads and asyncio, and releasing.

Tests

maturin develop && pytest

Metadata

Release files for fuzzy-jev 0.7.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 fuzzy-jev 0.7.0
File Size Uploaded Provenance Actions
fuzzy_jev-0.7.0.tar.gz 233.5 kB With provenance Details for fuzzy_jev-0.7.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for fuzzy-jev 0.7.0
File Actions
fuzzy_jev-0.7.0-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for fuzzy_jev-0.7.0-cp310-abi3-manylinux_2_28_x86_64.whl
fuzzy_jev-0.7.0-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for fuzzy_jev-0.7.0-cp310-abi3-manylinux_2_28_aarch64.whl
fuzzy_jev-0.7.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for fuzzy_jev-0.7.0-cp310-abi3-macosx_11_0_arm64.whl
fuzzy_jev-0.7.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for fuzzy_jev-0.7.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 12.2 MB

Release files / fuzzy_jev-0.7.0.tar.gz

Download URL fuzzy_jev-0.7.0.tar.gz
Size 233.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a41c7e500c95e08c815106f7c54c0cda9c829c85b68919bf36692745ef0ce3b7
BLAKE2b-256 checksum
How to use checksums
82dca942d4fccdf7d35cbe2ca417440a578bc8a86e5b3e80d36a059f43ef29b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / fuzzy_jev-0.7.0-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL fuzzy_jev-0.7.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 3.2 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
33150c51be973c5b890d3f951aebe63eda654585fb2c17846ee66c29998e358a
BLAKE2b-256 checksum
How to use checksums
fbcd0697093a7b29f34fadcdb26731040cbc64232da5a35776b15e6aa1fad233
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / fuzzy_jev-0.7.0-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL fuzzy_jev-0.7.0-cp310-abi3-manylinux_2_28_aarch64.whl
Size 2.9 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
df33c82d0dd43a5f2d6e15cf0ad05b38b3663aae8430ae5c73a97c0bf77ff1b5
BLAKE2b-256 checksum
How to use checksums
1d82f4471f53da7a490b62bbf0ca42eed94ef13563cba0d244366e18e1e80da3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / fuzzy_jev-0.7.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL fuzzy_jev-0.7.0-cp310-abi3-macosx_11_0_arm64.whl
Size 2.9 MB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
74552c1b2203fdad766533af4a08353fe4cdeac24986e6332198559d0b5d890f
BLAKE2b-256 checksum
How to use checksums
4b54eb0041671d5d030557d39ccc54daf3447642bf1ae3ea4109df72d0f324d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / fuzzy_jev-0.7.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL fuzzy_jev-0.7.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 3.0 MB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
83cd4404fa5cc658f998cf9095ffb3e6ea62f1965853c866cfe050982358460c
BLAKE2b-256 checksum
How to use checksums
390792538a3ea3387c1af79afb788d78d0af07adb9dc02e315db49a702d6ebba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for fuzzy-jev 0.7.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.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for fuzzy_jev-0.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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