Skip to main content

OpenJev Python SDK

openjev is an open Python client for OpenJev — a self-hostable decision engine that speaks the same System One /v1 wire protocol as the upstream TypeSafe AI API, so a single client works unchanged against:

  • a self-hosted OpenJev deployment (default base URL: http://localhost:8080)
  • the hosted TypeSafe AI API at https://api.typesafe.ai

This SDK is derived from @typesafe-ai/typesafe-sdk-python (MIT). See NOTICE for attribution. The request/response shapes (model + state + questions-as-dict) and the public class names (TypeSafeClient, AsyncTypeSafeClient, …) are kept identical so existing TypeSafe code is drop-in compatible.

Quickstart

Install the SDK:

Not yet published to PyPI (pending owner account auth). The plain PyPI name openjev belongs to an unrelated project — verified openjev-sdk and pyjev are taken too — so this package is distributed as openjev-client (the importable module stays openjev). Once published: pip install openjev-client. Until then, install from a clone:

git clone https://github.com/caelum0x/openjev
pip install ./openjev/sdk/python
# or: uv add ./openjev/sdk/python

Set OPENJEV_API_KEY (and optionally OPENJEV_BASE_URL) in your environment, then instantiate and use the client:

from openjev import Choice, TypeSafeClient

with TypeSafeClient() as client:
    response = client.system_one(
        state={"document": "I was charged twice. Please fix this ASAP."},
        questions={
            "category": Choice(
                instructions="What is this ticket about?",
                criteria={"billing": None, "technical": None, "other": None},
            ),
        },
    )

print(response.choices["category"].choice)

Configuration

Point the SDK at a self-hosted OpenJev endpoint or the upstream TypeSafe AI API by setting environment variables or passing arguments to the client constructor.

Purpose Primary (OpenJev) Back-compat alias (legacy)
API key OPENJEV_API_KEY TYPESAFE_API_KEY
Base URL OPENJEV_BASE_URL TYPESAFE_BASE_URL
Default model OPENJEV_DEFAULT_MODEL TYPESAFE_DEFAULT_MODEL
Log level OPENJEV_LOG_LEVEL TYPESAFE_LOG_LEVEL

The primary OPENJEV_* variable is checked first; the TYPESAFE_* alias is consulted only when the primary variable is absent so that callers already using TYPESAFE_* continue to work without changes.

Default base URL when no variable is set: http://localhost:8080.

Example — point at a self-hosted deployment:

export OPENJEV_BASE_URL="https://systemone.internal.example.com"
export OPENJEV_API_KEY="your-self-hosted-key"

Example — point at the upstream TypeSafe AI API using the back-compat alias:

export TYPESAFE_BASE_URL="https://api.typesafe.ai"
export TYPESAFE_API_KEY="ts_live_..."
from openjev import TypeSafeClient

# Explicit override also works and takes precedence over the environment:
client = TypeSafeClient(
    base_url="https://systemone.internal.example.com", api_key="..."
)

Trust layer (OpenJev servers)

from openjev import Choice, TypeSafeClient

with TypeSafeClient() as client:
    questions = {
        "intent": Choice(
            instructions="What does the customer want?",
            criteria={"refund": None, "status": None},
            abstain=True,
        )
    }
    result = client.system_one(
        "Where is my order?",
        questions,
        model="auto",                 # local first, LLM only for low-confidence questions
        calibration_id="cal_...",     # confidence fitted on your own labels
    )
    intent = result.choices["intent"]
    if intent.abstained:
        print("out of scope", intent.ood)

    # Shadow mode: compare with your production LLM or human labels.
    client.shadow.run(
        "Where is my order?",
        questions,
        incumbent={"kind": "label", "answers": {"intent": "status"}},
    )
    summary = client.shadow.summary(days=7)

License

MIT — see LICENSE and NOTICE.

Metadata

Release files for openjev-client 0.7.1

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

Source distribution (sdist)

Source distribution for openjev-client 0.7.1
File Size Uploaded Provenance Actions
openjev_client-0.7.1.tar.gz 30.8 kB Without provenance Details for openjev_client-0.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openjev-client 0.7.1
File Interpreter ABI Platform Actions
openjev_client-0.7.1-py3-none-any.whl Python 3 none any Details for openjev_client-0.7.1-py3-none-any.whl

Total release size: 78.0 kB

Release files / openjev_client-0.7.1.tar.gz

Download URL openjev_client-0.7.1.tar.gz
Size 30.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dfcf6cfb9b6e593228053a3985c8e9bccbd7d6b37210718b9316950844b83594
BLAKE2b-256 checksum
How to use checksums
b1d5ec073025209dcd9760b296a5dfa29d7a5ca4b1cc3495fe68883af493c54b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / openjev_client-0.7.1-py3-none-any.whl

Download URL openjev_client-0.7.1-py3-none-any.whl
Size 47.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
328a44e89a0fe9e06ea1848085603987005603c4b054098f79e0e3fb01ad22f7
BLAKE2b-256 checksum
How to use checksums
dce0fc659b5bd334e8f35ce0d9f9e8f30b075beda460d31faf1b5e8321fbd3c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for openjev-client 0.7.1

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.

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

Release history Release notifications | RSS feed

This release

0.7.1 This release

2 release files No provenance

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