Metadata-Version: 2.4
Name: prosperus
Version: 0.1.0
Summary: Python SDK for Prosperus LLM Observability
Project-URL: Homepage, https://github.com/LatencyTDH/prosperus
Project-URL: Documentation, https://github.com/LatencyTDH/prosperus/tree/main/docs
Project-URL: Issues, https://github.com/LatencyTDH/prosperus/issues
Project-URL: Repository, https://github.com/LatencyTDH/prosperus
License-Expression: Apache-2.0
Keywords: agents,evaluations,llm,observability,tracing
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: httpx>=0.27
Description-Content-Type: text/markdown

# Prosperus Python SDK

Instrument your LLM applications with traces, spans, evaluations, and metrics.

Install with:

```bash
pip install prosperus
# or
uv add prosperus
```

The distribution name and the Python import package are both `prosperus`.

## Quick Start

```python
from prosperus import Prosperus, llm, workflow

ph = Prosperus(
    api_key="ph-...",
    app_name="my-chatbot",
    endpoint="http://localhost:4100",  # use your local server during development
)
ph.enable()

@workflow
def handle_request(user_msg: str) -> str:
    return call_model(user_msg)

@llm(model_name="gpt-5.4", model_provider="openai")
def call_model(prompt: str) -> str:
    reply = f"Echo: {prompt}"
    Prosperus.annotate(
        input_data=[{"role": "user", "content": prompt}],
        output_data=[{"role": "assistant", "content": reply}],
        metrics={"input_tokens": 5, "output_tokens": 7},
    )
    return reply

print(handle_request("Hello"))
ph.shutdown()
```

## Development

```bash
cd packages/sdk-python
uv sync
uv run pytest
uv run ruff check src/
uv run mypy src/
```

## Configuration

| Parameter | Type | Description |
|---|---|---|
| `api_key` | `str` | API key for authentication |
| `app_name` | `str` | Application identifier used to group traces |
| `endpoint` | `str` | Prosperus ingest endpoint. Defaults to `https://ingest.prosperus.dev` |
| `flush_interval` | `float` | Seconds between background flush attempts |
| `span_processor` | `Callable[[SpanData], SpanData \| None] \| None` | Optional processor for redaction or filtering before export |

## What You Can Import

The top-level package re-exports the most common SDK entry points:

```python
from prosperus import Prosperus, llm, workflow, tool, SpanKind, SpanContext
```
