fuzzy-jev for Python
Python bindings for fuzzy-jev: ask TypeSafe's Jev typed questions about a piece of text through OpenRouter's decisions endpoint, 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 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
Release files for fuzzy-jev 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fuzzy_jev-0.3.1.tar.gz | 158.5 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| fuzzy_jev-0.3.1-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| fuzzy_jev-0.3.1-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| fuzzy_jev-0.3.1-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
| fuzzy_jev-0.3.1-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 11.8 MB
Release files / fuzzy_jev-0.3.1.tar.gz
| Download URL | fuzzy_jev-0.3.1.tar.gz |
|---|---|
| Size | 158.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eee2c2413ed25df8221960fb23bd04dc347ed97a02787ea52bbd92aaa2e57848
|
|
BLAKE2b-256 checksum How to use checksums |
9d5b176bb8bfbb84c2403f056d77808291b5a25f660057da9b3f53e71e85ab38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 24, 2026.
Transparency logRelease files / fuzzy_jev-0.3.1-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | fuzzy_jev-0.3.1-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.1 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4620645cdebc14ed886de7e892b5bf630f55321fd750a1fe199d6525ea555a62
|
|
BLAKE2b-256 checksum How to use checksums |
2f763a4bf5442e2ccccde7082dbffeb01f47927110edc6d2d0f2a048e24e0199
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 24, 2026.
Transparency logRelease files / fuzzy_jev-0.3.1-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | fuzzy_jev-0.3.1-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
3feca8e0fb13d5c50dd4dfd728875106eb55e31e46d901819f00cc9c8ccb1859
|
|
BLAKE2b-256 checksum How to use checksums |
201f02e195a926e184d11ee766c5f9b10d1527eee622bfc74d02d479bea15e80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 24, 2026.
Transparency logRelease files / fuzzy_jev-0.3.1-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | fuzzy_jev-0.3.1-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
362ad7647e76737b37054c45fc1ce1e7e84f1aecf282dac3e60b73219934afbe
|
|
BLAKE2b-256 checksum How to use checksums |
a4d300b081c684df3f6841eb8894b0de74907093a40ff13010c9c58de35f55dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 24, 2026.
Transparency logRelease files / fuzzy_jev-0.3.1-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | fuzzy_jev-0.3.1-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
4bc9573450c359682b40b2785d113db08e90624f1c59dd01c38a2fc8b58f4fa0
|
|
BLAKE2b-256 checksum How to use checksums |
b2d9c44e9424111f309ae4219138c63485d87f1cfdacf801bf21aca0e833afd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 24, 2026.
Transparency log