Merge pull request 'Eval-Gerüst gegen aufgezeichnete Antworten' (#10) from 4-eval-harness into main
Reviewed-on: #10
This commit was merged in pull request #10.
This commit is contained in:
commit
2c55a0b749
28 files changed
+1056
-8
No files matched your search
@@ -8,13 +8,11 @@ color: yellow
|
||||
|
||||
# eval-runner
|
||||
|
||||
Das Eval-Kommando entsteht mit #4. Bis dahin meldest du nur, dass kein Eval-Kommando existiert (siehe `CLAUDE.md`), und hörst auf.
|
||||
|
||||
## Ablauf
|
||||
|
||||
1. Betroffene Eval-Sätze stehen im Auftrag.
|
||||
2. Führe das Eval-Kommando auf dem aktuellen Stand aus.
|
||||
3. Führe es auf dem Vergleichsstand (Basis-Branch) aus: `git worktree add <temporäres-verzeichnis> <basis-branch>`, danach `git worktree remove <temporäres-verzeichnis>`.
|
||||
2. Führe `uv run chemenu-eval evals/<satz>` auf dem aktuellen Stand aus (Exit 0 bestanden, 1 nicht bestanden, 2 Satz nicht ladbar oder Aufruf falsch).
|
||||
3. Führe das Kommando auf dem Vergleichsstand (Basis-Branch) aus: `git worktree add <temporäres-verzeichnis> <basis-branch>`, danach `git worktree remove <temporäres-verzeichnis>`.
|
||||
4. Nur aufgezeichnete Antworten. Keine Live-Modelle, keine API-Schlüssel.
|
||||
|
||||
## Bericht
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Checks every pull request against main: locked environment, ruff lint and
|
||||
# format, pyright (strict), pytest and the pre-commit hooks.
|
||||
# format, pyright (strict), pytest, the example eval set and the pre-commit
|
||||
# hooks.
|
||||
#
|
||||
# Triggered only by `pull_request`: no `push` (branches are checked once, in
|
||||
# their PR) and never `pull_request_target`, which would run with repository
|
||||
@@ -54,6 +55,9 @@ jobs:
|
||||
- name: Pytest
|
||||
run: uv run pytest
|
||||
|
||||
- name: Evals
|
||||
run: uv run chemenu-eval evals/example
|
||||
|
||||
- name: Pre-commit hooks
|
||||
run: |
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
|
||||
@@ -10,6 +10,7 @@ Begriffe: `docs/glossary.md`.
|
||||
* `src/chemenu/ports`: Schnittstellen (`Protocol`), hängt nur von domain ab.
|
||||
* `src/chemenu/application`: Anwendungsfälle, hängt nur von domain und ports ab.
|
||||
* `src/chemenu/adapters`: implementiert die Ports (Git, Dateisystem, DB, LLM, HTTP).
|
||||
* `src/chemenu/evals`: Eval-Gerüst neben den Schichten; darf domain und ports importieren, keine Schicht importiert es (ADR 0002). Sätze unter `evals/`.
|
||||
* `tests/`: pytest. `docs/`: Architektur, ADRs, Glossar.
|
||||
|
||||
Importe zeigen nach innen: application → ports → domain; adapters → ports, domain. domain importiert keine andere Schicht.
|
||||
@@ -25,10 +26,9 @@ uv run pre-commit run --all-files # alles wie in der CI
|
||||
uv run pre-commit install # einmal pro Checkout
|
||||
uv add <paket> # oder: uv add --dev <paket>
|
||||
uv lock --upgrade-package <paket> # Abkühlzeit 7 Tage gilt
|
||||
uv run chemenu-eval evals/<satz> # Eval-Satz gegen aufgezeichnete Antworten
|
||||
```
|
||||
|
||||
Evals folgen (#4).
|
||||
|
||||
## Arbeitsweise
|
||||
|
||||
* Ablauf: `/design #N` spezifiziert, `/build #N` baut. Implementierung läuft in Subagents (`.claude/agents/`); die Hauptsitzung prüft jeden Diff selbst, nicht nur den Bericht.
|
||||
|
||||
@@ -10,4 +10,8 @@ Bis dahin ist [#249](https://gitea.nehmer.net/torben/chemenu/issues/249) maßgeb
|
||||
* `application`: Anwendungsfälle, einer pro Job. Rechteprüfung und Transaktionsgrenzen liegen hier. Hängt nur von Domäne und Ports ab.
|
||||
* `adapters`: Implementierungen der Ports (Git, Dateisystem, Datenbank, LLM, HTTP). Instanz und Nutzer kommen als expliziter Kontext, nie als Modul-Global.
|
||||
|
||||
Neben den Schichten steht ein Werkzeug:
|
||||
|
||||
* `evals`: Eval-Gerüst, das Schritt-Prompts gegen Fälle und aufgezeichnete Antworten prüft (`uv run chemenu-eval <satz>`). Es darf `domain` und `ports` importieren. Keine Schicht importiert `evals`. Antworten kommen über das `Protocol` `ResponseSource`. Sätze liegen als YAML unter `evals/<satz>/`. Details: [ADR 0002](decisions/0002-eval-geruest.md).
|
||||
|
||||
Entscheidungen: [decisions/](decisions/)
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
status: accepted
|
||||
date: 2026-12-02
|
||||
---
|
||||
# Eval-Gerüst als eigenes Paket mit pydantic-Ausgabemodellen und YAML-Sätzen
|
||||
|
||||
## Kontext und Problemstellung
|
||||
|
||||
Schritt-Prompts brauchen eine Prüfung, die ohne LLM-Aufruf reproduzierbar läuft. Nach torben/chemenu#249 § (b) ist ein Fall eine Eingabe plus erwartete Eigenschaften der Ausgabe. Ein Bewerter vergibt Punkte, ein Schwellwert entscheidet. Harte Bewerter kommen zuerst.
|
||||
|
||||
Drei Fragen sind offen: Wo liegt das Gerüst? Wie wird das Ausgabeschema eines Schritts beschrieben und geprüft? In welchem Format liegen die Sätze? Auftrag: #4.
|
||||
|
||||
## Betrachtete Optionen
|
||||
|
||||
Lage:
|
||||
|
||||
1. Verteilung auf `domain`, `ports`, `application`, `adapters`.
|
||||
2. Eigenes Paket `src/chemenu/evals/` neben den Schichten.
|
||||
|
||||
Ausgabeschema:
|
||||
|
||||
1. JSON-Schema-Datei mit `jsonschema`.
|
||||
2. JSON Schema mit generierten pydantic-Klassen (`datamodel-code-generator`).
|
||||
3. Nur Standardbibliothek.
|
||||
4. pydantic-Modell als Quelle, JSON Schema daraus erzeugt.
|
||||
|
||||
Satz-Format:
|
||||
|
||||
1. TOML.
|
||||
2. JSON.
|
||||
3. YAML.
|
||||
|
||||
## Entscheidung
|
||||
|
||||
Lage: „Eigenes Paket `src/chemenu/evals/`“, weil Evals ein Prüfwerkzeug sind und kein Anwendungsfall des Dienstes. Die Domäne bleibt bei Seiten, Links und Herkunft. Das Paket darf `domain` und `ports` importieren. Keine Schicht importiert `evals`. Antworten kommen über ein eigenes `Protocol` `ResponseSource`. Live-Läufe hängen später einen Adapter am LLM-Port daran. Verworfen: Option 1. Sie prüft zwar die Schichten, gehört aber nicht dorthin.
|
||||
|
||||
Ausgabeschema: „pydantic-Modell als Quelle“. Geprüft wird mit `model_validate_json(raw, strict=True)` und `extra="forbid"`. Der lockere Modus macht aus `"1"` still eine 1 und verdeckt Modellfehler. Das JSON Schema für Provider entsteht mit `model_json_schema()`. Das ist eine Wahrheit, der Code bekommt getypte Objekte („Code führt“), und es passt zu torben/chemenu#249 § Backend (FastAPI, Pydantic). Ein Satz verweist per Importpfad auf das Modell (`output_model: "module:Class"`). Umbenennen bricht den Satz, die CI fängt das (Exit 2). Verworfen:
|
||||
|
||||
* Option 1: Der Code bekäme nur `dict[str, Any]`, eine zweite Wahrheit wäre nötig, mehr Abhängigkeiten, schwache Typen.
|
||||
* Option 2: Generierungsschritt, generierter Code im Repo.
|
||||
* Option 3: Die Validierung wäre halb nachgebaut.
|
||||
|
||||
Satz-Format: „YAML“. Aufbau:
|
||||
|
||||
* `evals/<satz>/eval.yaml`: `name`, `threshold`, `output_model`.
|
||||
* `evals/<satz>/cases/<id>.yaml`: `input`, `expect`.
|
||||
* `evals/<satz>/recorded/<id>.json`: Rohantwort des Modells unverändert. Parsen gehört zur Prüfung.
|
||||
|
||||
Gelesen wird mit einem `SafeLoader` von PyYAML, der nur die YAML-1.2-Booleans kennt (`true`, `false`); `yes`, `no`, `on`, `off` bleiben Strings. Konvention: Strings in Fällen immer in Anführungszeichen, weil sonst z. B. `1.10` zur Zahl 1.1 wird. pydantic strict fängt Typänderungen nur dort, wo ein Modell einen festen Typ verlangt; bei erwarteten Werten (beliebiges JSON) bleibt die Anführungs-Konvention nötig. YAML liest der Betreiber besser, kennt `null`, nimmt JSON als gültiges YAML, hat Blocktexte mit `|`, ist schreibbar (später automatisch erzeugte Fälle), und `check-yaml` läuft schon. Verworfen: TOML (kein `null`, nur lesbar mit `tomllib`), JSON (schlecht zu pflegen, keine Kommentare). `ruamel.yaml` bleibt eine spätere Option, falls Fälle mit Kommentar-Erhalt automatisch bearbeitet werden.
|
||||
|
||||
Bewerter und Punkte: Zunächst gibt es nur harte Bewerter, `equals` und `contains` an einem JSON-Pointer (RFC 6901). Die Punkte eines Falls sind der Anteil bestandener Prüfungen (0 bis 1). Fehlt die Antwort, ist sie kein JSON oder verletzt sie das Modell, gibt es 0 Punkte mit Grund. Der Schwellwert gilt je Satz, und jeder Fall muss ihn erreichen. Das Kommando ist `uv run chemenu-eval <satz>`. Exit 0 heißt bestanden, 1 nicht bestanden, 2 Satz nicht ladbar oder Aufruf falsch.
|
||||
|
||||
Neue Abhängigkeiten: `pydantic`, `pyyaml`; dev: `types-PyYAML`.
|
||||
|
||||
Bewusst offen: Lage der Schritt-Bausteine (§ (b)), Bewerter gegen Referenz, LLM als Richter, Baseline-Arm.
|
||||
|
||||
### Konsequenzen
|
||||
|
||||
* Gut, weil die Schichten frei von Prüfwerkzeug bleiben und die Importregel einfach ist.
|
||||
* Gut, weil das Ausgabemodell die einzige Wahrheit für Code, Prüfung und Provider-Schema ist.
|
||||
* Gut, weil strict Typfehler sichtbar macht und Sätze für den Betreiber lesbar sind.
|
||||
* Schlecht, weil `evals` eine Ausnahme neben den Schichten ist und die Importregel vorerst nur Konvention ist, ohne technische Prüfung.
|
||||
* Schlecht, weil zwei neue Laufzeitabhängigkeiten dazukommen.
|
||||
* Schlecht, weil YAML Typfallen hat (z. B. `1.10` → 1.1), die bei erwarteten Werten nur die Anführungs-Konvention abfängt; pydantic strict greift nur bei festen Typen.
|
||||
* Schlecht, weil Umbenennen eines Modells Sätze bricht.
|
||||
@@ -10,6 +10,7 @@ Feste Begriffspaare Deutsch–Englisch. In der Doku steht das deutsche Wort, im
|
||||
| Altstack | legacy stack | das eingefrorene Repo `torben/chemenu` |
|
||||
| Anwendungsfall | use case | eine Aufgabe, die der Dienst ausführt |
|
||||
| aufgezeichnete Antwort | recorded response | gespeicherte LLM-Antwort für reproduzierbare Tests |
|
||||
| Ausgabemodell | output model | pydantic-Modell, das die Ausgabe eines Schritts beschreibt und prüft |
|
||||
| Betreiber | operator | die Person, die den Dienst betreibt und PRs mergt |
|
||||
| Bewerter | grader | Prüfer, der eine Modellantwort bewertet |
|
||||
| Dienst | service | das laufende Chemenu |
|
||||
@@ -24,6 +25,7 @@ Feste Begriffspaare Deutsch–Englisch. In der Doku steht das deutsche Wort, im
|
||||
| Job | job | Arbeitsauftrag, den ein Anwendungsfall abarbeitet |
|
||||
| Port | port | Schnittstelle, die die Anwendung von außen braucht |
|
||||
| Prüfbefehl | verify command | Befehl, der zeigt, dass ein Issue erfüllt ist |
|
||||
| Prüfung | check | einzelne erwartete Eigenschaft eines Falls, bewertet von einem Bewerter |
|
||||
| Quelle | source | Ursprung von Inhalten |
|
||||
| Schicht | layer | Ebene der Architektur mit fester Abhängigkeitsrichtung |
|
||||
| Schritt | step | einzelner LLM-Aufruf in einem Ablauf |
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
input:
|
||||
text: "Heute ist ein schöner Tag."
|
||||
expect:
|
||||
- grader: "equals"
|
||||
path: "/entities"
|
||||
value: []
|
||||
@@ -0,0 +1,9 @@
|
||||
input:
|
||||
text: "Marie Curie wurde in Warschau geboren."
|
||||
expect:
|
||||
- grader: "equals"
|
||||
path: "/language"
|
||||
value: "de"
|
||||
- grader: "contains"
|
||||
path: "/entities"
|
||||
items: ["Marie Curie", "Warschau"]
|
||||
@@ -0,0 +1,11 @@
|
||||
input:
|
||||
text: |
|
||||
The European Space Agency launched
|
||||
a new satellite last week.
|
||||
expect:
|
||||
- grader: "equals"
|
||||
path: "/language"
|
||||
value: "en"
|
||||
- grader: "contains"
|
||||
path: "/entities"
|
||||
items: ["European Space Agency"]
|
||||
@@ -0,0 +1,3 @@
|
||||
name: "example"
|
||||
threshold: 1.0
|
||||
output_model: "chemenu.evals.example:ExampleOutput"
|
||||
@@ -0,0 +1 @@
|
||||
{"language": "de", "entities": []}
|
||||
@@ -0,0 +1 @@
|
||||
{"language": "de", "entities": ["Marie Curie", "Warschau"]}
|
||||
@@ -0,0 +1 @@
|
||||
{"language": "en", "entities": ["European Space Agency"]}
|
||||
+8
-1
@@ -5,7 +5,13 @@ description = "Chemenu as a service: code orchestrates, LLMs judge."
|
||||
requires-python = ">=3.14,<3.15"
|
||||
license = "AGPL-3.0-only"
|
||||
license-files = ["LICENSE"]
|
||||
dependencies = []
|
||||
dependencies = [
|
||||
"pydantic>=2.14.4",
|
||||
"pyyaml>=6.0.4",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
chemenu-eval = "chemenu.evals.cli:main"
|
||||
|
||||
[build-system]
|
||||
requires = ["uv_build>=0.13.7,<0.14"]
|
||||
@@ -21,6 +27,7 @@ dev = [
|
||||
"pyright>=1.1.390",
|
||||
"pre-commit>=4",
|
||||
"pre-commit-hooks>=5",
|
||||
"types-pyyaml>=6.0.12.20261122",
|
||||
]
|
||||
|
||||
[tool.uv]
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
"""Eval harness: scores recorded model responses against hard checks."""
|
||||
@@ -0,0 +1,28 @@
|
||||
"""Command line entry point: ``chemenu-eval <set>``."""
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from collections.abc import Sequence
|
||||
from pathlib import Path
|
||||
|
||||
from chemenu.evals.loader import EvalSetError, RecordedResponses, load_eval_set
|
||||
from chemenu.evals.runner import format_report, run_eval_set
|
||||
|
||||
|
||||
def main(argv: Sequence[str] | None = None) -> int:
|
||||
"""Exit code: 0 passed, 1 not passed, 2 set cannot be loaded or call is wrong."""
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="chemenu-eval",
|
||||
description="Score an eval set against its recorded responses.",
|
||||
)
|
||||
parser.add_argument("eval_set", help="directory of the eval set")
|
||||
args = parser.parse_args(argv)
|
||||
directory = Path(args.eval_set)
|
||||
try:
|
||||
eval_set = load_eval_set(directory)
|
||||
except EvalSetError as exc:
|
||||
print(f"chemenu-eval: {exc}", file=sys.stderr)
|
||||
return 2
|
||||
result = run_eval_set(eval_set, RecordedResponses(directory / "recorded"))
|
||||
print(format_report(result))
|
||||
return 0 if result.passed else 1
|
||||
@@ -0,0 +1,15 @@
|
||||
"""Example output model for the example set ``evals/example``.
|
||||
|
||||
This is a placeholder until real step building blocks exist.
|
||||
"""
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
class ExampleOutput(BaseModel):
|
||||
"""Example output model, not part of the real pipeline."""
|
||||
|
||||
model_config = ConfigDict(strict=True, extra="forbid", frozen=True)
|
||||
|
||||
language: str
|
||||
entities: list[str]
|
||||
@@ -0,0 +1,102 @@
|
||||
"""Hard graders: pure functions over JSON values."""
|
||||
|
||||
from pydantic import BaseModel, JsonValue, ValidationError
|
||||
|
||||
from chemenu.evals.model import (
|
||||
CaseResult,
|
||||
Check,
|
||||
CheckResult,
|
||||
ContainsCheck,
|
||||
EqualsCheck,
|
||||
EvalCase,
|
||||
)
|
||||
|
||||
|
||||
class PointerError(LookupError):
|
||||
"""A JSON Pointer does not resolve in the document."""
|
||||
|
||||
|
||||
def resolve_pointer(doc: JsonValue, pointer: str) -> JsonValue:
|
||||
"""Resolve an RFC 6901 JSON Pointer."""
|
||||
if pointer == "":
|
||||
return doc
|
||||
if not pointer.startswith("/"):
|
||||
raise PointerError(f"pointer must be empty or start with '/': {pointer!r}")
|
||||
current = doc
|
||||
for raw in pointer[1:].split("/"):
|
||||
token = raw.replace("~1", "/").replace("~0", "~")
|
||||
if isinstance(current, dict):
|
||||
if token not in current:
|
||||
raise PointerError(f"key {token!r} not found (pointer {pointer!r})")
|
||||
current = current[token]
|
||||
elif isinstance(current, list):
|
||||
if not (token.isascii() and token.isdecimal()) or (len(token) > 1 and token[0] == "0"):
|
||||
raise PointerError(f"invalid list index {token!r} (pointer {pointer!r})")
|
||||
index = int(token)
|
||||
if index >= len(current):
|
||||
raise PointerError(f"index {index} out of range (pointer {pointer!r})")
|
||||
current = current[index]
|
||||
else:
|
||||
raise PointerError(f"cannot descend into scalar at {token!r} (pointer {pointer!r})")
|
||||
return current
|
||||
|
||||
|
||||
def _json_equal(a: JsonValue, b: JsonValue) -> bool:
|
||||
"""Compare JSON values; bool equals only bool, unlike Python's ``==``."""
|
||||
if isinstance(a, bool) or isinstance(b, bool):
|
||||
return isinstance(a, bool) and isinstance(b, bool) and a == b
|
||||
if isinstance(a, dict) and isinstance(b, dict):
|
||||
return a.keys() == b.keys() and all(_json_equal(v, b[k]) for k, v in a.items())
|
||||
if isinstance(a, list) and isinstance(b, list):
|
||||
return len(a) == len(b) and all(_json_equal(x, y) for x, y in zip(a, b, strict=True))
|
||||
if isinstance(a, dict | list) or isinstance(b, dict | list):
|
||||
return False
|
||||
return a == b
|
||||
|
||||
|
||||
def grade(check: Check, output: JsonValue) -> CheckResult:
|
||||
"""Run one check against the output."""
|
||||
label = f"{check.grader} {check.path}"
|
||||
try:
|
||||
actual = resolve_pointer(output, check.path)
|
||||
except PointerError as exc:
|
||||
return CheckResult(label, False, str(exc))
|
||||
match check:
|
||||
case EqualsCheck():
|
||||
if _json_equal(actual, check.value):
|
||||
return CheckResult(label, True, "")
|
||||
return CheckResult(label, False, f"expected {check.value!r}, got {actual!r}")
|
||||
case ContainsCheck():
|
||||
if not isinstance(actual, list):
|
||||
return CheckResult(label, False, f"value is not a list: {actual!r}")
|
||||
missing = [i for i in check.items if not any(_json_equal(i, x) for x in actual)]
|
||||
if missing:
|
||||
return CheckResult(label, False, f"missing: {missing!r}")
|
||||
return CheckResult(label, True, "")
|
||||
|
||||
|
||||
def describe_validation_error(exc: ValidationError) -> str:
|
||||
"""One line per validation error, joined; no documentation links."""
|
||||
parts: list[str] = []
|
||||
for error in exc.errors(include_url=False):
|
||||
location = ".".join(str(part) for part in error["loc"])
|
||||
parts.append(f"{location}: {error['msg']}" if location else error["msg"])
|
||||
return "; ".join(parts)
|
||||
|
||||
|
||||
def score_case(
|
||||
case: EvalCase, raw: str | None, output_model: type[BaseModel], threshold: float
|
||||
) -> CaseResult:
|
||||
"""Score one case against its recorded response."""
|
||||
if raw is None:
|
||||
return CaseResult(case.id, 0.0, False, (), "missing response")
|
||||
try:
|
||||
output = output_model.model_validate_json(raw, strict=True)
|
||||
except ValidationError as exc:
|
||||
return CaseResult(
|
||||
case.id, 0.0, False, (), f"invalid response: {describe_validation_error(exc)}"
|
||||
)
|
||||
dumped: JsonValue = output.model_dump(mode="json", by_alias=True)
|
||||
results = tuple(grade(check, dumped) for check in case.expect)
|
||||
score = sum(r.passed for r in results) / len(results) if results else 1.0
|
||||
return CaseResult(case.id, score, score >= threshold, results, None)
|
||||
@@ -0,0 +1,120 @@
|
||||
"""Load eval sets and recorded responses from disk."""
|
||||
|
||||
import importlib
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Any, cast
|
||||
|
||||
import yaml
|
||||
from pydantic import BaseModel, ValidationError
|
||||
|
||||
from chemenu.evals.graders import describe_validation_error
|
||||
from chemenu.evals.model import EvalCase, EvalSet, ResponseError, SetSpec
|
||||
|
||||
|
||||
class EvalSetError(Exception):
|
||||
"""An eval set cannot be loaded; the message names the cause and file."""
|
||||
|
||||
|
||||
class _Loader(yaml.SafeLoader):
|
||||
"""SafeLoader that knows only the YAML 1.2 booleans.
|
||||
|
||||
``yes``, ``no``, ``on`` and ``off`` stay strings.
|
||||
"""
|
||||
|
||||
|
||||
_BOOL_TAG = "tag:yaml.org,2002:bool"
|
||||
_BOOL_12 = re.compile(r"^(?:true|True|TRUE|false|False|FALSE)$")
|
||||
_resolvers: dict[str, list[tuple[str, re.Pattern[str]]]] = {
|
||||
first: [(tag, regexp) for tag, regexp in entries if tag != _BOOL_TAG]
|
||||
for first, entries in yaml.SafeLoader.yaml_implicit_resolvers.items()
|
||||
}
|
||||
for _first in "tTfF":
|
||||
_resolvers.setdefault(_first, []).append((_BOOL_TAG, _BOOL_12))
|
||||
_Loader.yaml_implicit_resolvers = _resolvers
|
||||
|
||||
|
||||
def _read_yaml(path: Path) -> dict[str, Any]:
|
||||
try:
|
||||
text = path.read_text(encoding="utf-8-sig")
|
||||
except FileNotFoundError:
|
||||
raise EvalSetError(f"{path}: file is missing") from None
|
||||
except (OSError, UnicodeDecodeError) as exc:
|
||||
raise EvalSetError(f"{path}: cannot read file: {exc}") from exc
|
||||
try:
|
||||
data: object = yaml.load(text, Loader=_Loader) # noqa: S506 # _Loader extends SafeLoader
|
||||
except yaml.YAMLError as exc:
|
||||
raise EvalSetError(f"{path}: invalid YAML: {' '.join(str(exc).split())}") from exc
|
||||
if not isinstance(data, dict):
|
||||
raise EvalSetError(f"{path}: content must be a mapping")
|
||||
return cast("dict[str, Any]", data)
|
||||
|
||||
|
||||
def _resolve_output_model(spec: str, path: Path) -> type[BaseModel]:
|
||||
module_name, sep, class_name = spec.partition(":")
|
||||
if not sep or not module_name or not class_name:
|
||||
raise EvalSetError(f"{path}: output_model {spec!r} must have the form 'module:Class'")
|
||||
try:
|
||||
module = importlib.import_module(module_name)
|
||||
except Exception as exc:
|
||||
raise EvalSetError(f"{path}: output_model {spec!r}: cannot import module: {exc}") from exc
|
||||
try:
|
||||
model: object = getattr(module, class_name)
|
||||
except AttributeError:
|
||||
raise EvalSetError(f"{path}: output_model {spec!r}: class not found in module") from None
|
||||
if not (isinstance(model, type) and issubclass(model, BaseModel)):
|
||||
raise EvalSetError(f"{path}: output_model {spec!r} is not a subclass of pydantic.BaseModel")
|
||||
return model
|
||||
|
||||
|
||||
def load_eval_set(directory: Path) -> EvalSet:
|
||||
spec_path = directory / "eval.yaml"
|
||||
try:
|
||||
spec = SetSpec.model_validate(_read_yaml(spec_path), strict=True)
|
||||
except ValidationError as exc:
|
||||
raise EvalSetError(
|
||||
f"{spec_path}: invalid content: {describe_validation_error(exc)}"
|
||||
) from exc
|
||||
output_model = _resolve_output_model(spec.output_model, spec_path)
|
||||
|
||||
cases_dir = directory / "cases"
|
||||
if not cases_dir.is_dir():
|
||||
raise EvalSetError(f"{cases_dir}: cases directory is missing")
|
||||
cases: list[EvalCase] = []
|
||||
for stray in sorted(cases_dir.iterdir()):
|
||||
if not stray.name.startswith(".") and stray.suffix != ".yaml":
|
||||
raise EvalSetError(f"{stray}: case files must end in .yaml")
|
||||
for case_path in sorted(cases_dir.glob("*.yaml"), key=lambda p: p.stem):
|
||||
data = _read_yaml(case_path)
|
||||
if "id" in data:
|
||||
raise EvalSetError(f"{case_path}: invalid case: 'id' is the file name, not a field")
|
||||
try:
|
||||
cases.append(EvalCase.model_validate({"id": case_path.stem, **data}, strict=True))
|
||||
except ValidationError as exc:
|
||||
raise EvalSetError(
|
||||
f"{case_path}: invalid case: {describe_validation_error(exc)}"
|
||||
) from exc
|
||||
if not cases:
|
||||
raise EvalSetError(f"{cases_dir}: no cases found (empty set)")
|
||||
return EvalSet(
|
||||
name=spec.name,
|
||||
threshold=spec.threshold,
|
||||
output_model=output_model,
|
||||
cases=tuple(cases),
|
||||
)
|
||||
|
||||
|
||||
class RecordedResponses:
|
||||
"""Recorded raw model responses, one ``<id>.json`` file per case."""
|
||||
|
||||
def __init__(self, directory: Path) -> None:
|
||||
self._directory = directory
|
||||
|
||||
def response_for(self, case_id: str) -> str | None:
|
||||
path = self._directory / f"{case_id}.json"
|
||||
try:
|
||||
return path.read_text(encoding="utf-8-sig")
|
||||
except FileNotFoundError:
|
||||
return None
|
||||
except (OSError, UnicodeDecodeError) as exc:
|
||||
raise ResponseError(f"{path}: {exc}") from exc
|
||||
@@ -0,0 +1,89 @@
|
||||
"""Types of the eval harness."""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Annotated, Literal, Protocol
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, JsonValue
|
||||
|
||||
|
||||
class _Spec(BaseModel):
|
||||
model_config = ConfigDict(strict=True, extra="forbid", frozen=True)
|
||||
|
||||
|
||||
class EqualsCheck(_Spec):
|
||||
grader: Literal["equals"]
|
||||
path: str # JSON Pointer, RFC 6901
|
||||
value: JsonValue
|
||||
|
||||
|
||||
class ContainsCheck(_Spec):
|
||||
grader: Literal["contains"]
|
||||
path: str # points to a list
|
||||
items: list[JsonValue]
|
||||
|
||||
|
||||
Check = Annotated[EqualsCheck | ContainsCheck, Field(discriminator="grader")]
|
||||
|
||||
|
||||
class EvalCase(_Spec):
|
||||
id: str # file stem, set by the loader
|
||||
input: dict[str, JsonValue]
|
||||
expect: list[Check]
|
||||
|
||||
|
||||
class SetSpec(_Spec): # content of eval.yaml
|
||||
name: str
|
||||
threshold: float = Field(ge=0, le=1)
|
||||
output_model: str # "module:Class"
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class EvalSet:
|
||||
name: str
|
||||
threshold: float
|
||||
output_model: type[BaseModel]
|
||||
cases: tuple[EvalCase, ...] # sorted by id, never empty
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class CheckResult:
|
||||
label: str # e.g. "contains /entities"
|
||||
passed: bool
|
||||
detail: str
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class CaseResult:
|
||||
case_id: str
|
||||
score: float
|
||||
passed: bool
|
||||
checks: tuple[CheckResult, ...]
|
||||
error: str | None # missing response, invalid JSON, schema
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class SetResult:
|
||||
name: str
|
||||
threshold: float
|
||||
cases: tuple[CaseResult, ...]
|
||||
|
||||
@property
|
||||
def passed(self) -> bool:
|
||||
return all(case.passed for case in self.cases)
|
||||
|
||||
@property
|
||||
def mean_score(self) -> float:
|
||||
return sum(case.score for case in self.cases) / len(self.cases) if self.cases else 0.0
|
||||
|
||||
|
||||
class ResponseError(Exception):
|
||||
"""A recorded response exists but cannot be read."""
|
||||
|
||||
|
||||
class ResponseSource(Protocol):
|
||||
def response_for(self, case_id: str) -> str | None:
|
||||
"""Return the raw response; ``None`` if none exists.
|
||||
|
||||
Raises ``ResponseError`` if a response exists but cannot be read.
|
||||
"""
|
||||
...
|
||||
@@ -0,0 +1,43 @@
|
||||
"""Run an eval set and format the report."""
|
||||
|
||||
from chemenu.evals.graders import score_case
|
||||
from chemenu.evals.model import CaseResult, EvalSet, ResponseError, ResponseSource, SetResult
|
||||
|
||||
|
||||
def run_eval_set(eval_set: EvalSet, responses: ResponseSource) -> SetResult:
|
||||
"""Score every case, in case order."""
|
||||
cases: list[CaseResult] = []
|
||||
for case in eval_set.cases:
|
||||
try:
|
||||
raw = responses.response_for(case.id)
|
||||
except ResponseError as exc:
|
||||
cases.append(CaseResult(case.id, 0.0, False, (), f"cannot read response: {exc}"))
|
||||
continue
|
||||
cases.append(score_case(case, raw, eval_set.output_model, eval_set.threshold))
|
||||
return SetResult(eval_set.name, eval_set.threshold, tuple(cases))
|
||||
|
||||
|
||||
def _reason(case: CaseResult) -> str:
|
||||
if case.error is not None:
|
||||
reason = case.error
|
||||
else:
|
||||
reason = "; ".join(f"{c.label}: {c.detail}" for c in case.checks if not c.passed)
|
||||
# Validation messages span several lines; keep one report line per case.
|
||||
return " ".join(reason.split())
|
||||
|
||||
|
||||
def format_report(result: SetResult) -> str:
|
||||
"""One line per case, then a summary line."""
|
||||
lines: list[str] = []
|
||||
for case in result.cases:
|
||||
line = f"{'PASS' if case.passed else 'FAIL'} {case.case_id} {case.score:.2f}"
|
||||
reason = _reason(case)
|
||||
if reason:
|
||||
line += f" {reason}"
|
||||
lines.append(line)
|
||||
passed = sum(case.passed for case in result.cases)
|
||||
lines.append(
|
||||
f"{result.name}: {passed}/{len(result.cases)} passed, "
|
||||
f"mean {result.mean_score:.2f}, threshold {result.threshold}"
|
||||
)
|
||||
return "\n".join(lines)
|
||||
@@ -0,0 +1,98 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from chemenu.evals.cli import main
|
||||
|
||||
EVAL_YAML = """\
|
||||
name: "demo"
|
||||
threshold: 0.8
|
||||
output_model: "chemenu.evals.example:ExampleOutput"
|
||||
"""
|
||||
|
||||
CASE_YAML = """\
|
||||
input:
|
||||
text: "Hallo"
|
||||
expect:
|
||||
- grader: "equals"
|
||||
path: "/language"
|
||||
value: "de"
|
||||
- grader: "contains"
|
||||
path: "/entities"
|
||||
items: ["a"]
|
||||
"""
|
||||
|
||||
GOOD = '{"language": "de", "entities": ["a"]}'
|
||||
BAD = '{"language": "en", "entities": []}'
|
||||
|
||||
|
||||
def make_recorded(root: Path, data: dict[str, str]) -> Path:
|
||||
(root / "cases").mkdir(parents=True)
|
||||
(root / "eval.yaml").write_text(EVAL_YAML, encoding="utf-8")
|
||||
for stem in ("a", "b"):
|
||||
(root / "cases" / f"{stem}.yaml").write_text(CASE_YAML, encoding="utf-8")
|
||||
(root / "recorded").mkdir()
|
||||
for stem, text in data.items():
|
||||
(root / "recorded" / f"{stem}.json").write_text(text, encoding="utf-8")
|
||||
return root
|
||||
|
||||
|
||||
def test_exit_0_when_all_pass(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
|
||||
make_recorded(tmp_path, {"a": GOOD, "b": GOOD})
|
||||
assert main([str(tmp_path)]) == 0
|
||||
out = capsys.readouterr().out
|
||||
assert "PASS a 1.00" in out
|
||||
assert "demo: 2/2 passed, mean 1.00, threshold 0.8" in out
|
||||
|
||||
|
||||
def test_exit_1_below_threshold(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
|
||||
make_recorded(tmp_path, {"a": GOOD, "b": BAD})
|
||||
assert main([str(tmp_path)]) == 1
|
||||
assert "FAIL b 0.00" in capsys.readouterr().out
|
||||
|
||||
|
||||
def test_exit_1_on_missing_response(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
|
||||
make_recorded(tmp_path, {"a": GOOD})
|
||||
assert main([str(tmp_path)]) == 1
|
||||
assert "FAIL b 0.00 missing response" in capsys.readouterr().out
|
||||
|
||||
|
||||
def test_exit_2_on_load_error(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
|
||||
assert main([str(tmp_path)]) == 2
|
||||
captured = capsys.readouterr()
|
||||
assert captured.err.startswith("chemenu-eval: ")
|
||||
assert "eval.yaml" in captured.err
|
||||
assert captured.out == ""
|
||||
|
||||
|
||||
def test_exit_1_on_unreadable_response(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
|
||||
make_recorded(tmp_path, {"a": GOOD})
|
||||
(tmp_path / "recorded" / "b.json").write_bytes(b"\xff\xfe\x00{")
|
||||
assert main([str(tmp_path)]) == 1
|
||||
assert "FAIL b 0.00 cannot read response" in capsys.readouterr().out
|
||||
|
||||
|
||||
@pytest.mark.parametrize("raw", ["{bad", '{"language": "de"}'])
|
||||
def test_exit_1_on_invalid_response(
|
||||
tmp_path: Path, capsys: pytest.CaptureFixture[str], raw: str
|
||||
) -> None:
|
||||
make_recorded(tmp_path, {"a": GOOD, "b": raw})
|
||||
assert main([str(tmp_path)]) == 1
|
||||
assert "FAIL b 0.00 invalid response" in capsys.readouterr().out
|
||||
|
||||
|
||||
def test_exit_2_on_unknown_output_model(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
|
||||
make_recorded(tmp_path, {})
|
||||
(tmp_path / "eval.yaml").write_text(
|
||||
EVAL_YAML.replace("ExampleOutput", "Missing"), encoding="utf-8"
|
||||
)
|
||||
assert main([str(tmp_path)]) == 2
|
||||
assert "output_model" in capsys.readouterr().err
|
||||
|
||||
|
||||
def test_exit_2_on_empty_set(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None:
|
||||
make_recorded(tmp_path, {})
|
||||
for case in (tmp_path / "cases").iterdir():
|
||||
case.unlink()
|
||||
assert main([str(tmp_path)]) == 2
|
||||
assert "no cases found" in capsys.readouterr().err
|
||||
@@ -0,0 +1,9 @@
|
||||
from pathlib import Path
|
||||
|
||||
from chemenu.evals.cli import main
|
||||
|
||||
EXAMPLE_SET = Path(__file__).resolve().parents[2] / "evals" / "example"
|
||||
|
||||
|
||||
def test_example_set_passes() -> None:
|
||||
assert main([str(EXAMPLE_SET)]) == 0
|
||||
@@ -0,0 +1,110 @@
|
||||
"""Tests for the eval graders."""
|
||||
|
||||
import pytest
|
||||
from pydantic import BaseModel, ConfigDict, Field, JsonValue
|
||||
|
||||
from chemenu.evals.example import ExampleOutput
|
||||
from chemenu.evals.graders import PointerError, grade, resolve_pointer, score_case
|
||||
from chemenu.evals.model import ContainsCheck, EqualsCheck, EvalCase
|
||||
|
||||
GOOD = '{"language": "de", "entities": ["a", "b"]}'
|
||||
|
||||
|
||||
def _case(*expect: EqualsCheck | ContainsCheck) -> EvalCase:
|
||||
return EvalCase(id="c", input={}, expect=list(expect))
|
||||
|
||||
|
||||
def test_equals_passes_on_match() -> None:
|
||||
out: JsonValue = {"language": "de"}
|
||||
result = grade(EqualsCheck(grader="equals", path="/language", value="de"), out)
|
||||
assert result.passed
|
||||
assert result.label == "equals /language"
|
||||
|
||||
|
||||
def test_contains_reports_missing_item() -> None:
|
||||
out: JsonValue = {"entities": ["a"]}
|
||||
result = grade(ContainsCheck(grader="contains", path="/entities", items=["a", "z"]), out)
|
||||
assert not result.passed
|
||||
assert "'z'" in result.detail
|
||||
assert "'a'" not in result.detail
|
||||
|
||||
|
||||
def test_unresolvable_pointer_fails_only_that_check() -> None:
|
||||
case = _case(
|
||||
EqualsCheck(grader="equals", path="/nope", value=1),
|
||||
EqualsCheck(grader="equals", path="/language", value="de"),
|
||||
)
|
||||
result = score_case(case, GOOD, ExampleOutput, 0.0)
|
||||
assert result.error is None
|
||||
assert [c.passed for c in result.checks] == [False, True]
|
||||
assert result.score == 0.5
|
||||
|
||||
|
||||
def test_missing_response_scores_zero() -> None:
|
||||
result = score_case(_case(), None, ExampleOutput, 0.0)
|
||||
assert (result.score, result.passed, result.checks) == (0.0, False, ())
|
||||
assert result.error
|
||||
|
||||
|
||||
def test_invalid_json_scores_zero() -> None:
|
||||
result = score_case(_case(), "not json", ExampleOutput, 0.0)
|
||||
assert (result.score, result.passed) == (0.0, False)
|
||||
assert result.error
|
||||
|
||||
|
||||
def test_schema_violation_scores_zero() -> None:
|
||||
result = score_case(_case(), '{"language": "de"}', ExampleOutput, 0.0)
|
||||
assert (result.score, result.passed) == (0.0, False)
|
||||
assert result.error == "invalid response: entities: Field required"
|
||||
|
||||
|
||||
def test_strict_rejects_coercion() -> None:
|
||||
result = score_case(_case(), '{"language": 1, "entities": []}', ExampleOutput, 0.0)
|
||||
assert result.score == 0.0
|
||||
assert result.error
|
||||
|
||||
|
||||
def test_score_is_share_of_passed_checks() -> None:
|
||||
case = _case(
|
||||
EqualsCheck(grader="equals", path="/language", value="de"),
|
||||
EqualsCheck(grader="equals", path="/language", value="en"),
|
||||
ContainsCheck(grader="contains", path="/entities", items=["a"]),
|
||||
ContainsCheck(grader="contains", path="/entities", items=["q"]),
|
||||
)
|
||||
result = score_case(case, GOOD, ExampleOutput, 0.5)
|
||||
assert result.score == 0.5
|
||||
assert result.passed
|
||||
assert not score_case(case, GOOD, ExampleOutput, 0.6).passed
|
||||
|
||||
|
||||
def test_resolve_pointer_rfc6901() -> None:
|
||||
doc: JsonValue = {"a/b": {"m~n": [10, 20]}, "": 1}
|
||||
assert resolve_pointer(doc, "") == doc
|
||||
assert resolve_pointer(doc, "/a~1b/m~0n/1") == 20
|
||||
assert resolve_pointer(doc, "/") == 1
|
||||
for bad in ("/a~1b/m~0n/2", "/a~1b/m~0n/01", "x", "/a~1b/m~0n/0/z"):
|
||||
with pytest.raises(PointerError):
|
||||
resolve_pointer(doc, bad)
|
||||
|
||||
|
||||
def test_bool_is_not_equal_to_int() -> None:
|
||||
eq_one = EqualsCheck(grader="equals", path="/a", value=1)
|
||||
assert not grade(eq_one, {"a": True}).passed
|
||||
assert not grade(ContainsCheck(grader="contains", path="/a", items=[0]), {"a": [False]}).passed
|
||||
nested = EqualsCheck(grader="equals", path="", value={"a": [1]})
|
||||
assert not grade(nested, {"a": [True]}).passed
|
||||
assert grade(nested, {"a": [1]}).passed
|
||||
assert grade(eq_one, {"a": 1.0}).passed
|
||||
|
||||
|
||||
class _Aliased(BaseModel):
|
||||
model_config = ConfigDict(strict=True, extra="forbid", frozen=True)
|
||||
|
||||
entity_list: list[str] = Field(alias="entityList")
|
||||
|
||||
|
||||
def test_pointer_uses_field_alias() -> None:
|
||||
case = _case(ContainsCheck(grader="contains", path="/entityList", items=["a"]))
|
||||
result = score_case(case, '{"entityList": ["a"]}', _Aliased, 1.0)
|
||||
assert result.error is None
|
||||
assert result.passed
|
||||
@@ -0,0 +1,145 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from chemenu.evals.example import ExampleOutput
|
||||
from chemenu.evals.loader import EvalSetError, RecordedResponses, load_eval_set
|
||||
from chemenu.evals.model import ContainsCheck, EqualsCheck, ResponseError
|
||||
|
||||
EVAL_YAML = """\
|
||||
name: "demo"
|
||||
threshold: 0.8
|
||||
output_model: "chemenu.evals.example:ExampleOutput"
|
||||
"""
|
||||
|
||||
CASE_YAML = """\
|
||||
input:
|
||||
text: "Hallo"
|
||||
expect:
|
||||
- grader: "equals"
|
||||
path: "/language"
|
||||
value: "de"
|
||||
- grader: "contains"
|
||||
path: "/entities"
|
||||
items: ["a"]
|
||||
"""
|
||||
|
||||
|
||||
def make_set(root: Path, eval_yaml: str = EVAL_YAML, cases: dict[str, str] | None = None) -> Path:
|
||||
root.mkdir(parents=True, exist_ok=True)
|
||||
(root / "eval.yaml").write_text(eval_yaml, encoding="utf-8")
|
||||
(root / "cases").mkdir(exist_ok=True)
|
||||
selected = cases if cases is not None else {"b": CASE_YAML, "a": CASE_YAML}
|
||||
for stem, text in selected.items():
|
||||
(root / "cases" / f"{stem}.yaml").write_text(text, encoding="utf-8")
|
||||
return root
|
||||
|
||||
|
||||
def test_loads_cases_sorted_by_file_stem(tmp_path: Path) -> None:
|
||||
root = make_set(tmp_path, cases={"b": CASE_YAML, "a": CASE_YAML, "c": CASE_YAML})
|
||||
eval_set = load_eval_set(root)
|
||||
assert eval_set.name == "demo"
|
||||
assert eval_set.threshold == 0.8
|
||||
assert eval_set.output_model is ExampleOutput
|
||||
assert [case.id for case in eval_set.cases] == ["a", "b", "c"]
|
||||
assert isinstance(eval_set.cases, tuple)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"output_model",
|
||||
[
|
||||
"nocolon",
|
||||
"no.such.module:X",
|
||||
"chemenu.evals.example:Missing",
|
||||
"pathlib:Path",
|
||||
],
|
||||
)
|
||||
def test_unknown_output_model_raises(tmp_path: Path, output_model: str) -> None:
|
||||
eval_yaml = EVAL_YAML.replace("chemenu.evals.example:ExampleOutput", output_model)
|
||||
with pytest.raises(EvalSetError, match="output_model"):
|
||||
load_eval_set(make_set(tmp_path, eval_yaml))
|
||||
|
||||
|
||||
def test_empty_set_raises(tmp_path: Path) -> None:
|
||||
with pytest.raises(EvalSetError, match="cases"):
|
||||
load_eval_set(make_set(tmp_path, cases={}))
|
||||
|
||||
|
||||
def test_missing_cases_dir_raises(tmp_path: Path) -> None:
|
||||
(tmp_path / "eval.yaml").write_text(EVAL_YAML, encoding="utf-8")
|
||||
with pytest.raises(EvalSetError, match="cases"):
|
||||
load_eval_set(tmp_path)
|
||||
|
||||
|
||||
def test_missing_eval_yaml_raises(tmp_path: Path) -> None:
|
||||
with pytest.raises(EvalSetError, match=r"eval\.yaml"):
|
||||
load_eval_set(tmp_path)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"bad",
|
||||
[
|
||||
"input: [",
|
||||
"- just\n- a list\n",
|
||||
'input: {}\nexpect: []\nid: "x"\n',
|
||||
'input: {}\nexpect: [{grader: "nope"}]\n',
|
||||
],
|
||||
)
|
||||
def test_invalid_case_raises(tmp_path: Path, bad: str) -> None:
|
||||
root = make_set(tmp_path, cases={"bad": bad})
|
||||
with pytest.raises(EvalSetError, match=r"bad\.yaml") as info:
|
||||
load_eval_set(root)
|
||||
assert "\n" not in str(info.value).strip()
|
||||
assert "errors.pydantic.dev" not in str(info.value)
|
||||
|
||||
|
||||
def test_invalid_eval_yaml_raises(tmp_path: Path) -> None:
|
||||
with pytest.raises(EvalSetError, match=r"eval\.yaml"):
|
||||
load_eval_set(make_set(tmp_path / "one", 'name: "x"\n'))
|
||||
with pytest.raises(EvalSetError, match=r"eval\.yaml"):
|
||||
load_eval_set(make_set(tmp_path / "two", "a: ["))
|
||||
|
||||
|
||||
def test_recorded_response_is_raw_text(tmp_path: Path) -> None:
|
||||
raw = ' {"language": "de",\n "entities": ["ä"]} \n'
|
||||
(tmp_path / "a.json").write_text(raw, encoding="utf-8")
|
||||
assert RecordedResponses(tmp_path).response_for("a") == raw
|
||||
|
||||
|
||||
def test_missing_recorded_response_is_none(tmp_path: Path) -> None:
|
||||
assert RecordedResponses(tmp_path).response_for("a") is None
|
||||
|
||||
|
||||
def test_recorded_response_strips_bom(tmp_path: Path) -> None:
|
||||
(tmp_path / "a.json").write_bytes(b"\xef\xbb\xbf" + b'{"language": "de"}')
|
||||
assert RecordedResponses(tmp_path).response_for("a") == '{"language": "de"}'
|
||||
|
||||
|
||||
def test_unreadable_recorded_response_raises(tmp_path: Path) -> None:
|
||||
(tmp_path / "a.json").write_bytes(b"\xff\xfe\x00{")
|
||||
(tmp_path / "b.json").mkdir()
|
||||
for case_id in ("a", "b"):
|
||||
with pytest.raises(ResponseError, match=case_id):
|
||||
RecordedResponses(tmp_path).response_for(case_id)
|
||||
|
||||
|
||||
def test_non_yaml_file_in_cases_raises(tmp_path: Path) -> None:
|
||||
root = make_set(tmp_path)
|
||||
(root / "cases" / "x.yml").write_text(CASE_YAML, encoding="utf-8")
|
||||
with pytest.raises(EvalSetError, match=r"x\.yml.*must end in \.yaml"):
|
||||
load_eval_set(root)
|
||||
|
||||
|
||||
def test_unquoted_no_stays_string(tmp_path: Path) -> None:
|
||||
case = CASE_YAML.replace('value: "de"', "value: no").replace('items: ["a"]', "items: [yes, on]")
|
||||
eval_set = load_eval_set(make_set(tmp_path, cases={"a": case}))
|
||||
first, second = eval_set.cases[0].expect
|
||||
assert isinstance(first, EqualsCheck)
|
||||
assert first.value == "no"
|
||||
assert isinstance(second, ContainsCheck)
|
||||
assert second.items == ["yes", "on"]
|
||||
case = CASE_YAML.replace('value: "de"', "value: true")
|
||||
eval_set = load_eval_set(make_set(tmp_path / "t", cases={"a": case}))
|
||||
first = eval_set.cases[0].expect[0]
|
||||
assert isinstance(first, EqualsCheck)
|
||||
assert first.value is True
|
||||
@@ -0,0 +1,78 @@
|
||||
from pathlib import Path
|
||||
|
||||
from chemenu.evals.loader import load_eval_set
|
||||
from chemenu.evals.model import ResponseError
|
||||
from chemenu.evals.runner import format_report, run_eval_set
|
||||
|
||||
EVAL_YAML = """\
|
||||
name: "demo"
|
||||
threshold: 0.8
|
||||
output_model: "chemenu.evals.example:ExampleOutput"
|
||||
"""
|
||||
|
||||
CASE_YAML = """\
|
||||
input:
|
||||
text: "Hallo"
|
||||
expect:
|
||||
- grader: "equals"
|
||||
path: "/language"
|
||||
value: "de"
|
||||
- grader: "contains"
|
||||
path: "/entities"
|
||||
items: ["a"]
|
||||
"""
|
||||
|
||||
GOOD = '{"language": "de", "entities": ["a"]}'
|
||||
HALF = '{"language": "en", "entities": ["a"]}'
|
||||
|
||||
|
||||
def make_set(root: Path, cases: list[str]) -> Path:
|
||||
(root / "cases").mkdir(parents=True)
|
||||
(root / "eval.yaml").write_text(EVAL_YAML, encoding="utf-8")
|
||||
for stem in cases:
|
||||
(root / "cases" / f"{stem}.yaml").write_text(CASE_YAML, encoding="utf-8")
|
||||
return root
|
||||
|
||||
|
||||
class FakeResponses:
|
||||
def __init__(self, data: dict[str, str]) -> None:
|
||||
self._data = data
|
||||
|
||||
def response_for(self, case_id: str) -> str | None:
|
||||
return self._data.get(case_id)
|
||||
|
||||
|
||||
def test_scores_every_case(tmp_path: Path) -> None:
|
||||
eval_set = load_eval_set(make_set(tmp_path, ["b", "a"]))
|
||||
result = run_eval_set(eval_set, FakeResponses({"a": GOOD, "b": HALF}))
|
||||
assert result.name == "demo"
|
||||
assert result.threshold == 0.8
|
||||
assert [c.case_id for c in result.cases] == ["a", "b"]
|
||||
assert [c.score for c in result.cases] == [1.0, 0.5]
|
||||
assert not result.passed
|
||||
|
||||
|
||||
def test_report_lists_cases_and_total(tmp_path: Path) -> None:
|
||||
eval_set = load_eval_set(make_set(tmp_path, ["a", "b", "c"]))
|
||||
result = run_eval_set(eval_set, FakeResponses({"a": GOOD, "b": HALF, "c": "{bad"}))
|
||||
lines = format_report(result).splitlines()
|
||||
assert lines[0] == "PASS a 1.00"
|
||||
assert lines[1].startswith("FAIL b 0.50 equals /language: ")
|
||||
assert lines[2].startswith("FAIL c 0.00 invalid response: ")
|
||||
assert not result.passed
|
||||
assert lines[-1] == "demo: 1/3 passed, mean 0.50, threshold 0.8"
|
||||
assert len(lines) == 4
|
||||
assert all(line == line.rstrip() for line in lines)
|
||||
|
||||
|
||||
class _Unreadable:
|
||||
def response_for(self, case_id: str) -> str | None:
|
||||
raise ResponseError(f"{case_id}.json: boom")
|
||||
|
||||
|
||||
def test_unreadable_response_fails_case(tmp_path: Path) -> None:
|
||||
eval_set = load_eval_set(make_set(tmp_path, ["a"]))
|
||||
result = run_eval_set(eval_set, _Unreadable())
|
||||
assert not result.passed
|
||||
assert result.cases[0].error == "cannot read response: a.json: boom"
|
||||
assert result.cases[0].score == 0.0
|
||||
@@ -13,6 +13,7 @@ import pytest
|
||||
"chemenu.application",
|
||||
"chemenu.ports",
|
||||
"chemenu.adapters",
|
||||
"chemenu.evals",
|
||||
],
|
||||
)
|
||||
def test_module_imports(module_name: str) -> None:
|
||||
|
||||
@@ -6,6 +6,15 @@ requires-python = "==3.14.*"
|
||||
exclude-newer = "0001-01-01T00:00:00Z" # This has no effect and is included for backwards compatibility when using relative exclude-newer values.
|
||||
exclude-newer-span = "P7D"
|
||||
|
||||
[[package]]
|
||||
name = "annotated-types"
|
||||
version = "0.8.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/5f/56/a8120250d128bed162cd73c76d45f6ef9991f3e068f62a8ee060afa3104a/annotated_types-0.8.0.tar.gz", hash = "sha256:13b2beaad985e05e2d6407ee4c4f35590b11f8d693a258a561055cac8f64cab7", size = 15893, upload-time = "2026-07-23T20:16:13.995Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/99/91/8acff4f5e50511b911bbccb72b8628a49c68ce14148cd9f6431094859a90/annotated_types-0.8.0-py3-none-any.whl", hash = "sha256:f072f4d804ea359e4eaf198b1af7a8b0943881a87f31bb764f8bf219bb9419e0", size = 13427, upload-time = "2026-07-23T20:16:12.938Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfgv"
|
||||
version = "3.5.0"
|
||||
@@ -19,6 +28,10 @@ wheels = [
|
||||
name = "chemenu-ng"
|
||||
version = "0.0.0"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "pydantic" },
|
||||
{ name = "pyyaml" },
|
||||
]
|
||||
|
||||
[package.dev-dependencies]
|
||||
dev = [
|
||||
@@ -27,9 +40,14 @@ dev = [
|
||||
{ name = "pyright" },
|
||||
{ name = "pytest" },
|
||||
{ name = "ruff" },
|
||||
{ name = "types-pyyaml" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "pydantic", specifier = ">=2.14.4" },
|
||||
{ name = "pyyaml", specifier = ">=6.0.4" },
|
||||
]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
dev = [
|
||||
@@ -38,6 +56,7 @@ dev = [
|
||||
{ name = "pyright", specifier = ">=1.1.390" },
|
||||
{ name = "pytest", specifier = ">=8" },
|
||||
{ name = "ruff", specifier = ">=0.8" },
|
||||
{ name = "types-pyyaml", specifier = ">=6.0.12.20261122" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -149,6 +168,63 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/12/46/eba9be9daa403fa94854ce16a458c29df9a01c6c047931c3d8be6016cd9a/pre_commit_hooks-6.0.0-py2.py3-none-any.whl", hash = "sha256:76161b76d321d2f8ee2a8e0b84c30ee8443e01376121fd1c90851e33e3bd7ee2", size = 41338, upload-time = "2025-08-09T19:25:03.513Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic"
|
||||
version = "2.14.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "annotated-types" },
|
||||
{ name = "pydantic-core" },
|
||||
{ name = "typing-extensions" },
|
||||
{ name = "typing-inspection" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/8e/25/3ec212432a6031b65f043eaca9c820ddf87c0d0aa330023e64f79fcb5db6/pydantic-2.14.4.tar.gz", hash = "sha256:7c19f1d46f8accf55a4617a6116e1ade64840870f397b846a2c53fb9019414ba", size = 927354, upload-time = "2026-11-19T12:57:39.767Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/8a/8c/824a686c4ba815ddb0722f9e66272088bccd4e1ae1d2f7015375e4a4fc7f/pydantic-2.14.4-py3-none-any.whl", hash = "sha256:653a2ad9f6d8858529c77c72717d0ea991d6c6837fe683246b2f4b2bbfc3fadc", size = 494865, upload-time = "2026-11-19T12:57:37.688Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic-core"
|
||||
version = "2.50.5"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/fb/63/0ceb815a7762576027ce388544c573d440574f95afb1302a2496b96db548/pydantic_core-2.50.5.tar.gz", hash = "sha256:1e740886083ff95530d694e6a3f09ed914bcf92a496d16acd307c6c3484fc36d", size = 523285, upload-time = "2026-11-19T12:56:38.067Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/91/86/570c4fedb8eeab9062032bc45875490090477fddce932328a20b9cb834ff/pydantic_core-2.50.5-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:00598ae680c6e4a17cda01910e49c0da8ce15610505e6c57cec3f15d83daef88", size = 2239820, upload-time = "2026-11-19T12:54:47.806Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5b/a6/5bc38ad74a5705bcfdf1fd4e2009a62638a45dc246e3b0fc8a86e8c9ff4b/pydantic_core-2.50.5-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:e8fe516a4b3b06e4ff83b9adee4a786d28a617e5fb5fe90bda49fb6f52a5ac19", size = 2111039, upload-time = "2026-11-19T12:54:49.244Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d8/b5/a494d5d4ffd2dc1b06f1572d7651a4d6ada7881c5a527930be8f0171fc34/pydantic_core-2.50.5-cp314-cp314-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:63a0ba0d7ccf37c8c724bb7ed13c3aa0aa4c743f4f5f376c92c47e584844c7b1", size = 2264771, upload-time = "2026-11-19T12:54:50.701Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cc/13/099f19c4be6dbe10e327b17447e137ebd679cc64a3833a87f4597dcffc2a/pydantic_core-2.50.5-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:27bc22dc8d50335bc62296261a7dc4c2572149910ba7c274ef0f945b5be0d570", size = 2133839, upload-time = "2026-11-19T12:54:52.33Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/10/4c/9eec8f71877124a093a0fc0033747489ea7e18d364ec562a7d170c483f4f/pydantic_core-2.50.5-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:2f6a8c9b8647378c0dc128805e6b98da39d36019a0e7cac134badeaedb14f849", size = 2200176, upload-time = "2026-11-19T12:54:53.745Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/51/45/79ed6028c3e19a5376057da8545977d6f74d37afccdeb684ee7274d05994/pydantic_core-2.50.5-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:feb8c87dbc4684777ddafbf37c922d9e2748272ba61e362ebf85db73ebda6234", size = 2393117, upload-time = "2026-11-19T12:54:55.28Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/c6/cc/0b9d5b6652e55cbe6d2eb5c56947bb19c106be388157a410847362b2fd8e/pydantic_core-2.50.5-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:e0a7ae307b4e1eff195cd23a757da07f70a115e45175039caf5f3979a20c7edb", size = 2469324, upload-time = "2026-11-19T12:54:56.758Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/79/e3/df03dc4e10c460d37dad8921ec9c6f177bc33d4f2da808d5ae4d8f11acfe/pydantic_core-2.50.5-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:88b543705849d0c59343f97c38296dbf59eb7b3c9565bd4fe1ed638ba38da5ed", size = 2269323, upload-time = "2026-11-19T12:54:58.209Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d5/28/4779dd7ba7f2187222c4ee42f492a451d3425202fdd2b5970b701feab16c/pydantic_core-2.50.5-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:4ae5c9f84dfa43643d10328a212f709c7602c5e70df376d217ae5770d374ccd9", size = 2271462, upload-time = "2026-11-19T12:54:59.719Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/0c/48/51f4d0d26e36341330a933c9c5660696023101a0e933552dbc00db49b1cd/pydantic_core-2.50.5-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:922455cc5baddb0f2c82b7ba649e57e89183442b32fe512670db6ebb9b66b251", size = 2305488, upload-time = "2026-11-19T12:55:01.168Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/53/53/17892228fd2e66aa2791f97f984bdd34081c1d6ec98997c8e5b8467d04c3/pydantic_core-2.50.5-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:aa69eaeed433cfe5de809fb84c95536a5aed991b28290d0db059fe6766c69274", size = 2475854, upload-time = "2026-11-19T12:55:02.687Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/58/11/c4daab94156b26f779aca920b710138dda04882f295f7e802f237da1082d/pydantic_core-2.50.5-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:9f2bf218dbc93363fe3e31cc53d36db8d6ff4122179406bec05f33bb79c0e2c1", size = 2505669, upload-time = "2026-11-19T12:55:04.137Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/83/47/375ab34f3907a0f40cebe2c3cea3e2c25dcf58e0f591991b85604b7258fc/pydantic_core-2.50.5-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:b2910ec0fa5aeb9bef70156f2b79f4783978fdcfaa7b2f1b5d1814458d2e79a1", size = 1496394, upload-time = "2026-11-19T12:55:05.468Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/48/e7/e64fa77d1d335ad21d821adbe3d2590b9d7cc05d210ca11fa524a1c6902d/pydantic_core-2.50.5-cp314-cp314-win32.whl", hash = "sha256:1deb966176b1b66be4281c83f10a0b6b1cecedeb25f53ee894bf27b22376facd", size = 2128110, upload-time = "2026-11-19T12:55:06.797Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/bd/da/feb489c6252364355d1f314a284a542cd6788cebe83f9507d4af81c95f4a/pydantic_core-2.50.5-cp314-cp314-win_amd64.whl", hash = "sha256:887424ba7c2145e97f131bc2cc73383a8c464d7bcd56eb98bbd941afb6868b95", size = 2278977, upload-time = "2026-11-19T12:55:08.188Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/cd/81/a3bc7bee867be70ec58b3ef3d84e88420fc2d6fd52a8830a3f3a75f0891e/pydantic_core-2.50.5-cp314-cp314-win_arm64.whl", hash = "sha256:e7dd59f498ef42077f22db607571249db41997227018cb84644ba0059f8b5719", size = 2169842, upload-time = "2026-11-19T12:55:09.474Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/2d/18/24bc9decf37a81ed5ab979a19ac0a23b457633d525e2c71d4b96476b1bf9/pydantic_core-2.50.5-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:372f4ab3e67b2387871950cfa27d94d644c3475e650836ea52e25c2e4fbd7975", size = 2227397, upload-time = "2026-11-19T12:55:11.022Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/46/4f/d958789f577f91af3c9639e6c127cd729be7117d6318fcfa4b773e3bb220/pydantic_core-2.50.5-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:0c9f0002e4ec37db931e4ee8b7dafab2c7288ef66354e74fe16484e60eac6616", size = 2091300, upload-time = "2026-11-19T12:55:12.395Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/16/86/b2f630ebb50c18df1603a3d2b03b4722005c27dd4a54e3291b302dcaa54a/pydantic_core-2.50.5-cp314-cp314t-manylinux1_i686.manylinux_2_5_i686.whl", hash = "sha256:d16cb794449c2bc0e5cb0ab0022813419bf5283266f2a7ff1fc54e5c6e27dcee", size = 2277674, upload-time = "2026-11-19T12:55:13.728Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/91/8e/06b5d2da6c7bd8e817edd1dcce595a904ef295e66f1e243cc768ccfcaa41/pydantic_core-2.50.5-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:71633f82d51d4796a48026bd6eca5ec83e4a0edbe6187d59bbc45ace1111ebae", size = 2116208, upload-time = "2026-11-19T12:55:14.971Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/40/0e/b818e7903883e6e51d10fd6ec43d2837cdea3861571d050942ff5d873327/pydantic_core-2.50.5-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.whl", hash = "sha256:f20c692c599ebac7f04f3a0102b969f3f9d6667ffe1e72629fc7fbf8b6375234", size = 2210100, upload-time = "2026-11-19T12:55:16.308Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/d0/aa/8c062145581453ac1b0fb3577ec193926b8973dc4b990283c304a955d80b/pydantic_core-2.50.5-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:2f0a86887c644247eff4cc7b9e609042a49833dcd72f84574e7b8beea89729ab", size = 2410440, upload-time = "2026-11-19T12:55:17.611Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/18/08/a4782611257ce1a85d194348a011dea09f0bf6344b28b8f8fee6c501b8a9/pydantic_core-2.50.5-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:655d0cc2ddbc3fb1f4f8a8e3724552ee2ba6b8561289e9e6e06186982b27bceb", size = 2474759, upload-time = "2026-11-19T12:55:18.847Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/48/64/6391407d76fdd16b43c0e377998f38142b433e2f28325764bcea37e8b1e5/pydantic_core-2.50.5-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:1d53befcfd415bd9212e685372c825e62f29b83820db78512c9d3659f13d29e9", size = 2264144, upload-time = "2026-11-19T12:55:20.163Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/a5/d3/54c432da68129a4e5b9d83f01fc0359b87abb72929fd0ed19f208fb72889/pydantic_core-2.50.5-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:5f33c92da4aa5714fb6fcb086358274598e8ff62b6607afd132a38657aa64f02", size = 2267290, upload-time = "2026-11-19T12:55:21.551Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/18/b9/4f1fb301cf4ea6c325da205e82887260e71a780ac21b2f0baf837b82c0cd/pydantic_core-2.50.5-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:3129b52ee2861d0270db8bd140fc9b53ee9821247ca47fda2613a899ce9a1ea3", size = 2308710, upload-time = "2026-11-19T12:55:22.858Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/eb/a2/423f7defa257419098f186ad3c4bd5e7e983956d8ff7c3e65582a70a6835/pydantic_core-2.50.5-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:041f4730fa7a8bf975e88436d439bdc72f3f16e584a470ffbe47392628d99de6", size = 2485824, upload-time = "2026-11-19T12:55:24.175Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ce/7f/3b9148a4d9df1a8f682b3dc7cd70b8855e0e3b27ce49180aa7dd18f164a3/pydantic_core-2.50.5-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:48b5deaaee4f1b99603173cd291127523e43ee9f51db58c7ff98d16dc5c6fc93", size = 2518300, upload-time = "2026-11-19T12:55:25.422Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/52/f4/ff11826851f17477e6e0ac28da74dcabb9d5848db450fd67bfddfc147f89/pydantic_core-2.50.5-cp314-cp314t-win32.whl", hash = "sha256:8c7244134b93ce028e9166c1b5d3e4537349307ccf3e65d746b4c6b1bbed8c89", size = 2107419, upload-time = "2026-11-19T12:55:27.203Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8b/6c/41c3e9f11befcb6fe576e95703d2d8d9dde3f3fa0de5e4c432d60644aeed/pydantic_core-2.50.5-cp314-cp314t-win_amd64.whl", hash = "sha256:159f6bc1b616e0ca0938eb568d87ca03c633d6f06306ac47b9c3e5dd8c14d39a", size = 2246337, upload-time = "2026-11-19T12:55:28.704Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/b6/98/ae8e3f2182a0ddf5f868b4e7830032d9b0ff34cbdd64549bb0b57a2e52c4/pydantic_core-2.50.5-cp314-cp314t-win_arm64.whl", hash = "sha256:5274f8314ce3be1df07ae8ebceeb97a73b8409d842fd7677c5d0a85a68793ec1", size = 2174036, upload-time = "2026-11-19T12:55:30.029Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pygments"
|
||||
version = "2.21.0"
|
||||
@@ -259,6 +335,15 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/70/8a/59c33e2a64a4f9672f7f842a0dc522915cfbbaffd13d37d0cec57d1c5c5d/ruff-0.17.6-py3-none-win_arm64.whl", hash = "sha256:d8b14e1473dc86ab9069cf7a2ba5041dc012f59110201844ed04cfddf07055a0", size = 9926224, upload-time = "2026-11-19T15:56:25.269Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "types-pyyaml"
|
||||
version = "6.0.12.20261122"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/3d/fe/e4d32b089d06f3b5d2f3f1909b1cb450ce2e18ea6e2c1863d2b29ad0090e/types_pyyaml-6.0.12.20261122.tar.gz", hash = "sha256:7fa577c893a1db255cbb02320884ffcb97b7a219fe515bec6c5f15d5d3af41ed", size = 19093, upload-time = "2026-11-22T08:57:28.481Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/4c/71/8dc5553ca25c3a4799ce789f8300d2c3933d427585222c431c77450ed60d/types_pyyaml-6.0.12.20261122-py3-none-any.whl", hash = "sha256:689fbbe883b60471166dede9dba6ac0dbdbcf0ea98062d7ec195430f5bbdb009", size = 21356, upload-time = "2026-11-22T08:57:27.509Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "4.16.0"
|
||||
@@ -268,6 +353,18 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/49/d3/b8441a820a491ddfc024b0b0cf0393375b75ea13866d9c66727e54c2fc80/typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8", size = 45571, upload-time = "2026-07-02T08:40:04.659Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-inspection"
|
||||
version = "0.4.5"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ff/50/0195198eb1d75bab716bb0a813abea4cc394bfa17a92a189f021a34859af/typing_inspection-0.4.5.tar.gz", hash = "sha256:7f16c411e7930dc79596d42ab44672a3fe5f60eb34b781a1647e7872363120c7", size = 81194, upload-time = "2026-11-04T14:13:23.774Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/de/0c/ea2544850a7c135e15033a5c7a8e7211136184b7ae63e2239d557c2b3019/typing_inspection-0.4.5-py3-none-any.whl", hash = "sha256:bc210535442b39e1bf2805e0c7a17dfd6a4ace760c84c7f7d16245d23a6b1c39", size = 14874, upload-time = "2026-11-04T14:13:22.616Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "virtualenv"
|
||||
version = "21.15.13"
|
||||
|
||||
Reference in new issue
Block a user