Metadata-Version: 2.5
Name: paretoeval
Version: 0.0.1
Summary: Cost-aware evaluation for LLM applications. Score quality per dollar, and fail the build when either regresses.
Project-URL: Homepage, https://github.com/EdidiongA/paretoeval
Project-URL: Issues, https://github.com/EdidiongA/paretoeval/issues
Author: Edidiong-Abasi Anwanane
License: Apache-2.0
License-File: LICENSE
Keywords: cost,evaluation,llm,mlops,observability,rag
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Requires-Dist: pyyaml>=6.0
Provides-Extra: api
Requires-Dist: tokencost>=0.1.20; extra == 'api'
Provides-Extra: dev
Requires-Dist: hypothesis>=6.100; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Provides-Extra: otel
Requires-Dist: opentelemetry-api>=1.25; extra == 'otel'
Requires-Dist: opentelemetry-sdk>=1.25; extra == 'otel'
Provides-Extra: plot
Requires-Dist: matplotlib>=3.8; extra == 'plot'
Description-Content-Type: text/markdown

# paretoeval

**Cost-aware evaluation for LLM applications. Score quality per dollar, and fail the build when either regresses.**

[![CI](https://github.com/EdidiongA/paretoeval/actions/workflows/ci.yml/badge.svg)](https://github.com/EdidiongA/paretoeval/actions)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)

---

## The problem

Your eval suite tells you the change improved faithfulness by 2%.

It does not tell you the change tripled your cost per query. You find that out in the next invoice.

Every LLM evaluation framework scores quality. Cost gets handled somewhere else — an ops dashboard, a monthly review, a spreadsheet. So the trade-off that actually decides which configuration ships is the one nobody measures at decision time.

## What paretoeval does

Treats cost as a first-class evaluation metric, with the same rigour applied to quality:

- **Cost attribution** across every stage of a pipeline — embedding, retrieval, reranking, generation, tool calls, and retries. *Retries count.* A pipeline that retries three times costs 4×, and nothing else surfaces that.
- **Quality-per-dollar metrics** — cost per correct answer, the cost/quality Pareto frontier, and the marginal cost of the next percentage point of quality.
- **Regression gates** as a pytest plugin, so a cost regression fails CI the same way a quality regression does.
- **Self-hosted cost modelling** — amortised GPU-hour economics for vLLM, Ollama and TGI deployments that have no per-token price list.

## What paretoeval is not

Not another eval framework. It composes with the stack you already run:

| Layer | Use |
|---|---|
| Quality metrics | Ragas, DeepEval |
| API pricing | [`tokencost`](https://github.com/AgentOps-AI/tokencost) |
| Backends | Langfuse, Arize Phoenix — via OpenTelemetry |

## The self-hosted problem

Commercial-API costing tools assume a published per-token price. Self-hosted deployments don't have one, so those tools report zero — silently understating the cost of the option teams usually choose *for cost reasons*.

paretoeval models it properly, including the factor almost everyone misses:

```python
from paretoeval import SelfHostedCostModel

m = SelfHostedCostModel(
    gpu_hourly_cost=2.00,
    num_gpus=1,
    measured_throughput_tps=1000.0,  # measured, not claimed
    utilisation=0.15,                # the endpoint is idle 85% of the time
)

m.cost_per_1k_tokens()               # 6.7x what a saturated benchmark suggests
m.breakeven_tokens_per_hour(3.00)    # throughput where self-hosting wins
```

Utilisation is the single most under-modelled factor in self-hosted economics. Teams benchmark a saturated endpoint, compare that number against an API list price, and reach the wrong conclusion.

## Reproducible pricing

Prices are dated, never hardcoded. Re-costing a trace from March uses March's prices.

```python
from paretoeval import PricingRegistry
from datetime import date

r = PricingRegistry.from_yaml("registry/pricing.yaml")
r.cost("provider/model", input_tokens=1_000_000, output_tokens=0, on=date(2026, 3, 15))
```

Unknown models raise. They never return zero — a silent zero corrupts every downstream metric invisibly.

## Status

Early. The pricing registry and self-hosted cost model are implemented and tested. Attribution, metrics, gates and OTel emission are in progress. See [ARCHITECTURE.md](ARCHITECTURE.md).

Issues and PRs welcome — especially pricing registry entries and throughput benchmarks from real deployments.

## Licence

Apache 2.0
