Metadata-Version: 2.5
Name: uprelic
Version: 0.1.0
Summary: Python client for the Uprelic API
Project-URL: Documentation, https://api.uprelic.com/v1/docs
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2
Description-Content-Type: text/markdown

# Uprelic Python SDK

```sh
pip install uprelic
```

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

```python
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
```

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

## Async

```python
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
