Skip to main content

Unsure Python client

You can't optimize what you don't measure. Unsure runs structured classifications on Jev in a few hundred milliseconds, records confidence per field, queues uncertain answers for review, and replays new prompts against those corrections before they ship.

pip install unsure_client
from typing import Literal

from pydantic import BaseModel
from unsure_client import Unsure


class Triage(BaseModel):
    urgent: bool
    team: Literal["billing", "support", "sales"]


client = Unsure(api_key="YOUR_UNSURE_KEY")
decision = client.decide(
    prompt="I paid the invoice, but my account is still locked.",
    schema=Triage,
)
print(decision.output)

# Correct a field using its name as the keyword.
client.feedback(decision_id=decision.id, team="support")

# Replay an improved prompt against reviewed decisions in the same group.
group = client.group(decision.group_id)["group"]
run = client.prototype(
    decision.group_id,
    template=group["template"] + "\nPaid but locked out? Route to support.",
)
print(client.prototype_run(run["id"]))

No context manager is required. Reuse the client across calls and call client.close() when finished to release its connections. with Unsure(...) is also supported for automatic cleanup.

The default base URL is https://app.unsure.dev. For a local or self-hosted instance, pass base_url="http://localhost:5080".

Noul and Score describe additional Jev output types:

from typing import Annotated
from unsure_client import Noul, Score


class Review(BaseModel):
    needs_human: Noul
    severity: Annotated[float, Score("Low", "Medium", "High")]

For a saved pipeline, call client.run(pipeline="PIPELINE_ID", input={...}). Read the result from result["output"]; its decision_ids can be reviewed with client.feedback(...).

Requests raise httpx.HTTPStatusError for API errors, including HTTP 402 when credits are required. decision_id and note are reserved feedback metadata; pass nested corrections with **{"routing.team": "support"}. Each call corrects one field.

Python 3.12 or newer is required. See the API reference.

Metadata

Release files for unsure_client 0.1.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 unsure_client 0.1.0
File Size Uploaded
unsure_client-0.1.0.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for unsure_client 0.1.0
File Interpreter ABI Platform
unsure_client-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.6 kB

Release files / unsure_client-0.1.0.tar.gz

Download URL unsure_client-0.1.0.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
658995aed2e0762327e29af30022ec250e78d707362168cbd30c853dd072bdf0
BLAKE2b-256 checksum
How to use checksums
5c1af83590a99fe47aad4b438accdbec740213db9eedfd8920a55cc01ab838d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","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 / unsure_client-0.1.0-py3-none-any.whl

Download URL unsure_client-0.1.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8eb89e1b328f36179da939b04b62376f6434273d03cbf57ea47f6f8021a82c25
BLAKE2b-256 checksum
How to use checksums
1f0cd1529bbbdf0f50346a6d9ddefba39095506c85c473414714b6d585f5792a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","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 history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.0 This release

2 release 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