evaldenom 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
evaldenom/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """Intended evaluation coverage, not statistical significance or attestation."""
2
+ from .core import InputError, audit, freeze, input_digest
3
+ __all__ = ['InputError', 'audit', 'freeze', 'input_digest']
evaldenom/__main__.py ADDED
@@ -0,0 +1,2 @@
1
+ from .cli import cli
2
+ raise SystemExit(cli())
evaldenom/cli.py ADDED
@@ -0,0 +1,145 @@
1
+ """Offline CLI. Input errors do not replace an existing output."""
2
+ import argparse
3
+ import json
4
+ import os
5
+ import sys
6
+ from pathlib import Path
7
+ import tempfile
8
+ from .core import InputError, audit, freeze, read_json, read_jsonl
9
+
10
+
11
+ def _write_text(stream, text):
12
+ if stream is None:
13
+ raise OSError('output stream is unavailable')
14
+ written = stream.write(text)
15
+ if type(written) is not int or written != len(text):
16
+ raise OSError('output stream did not accept complete text')
17
+ stream.flush()
18
+
19
+
20
+ class _ArgumentParser(argparse.ArgumentParser):
21
+ def _print_message(self, message, file=None):
22
+ # argparse may suppress write errors; keep them inside our I/O boundary.
23
+ if message:
24
+ _write_text(sys.stderr if file is None else file, message)
25
+
26
+
27
+ def _error(message, comparison=False):
28
+ try:
29
+ _write_text(sys.stderr, 'evaldenom: %s; no %s verdict published\n' %
30
+ (message, 'comparison' if comparison else 'audit'))
31
+ except (OSError, ValueError):
32
+ pass
33
+ raise SystemExit(2)
34
+
35
+
36
+ def _write(path, text):
37
+ path = Path(path)
38
+ temporary = None
39
+ try:
40
+ with tempfile.NamedTemporaryFile(mode='w', encoding='utf-8', dir=path.parent,
41
+ prefix='.evaldenom-', delete=False) as out:
42
+ temporary = out.name
43
+ _write_text(out, text)
44
+ os.replace(temporary, path)
45
+ finally:
46
+ if temporary is not None and os.path.exists(temporary):
47
+ os.unlink(temporary)
48
+
49
+
50
+ def main(argv=None):
51
+ parser = _ArgumentParser(description='Audit intended evaluation coverage and identity, offline.')
52
+ sub = parser.add_subparsers(dest='command', required=True)
53
+ f = sub.add_parser('freeze')
54
+ f.add_argument('cases')
55
+ f.add_argument('--metrics', required=True)
56
+ f.add_argument('--output', required=True)
57
+ a = sub.add_parser('audit')
58
+ a.add_argument('manifest')
59
+ a.add_argument('--run', action='append', required=True, metavar='NAME=FILE')
60
+ a.add_argument('--output')
61
+ pf = sub.add_parser('promptfoo-freeze', help='Freeze narrow prospective inline Promptfoo tests.')
62
+ pf.add_argument('tests')
63
+ pf.add_argument('--grader', required=True)
64
+ pf.add_argument('--output', required=True)
65
+ pa = sub.add_parser('promptfoo-audit', help='Audit explicitly selected Promptfoo JSON export slices.')
66
+ pa.add_argument('manifest')
67
+ pa.add_argument('--run', action='append', required=True, metavar='NAME=FILE')
68
+ pa.add_argument('--selections', required=True, help='Strict JSON run-label to provider/prompt/grader map.')
69
+ pa.add_argument('--output')
70
+ d = sub.add_parser('manifest-diff', help='Compare two prospective contracts, not run scores.')
71
+ d.add_argument('previous')
72
+ d.add_argument('current')
73
+ d.add_argument('--output')
74
+ try:
75
+ args = parser.parse_args(argv)
76
+ except (OSError, ValueError):
77
+ _error('output delivery failed')
78
+ try:
79
+ if args.command == 'manifest-diff':
80
+ from .manifestdiff import compare_manifests
81
+ if args.output and Path(args.output).resolve() in {Path(args.previous).resolve(), Path(args.current).resolve()}:
82
+ raise InputError('output must not replace an input')
83
+ result = compare_manifests(read_json(args.previous), read_json(args.current))
84
+ elif args.command == 'freeze':
85
+ if Path(args.output).resolve() in {Path(args.cases).resolve(), Path(args.metrics).resolve()}:
86
+ raise InputError('output must not replace an input')
87
+ result = freeze(read_jsonl(args.cases), read_json(args.metrics))
88
+ elif args.command == 'promptfoo-freeze':
89
+ from .promptfoo import manifest_from_inline_tests
90
+ if Path(args.output).resolve() == Path(args.tests).resolve():
91
+ raise InputError('output must not replace an input')
92
+ result = manifest_from_inline_tests(read_json(args.tests), grader=args.grader)
93
+ else:
94
+ runs = {}
95
+ for item in args.run:
96
+ name, sep, path = item.partition('=')
97
+ if not sep or not name or not path or name in runs:
98
+ raise InputError('run labels must be unique NAME=FILE entries')
99
+ runs[name] = read_json(path) if args.command == 'promptfoo-audit' else read_jsonl(path)
100
+ inputs = ({Path(args.manifest).resolve()}
101
+ | {Path(item.partition('=')[2]).resolve() for item in args.run})
102
+ if args.command == 'promptfoo-audit':
103
+ inputs.add(Path(args.selections).resolve())
104
+ if args.output and Path(args.output).resolve() in inputs:
105
+ raise InputError('output must not replace an input')
106
+ if args.command == 'promptfoo-audit':
107
+ from .promptfoo import audit_promptfoo_exports
108
+ result = audit_promptfoo_exports(read_json(args.manifest), runs, read_json(args.selections))
109
+ else:
110
+ result = audit(read_json(args.manifest), runs)
111
+ text = json.dumps(result, sort_keys=True, indent=2, allow_nan=False) + '\n'
112
+ if args.output:
113
+ _write(args.output, text)
114
+ else:
115
+ _write_text(sys.stdout, text)
116
+ return 1 if result.get('status') in ('BLOCKED', 'CHANGED') else 0
117
+ except InputError as error:
118
+ # InputError messages are controlled diagnostics, never raw values.
119
+ _error(str(error), args.command == 'manifest-diff')
120
+ except (OSError, UnicodeError, ValueError):
121
+ _error('input or output I/O error', args.command == 'manifest-diff')
122
+
123
+
124
+ def cli(argv=None):
125
+ """Terminating entry point; embedded main leaves caller streams open."""
126
+ try:
127
+ code = main(argv)
128
+ except SystemExit as error:
129
+ code = error.code if isinstance(error.code, int) else 0 if error.code is None else 1
130
+ for name in ('stdout', 'stderr'):
131
+ stream = getattr(sys, name)
132
+ if stream is None:
133
+ continue
134
+ try:
135
+ stream.flush()
136
+ except (OSError, ValueError):
137
+ # Do not retry an already-failing stream at interpreter shutdown,
138
+ # which could replace the documented exit 2 with CPython's exit 120.
139
+ setattr(sys, name, None)
140
+ code = 2
141
+ return code
142
+
143
+
144
+ if __name__ == '__main__':
145
+ raise SystemExit(cli())
evaldenom/core.py ADDED
@@ -0,0 +1,265 @@
1
+ """A small strict contract between an intended evaluation and run exports.
2
+
3
+ No model calls, result selection, imputation, retry, statistics or data editing.
4
+ Digests bind the supplied JSON values, not the actual prompts a model saw.
5
+ """
6
+ import hashlib
7
+ import json
8
+ import math
9
+ import re
10
+ from collections import Counter
11
+ from pathlib import Path
12
+
13
+
14
+ class InputError(ValueError):
15
+ """Unusable input; diagnostics intentionally omit captured values."""
16
+
17
+
18
+ def _unique(pairs):
19
+ result = {}
20
+ for key, value in pairs:
21
+ if key in result:
22
+ raise InputError('repeated JSON object member')
23
+ result[key] = value
24
+ return result
25
+
26
+
27
+ def _constant(_):
28
+ raise InputError('non-JSON numeric constant')
29
+
30
+
31
+ def loads(text):
32
+ try:
33
+ return json.loads(text, object_pairs_hook=_unique, parse_constant=_constant)
34
+ except InputError:
35
+ raise
36
+ except (ValueError, RecursionError):
37
+ raise InputError('JSON decoding failed or exceeded runtime limits') from None
38
+
39
+
40
+ def read_json(path):
41
+ try:
42
+ return loads(Path(path).read_text(encoding='utf-8'))
43
+ except (OSError, UnicodeError):
44
+ raise InputError('cannot read UTF-8 JSON input') from None
45
+
46
+
47
+ def read_jsonl(path):
48
+ rows = []
49
+ try:
50
+ with open(path, encoding='utf-8') as stream:
51
+ for line, text in enumerate(stream, 1):
52
+ if not text.strip():
53
+ continue
54
+ try:
55
+ rows.append((line, loads(text)))
56
+ except InputError as error:
57
+ raise InputError('JSONL line %d: %s' % (line, error)) from None
58
+ except (OSError, UnicodeError):
59
+ raise InputError('cannot read UTF-8 JSONL input') from None
60
+ return rows
61
+
62
+
63
+ def _keys(value, required, optional=()):
64
+ if not isinstance(value, dict) or set(value) - set(required) - set(optional) or not set(required) <= set(value):
65
+ raise InputError('object fields do not match the declared format')
66
+
67
+
68
+ def _label(value):
69
+ if not isinstance(value, str) or not value:
70
+ raise InputError('identifiers must be nonempty strings')
71
+ return value
72
+
73
+
74
+ def _trials(values):
75
+ if (not isinstance(values, list) or not values
76
+ or any(type(v) is not int or v < 1 for v in values)
77
+ or len(set(values)) != len(values)):
78
+ raise InputError('trials must be a nonempty unique list of positive integers')
79
+ return sorted(values)
80
+
81
+
82
+ def _number(value):
83
+ if type(value) not in (int, float):
84
+ return False
85
+ try:
86
+ return math.isfinite(value)
87
+ except OverflowError:
88
+ return False
89
+
90
+
91
+ def _metrics(value):
92
+ if not isinstance(value, list) or not value:
93
+ raise InputError('metrics must be a nonempty list')
94
+ result = {}
95
+ for item in value:
96
+ _keys(item, ('name', 'direction', 'grader'), ('min', 'max'))
97
+ name = _label(item['name'])
98
+ _label(item['grader'])
99
+ if item['direction'] not in ('higher', 'lower'):
100
+ raise InputError('metric direction must be higher or lower')
101
+ if name in result:
102
+ raise InputError('metric names must be unique')
103
+ if any(not _number(item[k]) for k in ('min', 'max') if k in item):
104
+ raise InputError('metric bounds must be finite real numbers')
105
+ if 'min' in item and 'max' in item and item['min'] > item['max']:
106
+ raise InputError('metric minimum exceeds maximum')
107
+ result[name] = dict(item)
108
+ return result
109
+
110
+
111
+ def input_digest(value):
112
+ """Versioned Python JSON canonical form; not cross-language JCS.
113
+
114
+ JSON types and array order are kept. Object order is ignored. Numbers
115
+ 1 and 1.0 differ. Raw whitespace/escape spelling is not represented.
116
+ """
117
+ # Serialize first: JSON's circular-reference check prevents a cyclic
118
+ # Python API input from making the iterative type check loop forever.
119
+ try:
120
+ text = json.dumps(value, ensure_ascii=True, sort_keys=True,
121
+ separators=(',', ':'), allow_nan=False)
122
+ except (TypeError, ValueError, RecursionError):
123
+ raise InputError('input serialization failed or exceeded runtime limits') from None
124
+ pending = [value]
125
+ while pending:
126
+ item = pending.pop()
127
+ if isinstance(item, dict):
128
+ if any(type(k) is not str for k in item):
129
+ raise InputError('input object keys must be strings')
130
+ pending.extend(item.values())
131
+ elif isinstance(item, list):
132
+ pending.extend(item)
133
+ elif type(item) not in (type(None), bool, str, int, float):
134
+ raise InputError('input must contain JSON values only')
135
+ elif type(item) is float and not math.isfinite(item):
136
+ raise InputError('input numbers must be finite')
137
+ return 'pyjson-v1:' + hashlib.sha256(text.encode('ascii')).hexdigest()
138
+
139
+
140
+ _DIGEST = re.compile(r'pyjson-v1:[0-9a-f]{64}\Z')
141
+
142
+
143
+ def freeze(case_rows, metric_specs):
144
+ """Freeze intended cases from [(physical_line, JSON_object),...]."""
145
+ metrics = _metrics(metric_specs)
146
+ cases, seen = [], set()
147
+ for line, row in case_rows:
148
+ _keys(row, ('id', 'input', 'trials'), ('cluster',))
149
+ ident = _label(row['id'])
150
+ if ident in seen:
151
+ raise InputError('duplicate intended case identity at line %d' % line)
152
+ seen.add(ident)
153
+ case = {'id': ident, 'input_digest': input_digest(row['input']),
154
+ 'trials': _trials(row['trials'])}
155
+ if 'cluster' in row:
156
+ case['cluster'] = _label(row['cluster'])
157
+ cases.append(case)
158
+ if not cases:
159
+ raise InputError('intended case manifest must be nonempty')
160
+ return {'schema_version': 1, 'metrics': list(metrics.values()),
161
+ 'cases': sorted(cases, key=lambda c: c['id'])}
162
+
163
+
164
+ def validate_manifest(value):
165
+ _keys(value, ('schema_version', 'metrics', 'cases'))
166
+ if type(value['schema_version']) is not int or value['schema_version'] != 1:
167
+ raise InputError('unsupported manifest schema version')
168
+ metrics = _metrics(value['metrics'])
169
+ if not isinstance(value['cases'], list) or not value['cases']:
170
+ raise InputError('manifest cases must be nonempty')
171
+ cases = {}
172
+ for case in value['cases']:
173
+ _keys(case, ('id', 'input_digest', 'trials'), ('cluster',))
174
+ ident = _label(case['id'])
175
+ if ident in cases:
176
+ raise InputError('duplicate intended case identity')
177
+ if not isinstance(case['input_digest'], str) or not _DIGEST.fullmatch(case['input_digest']):
178
+ raise InputError('unsupported input digest')
179
+ _trials(case['trials'])
180
+ if 'cluster' in case:
181
+ _label(case['cluster'])
182
+ cases[ident] = case
183
+ return cases, metrics
184
+
185
+
186
+ def audit(manifest, runs):
187
+ """Audit named runs, returning coverage findings, never a partial score.
188
+
189
+ runs maps a unique run name to [(physical_line, JSON_object),...].
190
+ Malformed envelopes raise InputError. Valid incomplete/error evidence is
191
+ reported as blocking, preserving other rows rather than fabricating success.
192
+ """
193
+ cases, metrics = validate_manifest(manifest)
194
+ if not isinstance(runs, dict) or len(runs) < 2:
195
+ raise InputError('supply at least two separately named runs')
196
+ expected = {(ident, trial) for ident, case in cases.items() for trial in case['trials']}
197
+ reports = {}
198
+ for label, rows in runs.items():
199
+ _label(label)
200
+ counts, findings = Counter(), []
201
+ for line, row in rows:
202
+ _keys(row, ('id', 'trial', 'input_digest', 'metrics'), ('cluster',))
203
+ ident = _label(row['id'])
204
+ if type(row['trial']) is not int or row['trial'] < 1:
205
+ raise InputError('run trial must be a positive integer')
206
+ if not isinstance(row['input_digest'], str) or not _DIGEST.fullmatch(row['input_digest']):
207
+ raise InputError('run input digest is malformed')
208
+ if not isinstance(row['metrics'], dict):
209
+ raise InputError('run metrics must be an object')
210
+ key = (ident, row['trial'])
211
+ counts[key] += 1
212
+ def flag(code, metric=None):
213
+ item = {'code': code, 'line': line, 'id': ident, 'trial': row['trial']}
214
+ if metric is not None:
215
+ item['metric'] = metric
216
+ findings.append(item)
217
+ if key not in expected:
218
+ flag('UNEXPECTED_OBSERVATION')
219
+ continue
220
+ case = cases[ident]
221
+ if row['input_digest'] != case['input_digest']:
222
+ flag('INPUT_IDENTITY_MISMATCH')
223
+ if ('cluster' in row) != ('cluster' in case) or row.get('cluster') != case.get('cluster'):
224
+ flag('CLUSTER_MISMATCH')
225
+ for name in sorted(set(row['metrics']) - set(metrics)):
226
+ flag('UNEXPECTED_METRIC', name)
227
+ for name, spec in metrics.items():
228
+ metric = row['metrics'].get(name)
229
+ if metric is None:
230
+ flag('MISSING_METRIC', name)
231
+ continue
232
+ _keys(metric, ('status', 'grader', 'direction'), ('value',))
233
+ if metric['status'] not in ('ok', 'error', 'missing'):
234
+ raise InputError('metric status must be ok, error or missing')
235
+ if metric['grader'] != spec['grader']:
236
+ flag('GRADER_MISMATCH', name)
237
+ if metric['direction'] != spec['direction']:
238
+ flag('DIRECTION_MISMATCH', name)
239
+ if metric['status'] != 'ok':
240
+ flag('METRIC_' + metric['status'].upper(), name)
241
+ elif not _number(metric.get('value')):
242
+ flag('INVALID_SCORE', name)
243
+ elif (('min' in spec and metric['value'] < spec['min'])
244
+ or ('max' in spec and metric['value'] > spec['max'])):
245
+ flag('SCORE_OUT_OF_BOUNDS', name)
246
+ for ident, trial in sorted(expected - counts.keys()):
247
+ findings.append({'code': 'MISSING_OBSERVATION', 'id': ident, 'trial': trial})
248
+ for (ident, trial), count in sorted(counts.items()):
249
+ if count > 1:
250
+ findings.append({'code': 'DUPLICATE_OBSERVATION', 'id': ident,
251
+ 'trial': trial, 'count': count})
252
+ reports[label] = {'expected_observations': len(expected),
253
+ 'supplied_records': sum(counts.values()),
254
+ 'matched_unique_identities': len(expected & counts.keys()),
255
+ 'status': 'BLOCKED' if findings else 'READY', 'findings': findings}
256
+ return {'schema_version': 1, 'manifest_digest': input_digest(manifest),
257
+ 'status': 'BLOCKED' if any(r['findings'] for r in reports.values()) else 'READY',
258
+ 'runs': reports,
259
+ 'limitations': [
260
+ 'READY means supplied exports match the declared contract, not that results are true or statistically comparable.',
261
+ 'Digests and grader labels are caller-supplied claims, not proof of model inputs, execution or evaluator implementation.',
262
+ 'No rows are selected, averaged, dropped, retried or rewritten. No statistical test is run.',
263
+ 'Manifest coverage is only as complete as the supplied intended cases and trials; clusters are labels, not an independence test.',
264
+ 'Reports contain case, cluster and metric identifiers; review them before sharing. Raw inputs and scores are not included.'
265
+ ]}
@@ -0,0 +1,71 @@
1
+ """Compare prospective evaluation contracts without looking at run scores.
2
+
3
+ MATCH means the declared cases, trials, input digests, clusters and metric
4
+ contracts agree. It is not an audit of exports or approval of a changed plan.
5
+ """
6
+ from .core import input_digest, validate_manifest
7
+
8
+
9
+ def compare_manifests(previous, current):
10
+ """Return deterministic contract drift, without modifying either manifest.
11
+
12
+ Manifest list order and trial order do not change the declared contract.
13
+ A missing bound differs from an explicit bound, including zero. Numeric
14
+ bound spellings such as 0 and 0.0 keep ordinary numeric equality, consistent
15
+ with the core audit's score checks. No cases are aligned by position.
16
+ """
17
+ old_cases, old_metrics = validate_manifest(previous)
18
+ new_cases, new_metrics = validate_manifest(current)
19
+ changes = []
20
+
21
+ def change(code, **identity):
22
+ changes.append({'code': code, **identity})
23
+
24
+ for ident in sorted(old_cases.keys() | new_cases.keys()):
25
+ if ident not in old_cases:
26
+ change('CASE_ADDED', id=ident)
27
+ elif ident not in new_cases:
28
+ change('CASE_REMOVED', id=ident)
29
+ else:
30
+ old, new = old_cases[ident], new_cases[ident]
31
+ if old['input_digest'] != new['input_digest']:
32
+ change('INPUT_IDENTITY_CHANGED', id=ident)
33
+ if ('cluster' in old) != ('cluster' in new) or old.get('cluster') != new.get('cluster'):
34
+ change('CLUSTER_CHANGED', id=ident)
35
+ for trial in sorted(set(old['trials']) - set(new['trials'])):
36
+ change('TRIAL_REMOVED', id=ident, trial=trial)
37
+ for trial in sorted(set(new['trials']) - set(old['trials'])):
38
+ change('TRIAL_ADDED', id=ident, trial=trial)
39
+
40
+ for name in sorted(old_metrics.keys() | new_metrics.keys()):
41
+ if name not in old_metrics:
42
+ change('METRIC_ADDED', metric=name)
43
+ elif name not in new_metrics:
44
+ change('METRIC_REMOVED', metric=name)
45
+ else:
46
+ old, new = old_metrics[name], new_metrics[name]
47
+ for field, code in [('grader', 'GRADER_CHANGED'), ('direction', 'DIRECTION_CHANGED'),
48
+ ('min', 'MINIMUM_CHANGED'), ('max', 'MAXIMUM_CHANGED')]:
49
+ if (field in old) != (field in new) or old.get(field) != new.get(field):
50
+ change(code, metric=name)
51
+
52
+ def counts(cases, metrics):
53
+ return {'cases': len(cases), 'observations': sum(len(c['trials']) for c in cases.values()),
54
+ 'metrics': len(metrics)}
55
+
56
+ return {
57
+ 'schema_version': 1,
58
+ 'kind': 'evaldenom.manifest-comparison',
59
+ 'status': 'CHANGED' if changes else 'MATCH',
60
+ 'previous': counts(old_cases, old_metrics),
61
+ 'current': counts(new_cases, new_metrics),
62
+ 'source_manifest_digests': {'previous': input_digest(previous), 'current': input_digest(current)},
63
+ 'changes': changes,
64
+ 'limitations': [
65
+ 'MATCH compares supplied prospective contracts, not export coverage, actual model inputs or result quality.',
66
+ 'CHANGED describes drift; it does not approve a new denominator, rubric or experiment plan.',
67
+ 'Case, metric and cluster labels and input digests are caller claims, not provenance attestation.',
68
+ 'Source digests identify supplied manifests, including list order; they can differ when contracts MATCH.',
69
+ 'Reports include case and metric identifiers; review them before sharing. Raw inputs, digest values per case and scores are not included.',
70
+ ],
71
+ }
evaldenom/promptfoo.py ADDED
@@ -0,0 +1,161 @@
1
+ """Experimental narrow offline Promptfoo JSON API.
2
+
3
+ Exact current SDK summary v3, explicit provider/prompt selection, repeated runs.
4
+ Input identity is (resolved vars, resolved assertions). No model/provider attestation.
5
+ Caller grader label is an explicit claim, just as in the core export contract.
6
+ """
7
+ from .core import InputError, input_digest, freeze, _number
8
+
9
+ def rows_from_summary(summary,*,provider_id,prompt_index,grader):
10
+ if not isinstance(summary,dict) or type(summary.get('version')) is not int or summary['version']!=3:
11
+ raise InputError('only summary schema3 is supported in this probe')
12
+ if not isinstance(summary.get('results'),list):raise InputError('missing results list')
13
+ if not isinstance(provider_id,str) or not provider_id or type(prompt_index) is not int or prompt_index<0 or not isinstance(grader,str) or not grader:
14
+ raise InputError('explicit provider, prompt index and grader required')
15
+ selected=[];excluded=0
16
+ for line,r in enumerate(summary['results'],1):
17
+ if not isinstance(r,dict) or not isinstance(r.get('provider'),dict) or not isinstance(r['provider'].get('id'),str) or type(r.get('promptIdx')) is not int:
18
+ raise InputError('unusable export row identity')
19
+ if r['provider']['id']!=provider_id or r['promptIdx']!=prompt_index:
20
+ excluded+=1;continue
21
+ test=r.get('testCase')
22
+ if not isinstance(test,dict) or not isinstance(test.get('metadata'),dict):raise InputError('missing external metadata identity')
23
+ ident=test['metadata'].get('external_case_id')
24
+ if not isinstance(ident,str) or not ident:raise InputError('missing external metadata identity')
25
+ repeat=r.get('repeatIndex')
26
+ if type(repeat) is not int or repeat<0:raise InputError('explicit zero-based repeatIndex required')
27
+ if not isinstance(r.get('vars'),dict) or not isinstance(test.get('assert'),list) or not test['assert']:raise InputError('resolved vars and assertions required')
28
+ reason=r.get('failureReason')
29
+ if type(reason) is not int or reason not in (0,1,2):raise InputError('unknown failure reason')
30
+ if type(r.get('success')) is not bool or (reason==0)!=r['success']:raise InputError('contradictory success/failure reason')
31
+ metric={'status':'error' if reason==2 else 'ok','grader':grader,'direction':'higher'}
32
+ if reason!=2:
33
+ # Assertion failures can carry error text and score0. Provider errors
34
+ # remain errors even with stale numeric scores.
35
+ g=r.get('gradingResult')
36
+ if (not isinstance(g,dict) or type(g.get('pass')) is not bool
37
+ or g['pass']!=r['success'] or not _number(g.get('score'))
38
+ or not _number(r.get('score'))
39
+ or g['score']!=r.get('score')):
40
+ raise InputError('missing or contradictory aggregate grading evidence')
41
+ metric['value']=r.get('score')
42
+ identity={'vars':r['vars'],'assert':test['assert']}
43
+ selected.append((line,{'id':ident,'trial':repeat+1,'input_digest':input_digest(identity),'metrics':{'aggregate':metric}}))
44
+ if not selected:raise InputError('explicit selection matched no observations')
45
+ return {'rows':selected,'selection':{'provider_id':provider_id,'prompt_index':prompt_index},'source_records':len(summary['results']),'excluded_by_explicit_selection':excluded}
46
+
47
+
48
+ def manifest_from_inline_tests(tests, *, grader):
49
+ """Prospective narrow inline-test plan. Call BEFORE evaluate, not on exports.
50
+
51
+ Only scalar vars, literal equals/contains assertions and options.repeat are
52
+ supported. No file refs, defaultTest, scenarios, transforms or generators.
53
+ This is a prototype, not a general Promptfoo configuration resolver.
54
+ """
55
+ if not isinstance(tests,list) or not tests:
56
+ raise InputError('nonempty prospective inline tests required')
57
+ if not isinstance(grader,str) or not grader:
58
+ raise InputError('explicit grader required')
59
+ rows=[]
60
+ intended_observations=0
61
+ for line,test in enumerate(tests,1):
62
+ if not isinstance(test,dict) or set(test)-{'vars','assert','metadata','description','options'}:
63
+ raise InputError('unsupported inline test field')
64
+ if not isinstance(test.get('metadata'),dict):
65
+ raise InputError('explicit external case identity required')
66
+ ident=test['metadata'].get('external_case_id')
67
+ if not isinstance(ident,str) or not ident:
68
+ raise InputError('explicit external case identity required')
69
+ variables=test.get('vars')
70
+ if not isinstance(variables,dict) or any(type(v) not in (str,int,float,bool,type(None)) for v in variables.values()):
71
+ raise InputError('only non-expanding scalar vars supported')
72
+ assertions=test.get('assert')
73
+ if not isinstance(assertions,list) or not assertions:
74
+ raise InputError('explicit literal assertions required')
75
+ for assertion in assertions:
76
+ if (not isinstance(assertion,dict) or set(assertion)!={'type','value'}
77
+ or assertion['type'] not in ('equals','contains')
78
+ or not isinstance(assertion['value'],str)
79
+ or 'file://' in assertion['value'] or '{{' in assertion['value'] or '{%' in assertion['value']):
80
+ raise InputError('only literal equals/contains assertions supported')
81
+ options=test.get('options')
82
+ if not isinstance(options,dict) or set(options)!={'repeat'}:
83
+ raise InputError('explicit per-test repeat only; no options inheritance')
84
+ count=options['repeat']
85
+ if type(count) is not int or count<2:
86
+ raise InputError('prototype requires repeat at least 2; single trials lack exported repeatIndex')
87
+ intended_observations+=count
88
+ if intended_observations>100000:
89
+ raise InputError('prototype supports at most 100000 intended observations')
90
+ rows.append((line,{'id':ident,'input':{'vars':variables,'assert':assertions},'trials':list(range(1,count+1))}))
91
+ return freeze(rows,[{'name':'aggregate','grader':grader,'direction':'higher','min':0,'max':1}])
92
+
93
+
94
+ def summary_from_json_export(value):
95
+ """Read the current on-disk JSON wrapper, without inferring older formats."""
96
+ if not isinstance(value,dict) or not isinstance(value.get('evalId'),str) or not isinstance(value.get('results'),dict):
97
+ raise InputError('expected pinned Promptfoo JSON export wrapper')
98
+ summary=value['results']
99
+ if type(summary.get('version')) is not int or summary['version']!=3:
100
+ raise InputError('expected nested summary schema3')
101
+ return summary
102
+
103
+
104
+ def audit_promptfoo_exports(manifest, exports, selections):
105
+ """Audit explicitly selected provider/prompt slices from current JSON exports.
106
+
107
+ exports maps run labels to parsed JSON wrapper objects, NOT filenames.
108
+ selections maps the identical labels to provider_id, prompt_index and grader.
109
+ Selection is deliberate and visible; never represented as whole-export audit.
110
+ """
111
+ if (not isinstance(exports,dict) or len(exports)<2
112
+ or not isinstance(selections,dict) or set(exports)!=set(selections)):
113
+ raise InputError('at least two exports with exactly matching selections required')
114
+ runs={}
115
+ provenance={}
116
+ for name,value in exports.items():
117
+ selection=selections[name]
118
+ if not isinstance(selection,dict) or set(selection)!={'provider_id','prompt_index','grader'}:
119
+ raise InputError('each explicit selection needs provider_id, prompt_index and grader')
120
+ converted=rows_from_summary(summary_from_json_export(value),**selection)
121
+ runs[name]=converted['rows']
122
+ provenance[name]={
123
+ 'format':'promptfoo-0.125.1-json-summary-v3',
124
+ 'selection':dict(selection),
125
+ 'source_records':converted['source_records'],
126
+ 'selected_records':len(converted['rows']),
127
+ 'excluded_by_explicit_selection':converted['excluded_by_explicit_selection'],
128
+ }
129
+ from .core import audit
130
+ report=audit(manifest,runs)
131
+ report['source_adapters']=provenance
132
+ report['limitations']=[
133
+ 'Only the explicitly selected provider/prompt slice in each export is audited; other rows are excluded with counts.',
134
+ 'Input identity binds exported vars and literal assertion definitions, not prompts, provider settings or model execution.',
135
+ 'Grader labels are caller claims. An aggregate score is not per-assertion evaluator attestation.',
136
+ 'Prospective inline-test freeze is valid only if those exact tests are executed without inherited defaults, transformations or expansion.',
137
+ ]+[item.replace('No rows are selected, averaged, dropped, retried or rewritten.',
138
+ 'Within each selected slice, no rows are averaged, dropped, retried or rewritten.') for item in report['limitations']]
139
+ return report
140
+
141
+
142
+ def manifest_from_inline_tests_text(text, *, grader):
143
+ """Strict JSON text entry point. Repeated members/NaN never last-win."""
144
+ from .core import loads
145
+ if not isinstance(text,str):
146
+ raise InputError('prospective plan must be UTF-8 decoded JSON text')
147
+ return manifest_from_inline_tests(loads(text),grader=grader)
148
+
149
+
150
+ def audit_promptfoo_export_texts(manifest_text, export_texts, selections):
151
+ """Strict text boundary for untrusted files, before any dict conversion.
152
+
153
+ The object-level helpers cannot recover repeated JSON members lost by a
154
+ caller's parser. File callers should read UTF-8 text and use this function.
155
+ """
156
+ from .core import loads
157
+ if (not isinstance(manifest_text,str) or not isinstance(export_texts,dict)
158
+ or any(not isinstance(text,str) for text in export_texts.values())):
159
+ raise InputError('manifest and exports must be UTF-8 decoded JSON text')
160
+ return audit_promptfoo_exports(loads(manifest_text),
161
+ {label:loads(text) for label,text in export_texts.items()},selections)
@@ -0,0 +1,242 @@
1
+ Metadata-Version: 2.4
2
+ Name: evaldenom
3
+ Version: 0.1.0
4
+ Summary: Offline intended-coverage and identity preflight for evaluation exports
5
+ Author: Anish Pentyala
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/anishpentyala/evaldenom
8
+ Project-URL: Repository, https://github.com/anishpentyala/evaldenom
9
+ Project-URL: Issues, https://github.com/anishpentyala/evaldenom/issues
10
+ Keywords: evaluation,data-validation,machine-learning
11
+ Requires-Python: >=3.9
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Dynamic: license-file
15
+
16
+ # evaldenom
17
+
18
+ [![Tests](https://github.com/anishpentyala/evaldenom/actions/workflows/ci.yml/badge.svg)](https://github.com/anishpentyala/evaldenom/actions)
19
+
20
+ Check that evaluation exports cover the cases you intended to measure before
21
+ comparing their scores. Offline, Python standard library only.
22
+
23
+ A paired comparison can look better because a hard case errored, disappeared,
24
+ changed its input under the same ID, used a different grader, or lost a repeated
25
+ trial. Statistical comparison tools often report their matched subset. This tool
26
+ asks a prior question: do both supplied exports satisfy the same intended contract?
27
+
28
+ It does not run models, compute significance, pick a best run, average repeated
29
+ trials, fill missing scores, retry requests, or change your dataset. A READY
30
+ report is a coverage/identity check on supplied claims, not proof that the model
31
+ saw those inputs or that an evaluator was implemented correctly.
32
+
33
+ ## Try the missing-case check
34
+
35
+ Python 3.9 or newer, no runtime dependencies. The repository includes an invented
36
+ four-observation fixture: two cases with two trials each. The candidate drops
37
+ both hard-case trials.
38
+
39
+ ```sh
40
+ git clone https://github.com/anishpentyala/evaldenom.git
41
+ cd evaldenom
42
+ python -m pip install .
43
+ evaldenom freeze examples/cases.jsonl --metrics examples/metrics.json --output manifest.json
44
+ evaldenom audit manifest.json --run baseline=examples/baseline.jsonl --run candidate=examples/candidate-missing.jsonl
45
+ ```
46
+
47
+ The audit exits 1 with `BLOCKED`, rather than approving comparison on only the
48
+ easy cases. Replace `candidate-missing.jsonl` with `candidate-complete.jsonl` for
49
+ an exit-0 `READY` report. Neither verdict establishes a score gain or verifies
50
+ that the claimed inputs and graders were actually used.
51
+
52
+ A PyPI release is being prepared. Until its package page is linked here, use the
53
+ source-install commands above.
54
+
55
+ ## Check a changed evaluation plan before running it
56
+
57
+ An audit checks exports against one intended manifest. Before executing a changed
58
+ plan, compare its frozen contract with the earlier one:
59
+
60
+ ```sh
61
+ evaldenom manifest-diff previous-manifest.json proposed-manifest.json --output drift.json
62
+ ```
63
+
64
+ Exit 0 means `MATCH`: declared cases, input digests, trials, cluster labels and
65
+ metric contracts agree. Exit 1 means `CHANGED`: the report names added/removed
66
+ cases, changed inputs or clusters, added/removed trials, and changes to metric
67
+ names, graders, directions or bounds. Exit 2 means unusable input or an output
68
+ error, with no new comparison verdict. Standard output must accept the complete report
69
+ and flush successfully before exit 0 or 1; failed help/diagnostic delivery also
70
+ exits 2. A broken destination can retain a partial JSON prefix, so a report is
71
+ usable only with its successful delivery and expected exit status. Both manifests are fully validated first;
72
+ an old output is left untouched on input errors, so check the exit status.
73
+
74
+ Case/metric list order and trial order do not matter. A missing bound differs
75
+ from an explicit bound. Numeric bounds such as `0` and `0.0` are equivalent,
76
+ matching the core audit's numeric comparisons. Nothing aligns cases by position,
77
+ selects a common subset or approves dropping a difficult case. Source-manifest
78
+ hashes identify the supplied files' JSON values, including list order, so these
79
+ hashes may differ even when the declared contracts match.
80
+
81
+ This command reads only prospective manifests, not run exports or scores. It
82
+ helps inspect denominator/rubric drift before spending on an experiment. It does
83
+ not approve the new plan or establish actual model inputs, grader implementation
84
+ or statistical comparability. Reports contain case and metric identifiers; review
85
+ them before sharing. Per-case input hashes, raw inputs and score values are not
86
+ copied into the change list. The existing `audit` command still decides export
87
+ coverage against the chosen manifest; `MATCH` is never an audit `READY` verdict.
88
+
89
+ Python callers can use `evaldenom.manifestdiff.compare_manifests(previous, current)`
90
+ with parsed manifests. File callers should use the CLI's strict JSON boundary,
91
+ which rejects repeated object members and non-JSON numeric constants.
92
+
93
+ ## Install from source
94
+
95
+ ```sh
96
+ git clone https://github.com/anishpentyala/evaldenom.git
97
+ cd evaldenom
98
+ python -m pip install .
99
+ ```
100
+
101
+ Python 3.9 or newer. Runtime dependencies: none.
102
+
103
+ ## Workflow
104
+
105
+ 1. Declare intended cases before running the experiment. Each JSONL record:
106
+
107
+ ```json
108
+ {"id":"case-1","input":{"question":"Example?"},"trials":[1,2],"cluster":"source-document-1"}
109
+ ```
110
+
111
+ IDs and cluster labels are exact nonempty strings. Trials are explicit positive
112
+ integers, never inferred from the largest observed trial. Cluster is optional;
113
+ when declared, every export must match it exactly. It is metadata, not an
114
+ independence test. Numeric `1`, string `"1"`, and boolean `true` do not alias.
115
+
116
+ 2. Declare metric contracts in a JSON array:
117
+
118
+ ```json
119
+ [{"name":"accuracy","grader":"exact-match-v1","direction":"higher","min":0,"max":1}]
120
+ ```
121
+
122
+ `grader` is a caller-chosen version label. Use a version/digest that actually
123
+ identifies your scoring implementation. Bounds are optional finite numbers.
124
+ Direction is `higher` or `lower`. Every intended case/trial must report every
125
+ metric; subsets, extra metrics and silent grader/direction changes block READY.
126
+
127
+ ```sh
128
+ python -m evaldenom freeze examples/cases.jsonl --metrics examples/metrics.json --output manifest.json
129
+ ```
130
+
131
+ The manifest keeps input digests, not raw inputs. `pyjson-v1` uses Python JSON
132
+ serialization with sorted object keys, compact separators and ASCII escaping,
133
+ then SHA-256. Array order and JSON value types matter; `1` and `1.0` differ.
134
+ Object order, whitespace and escape spelling do not. This is not RFC8785 JCS,
135
+ a cross-language canonicalization promise, anonymization, or signing. Low-entropy
136
+ inputs can be guessed by hashing candidates. Keep your raw inputs privately.
137
+
138
+ 3. Export each run to this explicit format. No framework-specific parser guesses:
139
+
140
+ ```json
141
+ {"id":"case-1","trial":1,"input_digest":"pyjson-v1:...64-lowercase-hex...","cluster":"source-document-1","metrics":{"accuracy":{"status":"ok","grader":"exact-match-v1","direction":"higher","value":1}}}
142
+ ```
143
+
144
+ Use `input_digest(actual_input)` in your exporter, not a copied manifest digest,
145
+ to catch accidental input changes. A copied label cannot prove input identity.
146
+ `status` is `ok`, `error` or `missing`. `ok` needs a finite non-boolean real score
147
+ within any declared bounds. Error/missing remains blocking even if a stale value
148
+ is also present; the tool never treats it as success or zero. Scores are checked,
149
+ not copied into the report.
150
+
151
+ ```sh
152
+ python -m evaldenom audit manifest.json --run baseline=examples/baseline.jsonl --run candidate=examples/candidate-missing.jsonl
153
+ ```
154
+
155
+ Exit 0: READY, supplied exports satisfy coverage and identity contracts.
156
+ Exit 1: BLOCKED, report lists missing/duplicate/unexpected observations, metric
157
+ errors and contract mismatches. Exit 2: unusable input or output error, no new
158
+ verdict. Duplicate observations block even if identical: no last-row-wins or
159
+ implicit attempt selection. Change the intended trial plan explicitly instead.
160
+
161
+ At least two separately named runs are required, but they need not represent
162
+ independent experiments. Blank JSONL lines are ignored; findings retain physical
163
+ line numbers. Repeated JSON object members and non-JSON NaN/Infinity are input
164
+ errors, including nested objects. Unknown envelope fields are errors, not silently
165
+ ignored. IDs remain case-sensitive, with no Unicode/whitespace normalization.
166
+
167
+ `--output report.json` replaces a report only after parsing and auditing finish,
168
+ via a temporary file in that directory. A blocking audit still writes its complete
169
+ report. Input errors preserve the previous report. An output path resolving to
170
+ an input path is rejected. This is not a concurrency-safe file transaction against
171
+ hostile path replacement or a hard-link alias defense.
172
+
173
+ ## Experimental native export API
174
+
175
+ A narrow [Promptfoo JSON API](docs/promptfoo-api.md) supports explicit repeat>=2,
176
+ scalar inline vars and literal equals/contains assertions for current summary-v3
177
+ JSON exports. Python API and explicit CLI, not a general config resolver or default single-trial
178
+ integration. Use its strict JSON-text boundary and read the limits first.
179
+
180
+ ## Example that catches selection bias
181
+
182
+ The synthetic fixture has `easy` and `hard`, each with two intended trials.
183
+ The baseline scores the hard cases at zero. A candidate export containing only
184
+ the easy cases could show 100% on its paired-complete subset. This audit reports
185
+ both missing hard trials and refuses READY. The fixture is invented, not observed
186
+ model performance. Fixing coverage might reveal no gain; coverage alone cannot
187
+ establish a gain either way.
188
+
189
+ ## Scope and existing alternatives
190
+
191
+ This is a small preflight contract, not a new statistical method or an all-purpose
192
+ evaluation platform. Related tools and the behavior their descriptions document
193
+ (checked2026-11-06):
194
+
195
+ - [evaldiff](https://toolkitlabs.org/tools/evaldiff/README.md) computes paired
196
+ statistics, excludes unmatched rows with counts, and warns while keeping the
197
+ last duplicate. Use it for inference after resolving your intended coverage.
198
+ - [abeval](https://github.com/mohammadi-hadi/abeval) offers paired comparisons,
199
+ intervals, power and judge-noise analysis; unmatched items are dropped/reported.
200
+ - [MLflow](https://mlflow.org/docs/latest/genai/eval-monitor/comparing-evaluation-runs/)
201
+ pairs rows, reports unmatched/duplicate rows and skips scorer-error pairs.
202
+ - [errorbars](https://github.com/antonsoo/errorbars) already validates identity,
203
+ cluster assignments and repeated observations, and provides statistical
204
+ inference. It is a stronger alternative when its data model fits your workflow.
205
+ - [eval-run-manifest](https://pypi.org/project/eval-run-manifest/) records run
206
+ provenance and directory digests. This tool instead checks intended
207
+ case/trial/metric closure across supplied exports; neither is execution attestation.
208
+ - [EVALSIG](https://github.com/vtensor/evalsig/blob/main/docs/concepts/paired-vs-unpaired.md)
209
+ explains paired versus unpaired inference. This tool does not choose either test.
210
+
211
+ No claim that these tools hide their exclusions, that this project is unique,
212
+ or that a blocked strict contract invalidates every possible subset analysis.
213
+ A justified subset analysis needs an explicit separate plan, not a silent change
214
+ in denominator.
215
+
216
+ ## Limits
217
+
218
+ - General harness export integration is not provided. A narrow experimental
219
+ Promptfoo JSON API and CLI are available for their documented subset only.
220
+ - A manifest created after seeing results can encode selective inclusion.
221
+ - Input digests, grader versions and cluster labels are supplied claims, not
222
+ authenticated execution evidence. No code/model/dataset attestation.
223
+ - READY does not check uncertainty, statistical dependence, rubric validity,
224
+ sample representativeness, model provenance, leakage or multiple comparisons.
225
+ - Every case has the same declared metric set; sparse metric plans are not supported.
226
+ - Data is retained in memory, including the intended identity set and findings.
227
+ This is not bounded-memory processing for arbitrarily large logs.
228
+ - Finite numbers within Python float range are accepted as scores/bounds.
229
+ No numeric string, bool or extreme integer coercion. No score arithmetic occurs.
230
+ - Reports include case/metric identifiers and run labels; review before sharing.
231
+ Input files and manifests can contain private metadata.
232
+
233
+ ## Development
234
+
235
+ ```sh
236
+ pip install -e . pytest
237
+ python -m pytest -q
238
+ ```
239
+
240
+ Authorship: implementation, documentation and synthetic tests were produced by
241
+ an AI assistant working on Anish's behalf. Anish has not personally reviewed or
242
+ executed them. Early source release, not a published PyPI package. No adoption claim.
@@ -0,0 +1,12 @@
1
+ evaldenom/__init__.py,sha256=mAOCXa9RpfxVhZCJkWo3qcXuyr258CZ1zEZI0HcPzhw,199
2
+ evaldenom/__main__.py,sha256=Opg3cfstgnr8XEDUv8KUmxBmGxugL_79m2usmN20CEg,45
3
+ evaldenom/cli.py,sha256=PMOxYGhVawtjtdltS5b_y5nz79mfb2_M0NqpIdY_IDU,6357
4
+ evaldenom/core.py,sha256=QpUdYs_zY-eIE2lU72ux-h_cD4MdC_G9094SrxQCAYw,11519
5
+ evaldenom/manifestdiff.py,sha256=gHJwKhPCFuZedCMSMy7W874GAv1YSYuUnStnztwyX6M,3621
6
+ evaldenom/promptfoo.py,sha256=NAHbMKf6HSwiqAsq9QnG6T2nZMFL4dHObr58tglUlBs,9985
7
+ evaldenom-0.1.0.dist-info/licenses/LICENSE,sha256=5yembAmR4hjWu7NOBFMDqvjvtnM8Ta_OGaPrAsVcI-I,1071
8
+ evaldenom-0.1.0.dist-info/METADATA,sha256=GRX2RJwgdzCx_OMEidM9c4VcyI_q7wEQbpHqkZXVnhs,12390
9
+ evaldenom-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
10
+ evaldenom-0.1.0.dist-info/entry_points.txt,sha256=9nx0OeUOZpcYhT-5Eg0U8nq1YLVpY5Fa5oZ569M1ySA,48
11
+ evaldenom-0.1.0.dist-info/top_level.txt,sha256=gQCKnp_eU2DfsSnyS9d4kGSy7CGWX6HB8TZkMaTToRk,10
12
+ evaldenom-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ evaldenom = evaldenom.cli:cli
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anish Pentyala
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ evaldenom