Skip to main content

Uprelic Python SDK

pip install uprelic

Set UPRELIC_API_KEY (create a key at https://platform.uprelic.com), or pass api_key= to the client.

from uprelic import Uprelic, Noul, Choice, Score

client = Uprelic()
response = client.system_one(
    model="strom-1.0.7",
    state="I was charged twice for my subscription. Please fix this today.",
    questions={
        "billing": Noul("Is this message about billing?"),
        "tone": Choice("What is the tone?", criteria={"angry": "Upset or hostile", "calm": "Neutral or polite"}),
        "urgency": Score("How urgent is this?", criteria=["Can wait", "This week", "Today"]),
    },
)

response.nouls["billing"].noul        # 0.98
response.choices["tone"].choice       # "angry"
response.scores["urgency"].score      # 1.8
response.usage.input_tokens
response.usage.cost                   # in response.usage.currency
response.metadata.server_processing_time_ms

Images go in images= as http(s) or data:image/... URLs. client.models() lists the available models.

Async

from uprelic import AsyncUprelic

async with AsyncUprelic() as client:
    response = await client.system_one(model="strom-1.0.7", state="...", questions={...})

Errors and retries

Failed requests raise uprelic.APIError subclasses: AuthenticationError (401), InsufficientBalanceError (402), InvalidRequestError (400, 422), RateLimitError (429) and ServerError (5xx). Each has status_code and detail.

Rate limits (429), 502/503/504 responses and connection failures are retried twice with backoff. Change this with Uprelic(max_retries=...).

API reference: https://api.uprelic.com/v1/docs

Metadata

Release files for uprelic 0.2.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 uprelic 0.2.0
File Size Uploaded Provenance Actions
uprelic-0.2.0.tar.gz 4.9 kB Without provenance Details for uprelic-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 10.0 kB

Release files / uprelic-0.2.0.tar.gz

Download URL uprelic-0.2.0.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
afe74fa0eb477b7941234fbef3ae6f858ddb822535d37cd5fbd4034381040de9
BLAKE2b-256 checksum
How to use checksums
7d520df582fe76a3e5a111efad99e88833112130d959b415d825860b640bc731
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / uprelic-0.2.0-py3-none-any.whl

Download URL uprelic-0.2.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dba485414986a9fc29c8551116d35f7ae5472956996320e2ada4c0b5d58ca8f2
BLAKE2b-256 checksum
How to use checksums
c307d7eba1f6c25e2d14f5b93458473663d91adf6583f2ee3cfb7a9a82261fa2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Security for uprelic 0.2.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.

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