Metadata-Version: 2.4
Name: ledgelm
Version: 0.2.0
Summary: Thin Python reporter for LedgeLM eval results
Requires-Python: >=3.10
Requires-Dist: httpx<1,>=0.27
Requires-Dist: pydantic<3,>=2.9
Description-Content-Type: text/markdown

# LedgeLM Python reporter

This package only reports eval results. It does not run evals or calculate
baselines; LedgeLM handles storage, comparison, and GitHub Checks server-side.

```python
from ledgelm import report, flush

report(
    name="response_grounding",
    type="judge",
    score=0.82,
    passed=True,
    cost=0.004,
	usage={
		"target": {"input_tokens": 812, "output_tokens": 146},
		"judge": {"input_tokens": 1042, "output_tokens": 87},
	},
    provenance={
        "test_case_id": "refund-42",
        "target": {"provider": "anthropic", "model": "claude-sonnet"},
        "dataset": {"name": "support-golden", "version": "2026-07"},
    },
    metadata={"rationale": "The answer cites the supplied policy."},
)

verdict = flush()
```

Set `LEDGELM_API_URL` and `LEDGELM_API_TOKEN` in GitHub Actions. Commit, PR,
branch, run, and workflow fields are detected from the GitHub Actions
environment. Pass `flush(api_url="https://your-tunnel.example")` (or the same
argument to `async_flush`) to override the environment for a local or alternate
deployment. Use `await async_flush()` in async programs.

Both flush variants upload batches in chunks. Transport, authentication, and
validation failures during upload emit a warning and return an `unknown`
verdict without removing buffered results, so LedgeLM availability cannot
break the eval job.

The Pydantic wire models in `src/ledgelm/_generated.py` are generated from the
same Zod-owned OpenAPI document as the TypeScript reporter. Regenerate them
from the repository root with `bun run schema:python`; do not edit that file by
hand.
