Skip to main content

Lightweight LLM-as-judge evaluation CLI — score model outputs on 5 dimensions and compare runs (OpenAI / OpenRouter / Ollama)

Project description

OpenEval

PyPI Python License: MIT

A lightweight LLM-as-judge evaluation tool. It takes a dataset of question/answer pairs, has a strong "judge" model score each answer across 5 dimensions, and compares two runs to show the before/after delta. Works with OpenAI, OpenRouter, or a local Ollama model.

Install

pip install openeval-llm

The distribution name is openeval-llm; the import and command name is openeval.

Quickstart (CLI)

Score a JSONL dataset — one {"question", "answer", "context"} object per line:

# With a local Ollama judge (free, private)
openeval run cases.jsonl --judge-provider ollama --judge-model llama3.2

# ...or OpenAI / OpenRouter (put the API key in .env)
openeval run cases.jsonl --judge-provider openai --judge-model gpt-4o-mini

Output — per-dimension averages, token/cost/latency, and provenance (judge, dataset, timestamp):

       Results — cases
┏━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Dimension     ┃ Avg Score     ┃
┡━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ faithfulness  │ 0.73          │
│ relevance     │ 0.93          │
│ overall       │ 0.85          │
└───────────────┴───────────────┘

Before / after comparison

Run the same system two ways (e.g. a feature on vs off), then compare:

openeval compare reports/report_before.json reports/report_after.json
Dimension     before  after    Δ
faithfulness  0.71    0.88   +0.17
overall       0.70    0.85   +0.15

The 5 dimensions

Dimension Measures Weight
faithfulness Is the answer factually correct? 0.30
relevance Does it address the question? 0.30
clarity Is it clear and well-explained? 0.20
safety Is it safe / non-harmful? 0.10
consistency Is it internally consistent? 0.10

overall is the weighted average — faithfulness and relevance dominate.

Python API

from openeval.connectors.ollama_connector import OllamaConnector
from openeval.dataset import load_cases
from openeval.eval.evaluator import Evaluator

cases = load_cases("cases.jsonl")
evaluator = Evaluator(judge_connector=OllamaConnector(model="llama3.2"))
report = evaluator.run(cases)
print(report.avg_overall)

Highlights

  • Crash-proof judge: survives when the judge wraps its answer in ```json fences, adds preamble, or omits a dimension (JSON extraction + neutral defaults + retry on transient errors).
  • Judge ≠ subject: pick a judge stronger than the system that produced the answers; OpenEval scores pre-generated answers, so it never runs the subject.
  • Provenance in every report: judge model, dataset, and timestamp are recorded for reproducibility.
  • Local = free: Ollama models are billed at $0.

Ollama setup

brew install ollama      # macOS
ollama pull llama3.2
ollama serve

Dashboard (optional)

streamlit run openeval/report/dashboard.py

Project layout

openeval/
├── connectors/    # model providers (OpenAI / OpenRouter / Ollama)
├── dataset.py     # JSONL loader
├── eval/          # main evaluation flow (Evaluator)
├── judge/         # the scoring LLM-judge logic
├── compare.py     # before/after comparison
├── cli.py         # `openeval run` / `openeval compare`
├── observability/ # logging, token/cost/latency, optional Langfuse
└── report/        # report helpers + Streamlit dashboard

See docs/ARCHITECTURE.md for a deeper walkthrough.

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openeval_llm-0.1.0.tar.gz (141.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openeval_llm-0.1.0-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file openeval_llm-0.1.0.tar.gz.

File metadata

  • Download URL: openeval_llm-0.1.0.tar.gz
  • Upload date:
  • Size: 141.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openeval_llm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 669607faf92551e11d88aed5aed3b1376adfb8eaa668da1a59a3cdaec3326785
MD5 376f76cf23cfac287645548d1b2456d4
BLAKE2b-256 08ce4263e9073f949fe4619b657854b62016f1d058dff17c20267400ecb7c38e

See more details on using hashes here.

Provenance

The following attestation bundles were made for openeval_llm-0.1.0.tar.gz:

Publisher: publish.yml on EceDalpolat/openeval

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openeval_llm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: openeval_llm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openeval_llm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 154c919d00927fae7f2eeab270178233c64ba8dc6fbb4f7eeb936309b80fa95c
MD5 a5f59b8299840d5ff1329fba784d049a
BLAKE2b-256 7d0a1ccb44c46ba030fa03811d758a00bd27e4b02fb24042193e4348dfd8f382

See more details on using hashes here.

Provenance

The following attestation bundles were made for openeval_llm-0.1.0-py3-none-any.whl:

Publisher: publish.yml on EceDalpolat/openeval

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page