gigai-core 0.1.0__tar.gz

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.
Files changed (134) hide show
  1. gigai_core-0.1.0/.gitignore +10 -0
  2. gigai_core-0.1.0/CHANGELOG.md +80 -0
  3. gigai_core-0.1.0/LICENSE +201 -0
  4. gigai_core-0.1.0/PKG-INFO +193 -0
  5. gigai_core-0.1.0/README.md +165 -0
  6. gigai_core-0.1.0/pyproject.toml +69 -0
  7. gigai_core-0.1.0/src/gigai_core/__init__.py +91 -0
  8. gigai_core-0.1.0/src/gigai_core/_vendor/__init__.py +1 -0
  9. gigai_core-0.1.0/src/gigai_core/_vendor/autoevals/DIFF.md +27 -0
  10. gigai_core-0.1.0/src/gigai_core/_vendor/autoevals/LICENSE +21 -0
  11. gigai_core-0.1.0/src/gigai_core/_vendor/autoevals/__init__.py +7 -0
  12. gigai_core-0.1.0/src/gigai_core/_vendor/autoevals/templates/battle.yaml +18 -0
  13. gigai_core-0.1.0/src/gigai_core/_vendor/autoevals/templates/closed_q_a.yaml +15 -0
  14. gigai_core-0.1.0/src/gigai_core/_vendor/autoevals/templates/factuality.yaml +25 -0
  15. gigai_core-0.1.0/src/gigai_core/_vendor/autoevals/templates/humor.yaml +8 -0
  16. gigai_core-0.1.0/src/gigai_core/_vendor/autoevals/templates/possible.yaml +19 -0
  17. gigai_core-0.1.0/src/gigai_core/_vendor/autoevals/templates/security.yaml +8 -0
  18. gigai_core-0.1.0/src/gigai_core/_vendor/autoevals/templates/sql.yaml +19 -0
  19. gigai_core-0.1.0/src/gigai_core/_vendor/autoevals/templates/summary.yaml +17 -0
  20. gigai_core-0.1.0/src/gigai_core/_vendor/autoevals/templates/translation.yaml +15 -0
  21. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/DIFF.md +306 -0
  22. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/LICENSE +21 -0
  23. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/__init__.py +7 -0
  24. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/_metric.py +143 -0
  25. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/accuracy.py +40 -0
  26. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/krippendorff.py +215 -0
  27. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/scorers/DIFF.md +1269 -0
  28. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/scorers/__init__.py +12 -0
  29. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/scorers/_common.py +185 -0
  30. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/scorers/_match.py +62 -0
  31. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/scorers/_pattern.py +128 -0
  32. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/scorers/_shim.py +46 -0
  33. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/scorers/_target.py +32 -0
  34. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/scorers/_unicode.py +566 -0
  35. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/scorers/judge_template.py +190 -0
  36. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/scorers/text.py +26 -0
  37. gigai_core-0.1.0/src/gigai_core/_vendor/inspect_ai/std.py +615 -0
  38. gigai_core-0.1.0/src/gigai_core/_vendor/openevals/DIFF.md +21 -0
  39. gigai_core-0.1.0/src/gigai_core/_vendor/openevals/LICENSE +19 -0
  40. gigai_core-0.1.0/src/gigai_core/_vendor/openevals/__init__.py +6 -0
  41. gigai_core-0.1.0/src/gigai_core/_vendor/openevals/prompts/__init__.py +1 -0
  42. gigai_core-0.1.0/src/gigai_core/_vendor/openevals/prompts/correctness.py +43 -0
  43. gigai_core-0.1.0/src/gigai_core/_vendor/openevals/prompts/hallucination.py +43 -0
  44. gigai_core-0.1.0/src/gigai_core/agreement.py +171 -0
  45. gigai_core-0.1.0/src/gigai_core/budget.py +190 -0
  46. gigai_core-0.1.0/src/gigai_core/canonical/__init__.py +43 -0
  47. gigai_core-0.1.0/src/gigai_core/canonical/digest.py +84 -0
  48. gigai_core-0.1.0/src/gigai_core/canonical/encode.py +153 -0
  49. gigai_core-0.1.0/src/gigai_core/comparison.py +402 -0
  50. gigai_core-0.1.0/src/gigai_core/dataset.py +125 -0
  51. gigai_core-0.1.0/src/gigai_core/datasets/NOTICES.md +316 -0
  52. gigai_core-0.1.0/src/gigai_core/datasets/__init__.py +61 -0
  53. gigai_core-0.1.0/src/gigai_core/datasets/contractnli.py +100 -0
  54. gigai_core-0.1.0/src/gigai_core/datasets/data/contractnli.jsonl +10 -0
  55. gigai_core-0.1.0/src/gigai_core/datasets/data/contractnli.sha256 +1 -0
  56. gigai_core-0.1.0/src/gigai_core/datasets/data/ifeval.jsonl +10 -0
  57. gigai_core-0.1.0/src/gigai_core/datasets/data/ifeval.sha256 +1 -0
  58. gigai_core-0.1.0/src/gigai_core/datasets/data/jsonschemabench.jsonl +10 -0
  59. gigai_core-0.1.0/src/gigai_core/datasets/data/jsonschemabench.sha256 +1 -0
  60. gigai_core-0.1.0/src/gigai_core/datasets/data/ragtruth.jsonl +20 -0
  61. gigai_core-0.1.0/src/gigai_core/datasets/data/ragtruth.sha256 +1 -0
  62. gigai_core-0.1.0/src/gigai_core/datasets/data/tinygsm8k.jsonl +10 -0
  63. gigai_core-0.1.0/src/gigai_core/datasets/data/tinygsm8k.sha256 +1 -0
  64. gigai_core-0.1.0/src/gigai_core/datasets/data/tinymmlu.jsonl +10 -0
  65. gigai_core-0.1.0/src/gigai_core/datasets/data/tinymmlu.sha256 +1 -0
  66. gigai_core-0.1.0/src/gigai_core/datasets/ifeval.py +72 -0
  67. gigai_core-0.1.0/src/gigai_core/datasets/jsonschemabench.py +92 -0
  68. gigai_core-0.1.0/src/gigai_core/datasets/judgebench.py +110 -0
  69. gigai_core-0.1.0/src/gigai_core/datasets/loader.py +364 -0
  70. gigai_core-0.1.0/src/gigai_core/datasets/mtbench_human.py +132 -0
  71. gigai_core-0.1.0/src/gigai_core/datasets/quality.py +100 -0
  72. gigai_core-0.1.0/src/gigai_core/datasets/ragtruth.py +117 -0
  73. gigai_core-0.1.0/src/gigai_core/datasets/rewardbench2.py +112 -0
  74. gigai_core-0.1.0/src/gigai_core/datasets/tinygsm8k.py +93 -0
  75. gigai_core-0.1.0/src/gigai_core/datasets/tinymmlu.py +92 -0
  76. gigai_core-0.1.0/src/gigai_core/gate.py +201 -0
  77. gigai_core-0.1.0/src/gigai_core/graders/__init__.py +90 -0
  78. gigai_core-0.1.0/src/gigai_core/graders/builtin.py +386 -0
  79. gigai_core-0.1.0/src/gigai_core/graders/judge.py +547 -0
  80. gigai_core-0.1.0/src/gigai_core/graders/labels.py +185 -0
  81. gigai_core-0.1.0/src/gigai_core/graders/lifted.py +284 -0
  82. gigai_core-0.1.0/src/gigai_core/graders/protocol.py +65 -0
  83. gigai_core-0.1.0/src/gigai_core/models.py +17 -0
  84. gigai_core-0.1.0/src/gigai_core/providers.py +269 -0
  85. gigai_core-0.1.0/src/gigai_core/py.typed +0 -0
  86. gigai_core-0.1.0/src/gigai_core/recorded.py +107 -0
  87. gigai_core-0.1.0/src/gigai_core/records.py +91 -0
  88. gigai_core-0.1.0/src/gigai_core/run.py +602 -0
  89. gigai_core-0.1.0/src/gigai_core/sample.py +70 -0
  90. gigai_core-0.1.0/src/gigai_core/score.py +47 -0
  91. gigai_core-0.1.0/src/gigai_core/stats/__init__.py +99 -0
  92. gigai_core-0.1.0/src/gigai_core/stats/intervals.py +349 -0
  93. gigai_core-0.1.0/src/gigai_core/stats/kappa.py +193 -0
  94. gigai_core-0.1.0/src/gigai_core/stats/passk.py +86 -0
  95. gigai_core-0.1.0/src/gigai_core/stats/power.py +286 -0
  96. gigai_core-0.1.0/src/gigai_core/stats/tests.py +311 -0
  97. gigai_core-0.1.0/src/gigai_core/trace.py +270 -0
  98. gigai_core-0.1.0/src/gigai_core/values.py +11 -0
  99. gigai_core-0.1.0/tests/__init__.py +0 -0
  100. gigai_core-0.1.0/tests/check_wheel.py +59 -0
  101. gigai_core-0.1.0/tests/conftest.py +22 -0
  102. gigai_core-0.1.0/tests/consumer/consumer.py +11 -0
  103. gigai_core-0.1.0/tests/fakes.py +114 -0
  104. gigai_core-0.1.0/tests/fixtures/canonical-vectors.json +23 -0
  105. gigai_core-0.1.0/tests/test_agreement.py +125 -0
  106. gigai_core-0.1.0/tests/test_budget.py +123 -0
  107. gigai_core-0.1.0/tests/test_canonical.py +175 -0
  108. gigai_core-0.1.0/tests/test_compare_gate_keyless.py +59 -0
  109. gigai_core-0.1.0/tests/test_comparison.py +406 -0
  110. gigai_core-0.1.0/tests/test_core_boundary.py +35 -0
  111. gigai_core-0.1.0/tests/test_dataset.py +94 -0
  112. gigai_core-0.1.0/tests/test_datasets.py +484 -0
  113. gigai_core-0.1.0/tests/test_datasets_shipped.py +40 -0
  114. gigai_core-0.1.0/tests/test_datasets_wheel.py +51 -0
  115. gigai_core-0.1.0/tests/test_facade.py +133 -0
  116. gigai_core-0.1.0/tests/test_gate.py +220 -0
  117. gigai_core-0.1.0/tests/test_graders_builtin.py +352 -0
  118. gigai_core-0.1.0/tests/test_graders_catalogue.py +86 -0
  119. gigai_core-0.1.0/tests/test_graders_lifted.py +157 -0
  120. gigai_core-0.1.0/tests/test_judge_validation.py +356 -0
  121. gigai_core-0.1.0/tests/test_labels.py +239 -0
  122. gigai_core-0.1.0/tests/test_layers.py +152 -0
  123. gigai_core-0.1.0/tests/test_lesson_snippets.py +128 -0
  124. gigai_core-0.1.0/tests/test_models_strict.py +221 -0
  125. gigai_core-0.1.0/tests/test_providers.py +172 -0
  126. gigai_core-0.1.0/tests/test_public_api_types.py +292 -0
  127. gigai_core-0.1.0/tests/test_recorded.py +226 -0
  128. gigai_core-0.1.0/tests/test_records.py +127 -0
  129. gigai_core-0.1.0/tests/test_run.py +475 -0
  130. gigai_core-0.1.0/tests/test_run_value.py +249 -0
  131. gigai_core-0.1.0/tests/test_sample_score.py +252 -0
  132. gigai_core-0.1.0/tests/test_stats.py +753 -0
  133. gigai_core-0.1.0/tests/test_stats_lifted.py +454 -0
  134. gigai_core-0.1.0/tests/test_trace.py +150 -0
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .venv/
4
+ dist/
5
+ build/
6
+ *.egg-info/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ .mypy_cache/
10
+ tests/consumer/.mypy_cache/
@@ -0,0 +1,80 @@
1
+ # Changelog
2
+
3
+ Each release is one `## <version> - <date>` block; `release.yml` slices the block of the tagged version into the
4
+ GitHub release notes.
5
+
6
+ ## 0.1.0 - 2026-11-13
7
+
8
+ First release. The library half of GigAI: the evaluation records, graders, statistics and run files that gigai
9
+ 0.3.2 kept inside its CLI, moved into a package with one runtime dependency.
10
+
11
+ ### What ships
12
+
13
+ - `gigai_core.models`: `CoreModel`, the pydantic base of every record (`strict=True`, `frozen=True`,
14
+ `extra="forbid"`, `allow_inf_nan=False`; keyword-only construction). Files are read with `model_validate_json`
15
+ / `TypeAdapter.validate_json` and written with `model_dump_json`; a bad line raises an error that names the file
16
+ and the line (`RunFileError`, `TraceSchemaError`, `LabelFileError`).
17
+ - `gigai_core.canonical`: canonical JSON encoding and sha256 digests (`canonical_json_bytes`,
18
+ `canonical_json_digest`, `sha256_hex`, `digest_imported_bytes`, `parse_json_bytes`).
19
+ - `gigai_core.providers`: the provider seam. `ModelProvider` (a `Protocol`: `identity`, `capabilities`, `invoke`,
20
+ `close`), `CallSettings`, `ModelRequest`, `ModelResult`, `Turn`, `ToolCall`, `ToolSpec`, `TokenUsage`,
21
+ `ProviderIdentity`, `RetryPolicy`, `request_sha256`, `bounded` (a wall-time cap), and `ProviderError` with
22
+ `AuthenticationRequired`, `UnsupportedRequestField`, `OutputNotJSON`, `CallTimedOut`, `CallCancelled`.
23
+ - `gigai_core.budget`: `Budget` (Protocol), `CallBudget` (`max_usd`, `max_calls`, a price table; `plan` refuses a
24
+ run that cannot fit before its first call), `Price`, `Reservation`, `budgeted`, `BudgetExceeded`,
25
+ `CallCapExceeded`.
26
+ - `gigai_core.recorded`: `RecordedProvider`, which answers from stored `ModelSpan`s keyed by
27
+ `(model, request_sha256)` and never calls out.
28
+ - `gigai_core.trace`: the span trace (`TrialSpan`, `TurnSpan`, `ModelSpan`, `ToolSpan`, `ModelCall`,
29
+ `ModelExchange`, `CallError`), `TraceSink` with `ListTrace` and `JsonlTrace` (one JSONL file per run, schema
30
+ `gigai-core-trace:1`), `read_spans`, `TraceSchemaError`.
31
+ - `gigai_core.dataset`: `Dataset`, `DatasetItem`, `DatasetRef`, `SliceRecipe`, `Dataset.of`, `Dataset.from_jsonl`,
32
+ `items_sha256`, `DatasetDigestMismatch`.
33
+ - `gigai_core.datasets`: ten loaders (`DatasetLoader`) and `load_slice`; six `ci` slices ship in the wheel
34
+ (`contractnli`, `ifeval`, `jsonschemabench`, `ragtruth`, `tinygsm8k`, `tinymmlu`); `quality`, `rewardbench2`,
35
+ `judgebench` and `mtbench_human` are download-only (`build_release`). Licences and attributions are in
36
+ `src/gigai_core/datasets/NOTICES.md`, shipped in the wheel.
37
+ - `gigai_core.sample`, `gigai_core.score`, `gigai_core.records`: `Sample`, `Score`, `ScoreRecord`, `JudgeNote`,
38
+ `RunRecord`, `Prereg`, `LabelRecord`, `LabelValue`, `JudgeValidationRecord`.
39
+ - `gigai_core.graders`: one `Grader` Protocol (`id`, `version`, `kind`, `grade(sample, expected) -> Score`), `Judge`
40
+ and `CannotGrade` (for a sample a grader cannot judge), defined in `graders.protocol` and re-exported with every
41
+ constructor from `gigai_core.graders` (40 names). `builtin`: `last_number`, `answer_letter`, `json_valid`,
42
+ `schema_valid`, `label_share`, `bool_field`, `ifeval`, `ranks_first`, `verdict_equals`, `constant`,
43
+ `with_wrong_labels`, `parse_json_text`. `lifted` (the vendored inspect_ai, autoevals and openevals scorers):
44
+ `includes`, `match`, `pattern`, `model_graded_qa`, `autoevals_judge`, `openevals_judge`. `judge`: `llm_judge`,
45
+ `pairwise_judge`, the vendored autoevals templates (`load_template`, `render_template`, `swap_blocks`),
46
+ `JudgeVerdict`. `labels`: `read_labels`, `write_labels`, `labelled`, `LabelFileError`.
47
+ - `gigai_core.run`: `run(dataset, provider, graders, *, settings, budget, ...)` returns a typed `Run`
48
+ (`values`, `trace`, `ungraded`, `contested`); `save_run` / `open_run` (one JSONL file, schema `gigai-core-run:1`,
49
+ `RunFileError` with the line number).
50
+ - `gigai_core.stats`: Wilson and cluster-bootstrap intervals, exact McNemar, Wilcoxon signed-rank, Holm and
51
+ Benjamini-Hochberg corrections, TOST, Cohen's kappa, Krippendorff's alpha, AUC, minimum detectable difference,
52
+ variance components, pass@k.
53
+ - `gigai_core.comparison`: `compare(a, b, metrics)` pairs two runs by item and reports per-metric differences with
54
+ intervals and corrected tests (`Comparison`, `MetricComparison`, `ComparisonRefused`).
55
+ - `gigai_core.gate`: `gate(candidate, baseline, rules)` with `MinLowerBound`, `NoWorseThan`, `HeldOutShare`;
56
+ `GateResult` (fields `status`, `verdicts`, `reason`; properties `passed`, `failed`, `exit_code`).
57
+ - `gigai_core.agreement`: `judge_agreement(run, grader_id, labels)` and `agreement(pairs)` with kappa, swap
58
+ consistency and the validation thresholds (`MIN_KAPPA`, `MIN_UNITS`, `MIN_SWAP`).
59
+ - `gigai_core.__init__`: the façade, 41 names in `__all__`: `run`, `save_run`, `open_run`, `Run`, `Dataset`,
60
+ `DatasetItem`, `CallSettings`, `ModelProvider`, `RecordedProvider`, `CallBudget`, `JsonlTrace`, `read_spans`,
61
+ `compare`, `gate`, `MinLowerBound`, `NoWorseThan`, `cohen_kappa`, `judge_agreement`, `CoreModel`, `read_labels`,
62
+ `write_labels`, and the 20 grader constructors (the eleven `builtin` ones, the six `lifted` ones, `llm_judge`,
63
+ `pairwise_judge`, `labelled`); plus `__version__` from the package metadata.
64
+
65
+ ### Not in 0.1.0
66
+
67
+ - The agent loop, tools and environments (`TurnLimits`, `holds_every_turn`, `state_equals`): 0.2.0.
68
+ - The sqlite ledger, the CLI and the gig layer: they stay in gigai.
69
+ - `RunRecord.prices` is always empty in 0.1.0: the budget exposes no price table for `run` to copy.
70
+
71
+ ### Dependencies and platforms
72
+
73
+ - Required: `pydantic>=2.10,<3`. Nothing else at import time: a plain `pip install gigai-core` loads none of
74
+ `click`, `jsonschema`, `pyarrow`, `numpy`, `yaml`, `sqlite3`, `inspect_ai` or `gigai`.
75
+ - Extras: `schema` (`jsonschema>=4.23`, needed by `graders.builtin.schema_valid`), `parquet` (`pyarrow>=18`, needed
76
+ by `datasets.build_release` for parquet-backed sets), `inspect` (`inspect-ai==0.3.288`,
77
+ `agent-client-protocol<1`).
78
+ - Python 3.11, 3.12 and 3.13; Linux and macOS.
79
+ - Licence `Apache-2.0 AND MIT`: the package is Apache-2.0; the vendored scorers and templates under
80
+ `gigai_core._vendor` (autoevals, inspect_ai, openevals) are MIT, each with its own `LICENSE` and `DIFF.md`.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,193 @@
1
+ Metadata-Version: 2.5
2
+ Name: gigai-core
3
+ Version: 0.1.0
4
+ Summary: Typed evaluation records, graders, statistics and run files for GigAI and the edgelab books.
5
+ License-Expression: Apache-2.0 AND MIT
6
+ License-File: LICENSE
7
+ License-File: src/gigai_core/_vendor/autoevals/LICENSE
8
+ License-File: src/gigai_core/_vendor/inspect_ai/LICENSE
9
+ License-File: src/gigai_core/_vendor/openevals/LICENSE
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Operating System :: MacOS
12
+ Classifier: Operating System :: POSIX :: Linux
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.11
19
+ Requires-Dist: pydantic<3,>=2.10
20
+ Provides-Extra: inspect
21
+ Requires-Dist: agent-client-protocol<1; extra == 'inspect'
22
+ Requires-Dist: inspect-ai==0.3.288; extra == 'inspect'
23
+ Provides-Extra: parquet
24
+ Requires-Dist: pyarrow>=18; extra == 'parquet'
25
+ Provides-Extra: schema
26
+ Requires-Dist: jsonschema>=4.23; extra == 'schema'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # gigai-core
30
+
31
+ The library half of GigAI: typed evaluation records, a provider seam, a local span trace, graders, paired statistics,
32
+ a release gate and one run file format. Every record is a pydantic model (strict, frozen, `extra="forbid"`), every
33
+ file is JSON Lines read through `model_validate_json` and written through `model_dump_json`, and the only runtime
34
+ dependency is `pydantic`. There is no CLI, no server and no database: `run()` takes a dataset, a provider and graders
35
+ and returns a `Run` value. Import name `gigai_core`.
36
+
37
+ ## Install
38
+
39
+ ```text
40
+ pip install gigai-core # pydantic only
41
+ pip install 'gigai-core[schema]' # + jsonschema, for graders.builtin.schema_valid
42
+ pip install 'gigai-core[parquet]' # + pyarrow, for datasets.build_release on parquet-backed sets
43
+ pip install 'gigai-core[inspect]' # + inspect-ai, agent-client-protocol
44
+ ```
45
+
46
+ Python 3.11, 3.12 or 3.13. `schema_valid` without the extra raises
47
+ `ModuleNotFoundError: schema_valid needs the schema extra: pip install 'gigai-core[schema]'`; a parquet build without
48
+ `pyarrow` raises `datasets.ParquetUnavailable`.
49
+
50
+ ## Quickstart
51
+
52
+ The examples below run in order as one script and need no API key: the provider answers from a list. A real
53
+ provider implements the same four members of `gigai_core.providers.ModelProvider` (`identity`, `capabilities`,
54
+ `invoke`, `close`); gigai binds its adapters to it.
55
+
56
+ ```python
57
+ import threading
58
+ from datetime import UTC, datetime
59
+
60
+ from gigai_core.providers import Capability, ModelRequest, ModelResult, ProviderIdentity, TokenUsage
61
+
62
+ NOW = datetime(2026, 1, 1, tzinfo=UTC)
63
+
64
+
65
+ class Scripted:
66
+ """A ModelProvider that answers from a list, in order."""
67
+
68
+ identity = ProviderIdentity(provider="scripted", endpoint="memory", adapter="readme")
69
+ capabilities: frozenset[Capability] = frozenset({"text", "system", "messages"})
70
+
71
+ def __init__(self, replies: list[str]) -> None:
72
+ self._replies = iter(replies)
73
+
74
+ def invoke(self, request: ModelRequest, *, cancel: threading.Event | None = None) -> ModelResult:
75
+ usage = TokenUsage(input_tokens=None, output_tokens=None, total_tokens=None)
76
+ return ModelResult(text=next(self._replies), finish_reason="stop", resolved_model=request.settings.model,
77
+ usage=usage, cost_status="unavailable", cost_usd=None, latency_ms=0,
78
+ started_at=NOW, completed_at=NOW)
79
+
80
+ def close(self) -> None:
81
+ pass
82
+ ```
83
+
84
+ Ask one item, grade the answer with the lifted inspect_ai `includes` scorer, and read the run:
85
+
86
+ ```python
87
+ from gigai_core import CallBudget, CallSettings, Dataset, DatasetItem, includes, run
88
+ from gigai_core.budget import Price
89
+
90
+ dataset = Dataset.of("capitals", (DatasetItem(id="fr", cluster_id="fr", prompt="Capital of France?", expected="Paris"),))
91
+ price = Price(model="some/model", prompt_usd_per_token=1e-6, completion_usd_per_token=1e-6, fetched_at=NOW, source="readme")
92
+ budget = CallBudget(max_usd=0.05, max_calls=20, prices={"some/model": price})
93
+ result = run(dataset, Scripted(["Paris, of course."]), [includes()], settings=CallSettings(model="some/model"), budget=budget)
94
+ print(result.record.spent_usd, result.values("includes")) # 0.0 {'fr': 1.0}
95
+ ```
96
+
97
+ `budget.plan` runs over every planned request before the first call, so a run that cannot fit its cap never
98
+ starts; a money cap needs a price for the model (nothing is guessed).
99
+
100
+ ### The trace
101
+
102
+ Every model call (and, in 0.2.0, every tool call) is a span. With `trace_dir` the spans of a run go to one JSONL
103
+ file, `<trace_dir>/<run_id>.jsonl`; without it they stay in memory on the samples.
104
+
105
+ ```python
106
+ from pathlib import Path
107
+
108
+ settings = CallSettings(model="some/model")
109
+ result = run(dataset, Scripted(["Paris"]), [includes()], settings=settings, budget=CallBudget(max_calls=20), trace_dir=Path("traces"))
110
+ for span in result.trace("fr"):
111
+ print(span.turn, span.kind, span.started_at) # 0 trial ..., 0 model_call ...
112
+ assert result.record.trace_path == Path("traces") / f"{result.record.run_id}.jsonl"
113
+ ```
114
+
115
+ ### Paired comparison and the gate
116
+
117
+ Two runs over the same items are compared item by item (per-cluster bootstrap intervals, exact McNemar for 0/1
118
+ metrics, Holm correction across metrics). A gate turns that into a verdict: `MinLowerBound` asks for a floor on the
119
+ candidate's interval, `NoWorseThan` for a bounded regression against the baseline.
120
+
121
+ ```python
122
+ from gigai_core import MinLowerBound, NoWorseThan, compare, gate, open_run, save_run
123
+
124
+ items = tuple(DatasetItem(id=f"c{n}", cluster_id=f"c{n}", prompt=f"Capital of country {n}?", expected="Paris") for n in range(20))
125
+ twenty = Dataset.of("twenty-capitals", items)
126
+ for name, replies in (("gem", ["Paris"] * 20), ("min", ["Paris"] * 18 + ["Lyon"] * 2)):
127
+ saved = run(twenty, Scripted(replies), [includes()], settings=settings, budget=CallBudget())
128
+ save_run(saved, Path(f"{name}.jsonl"), inputs_by_reference=False)
129
+
130
+ a, b = open_run(Path("gem.jsonl")), open_run(Path("min.jsonl"))
131
+ comparison = compare(a, b, ["includes"])
132
+ verdict = gate(candidate=b, baseline=a, rules=[MinLowerBound(metric="includes", floor=0.6), NoWorseThan(metric="includes", margin=0.05)])
133
+ print(round(comparison.metrics[0].difference, 2), verdict.status, verdict.exit_code) # -0.1 fail 1
134
+ assert not verdict.passed and verdict.failed[0].rule == NoWorseThan(metric="includes", margin=0.05)
135
+ ```
136
+
137
+ `open_run` raises `RunFileError` with the file and line number on a bad line; `save_run` is the only write path and
138
+ refuses to overwrite.
139
+
140
+ ## Modules
141
+
142
+ `from gigai_core import ...` is the façade (`gigai_core.__all__`, 41 names): `run`, `save_run`, `open_run`, `Run`,
143
+ `Dataset`, `DatasetItem`, `CallSettings`, `ModelProvider`, `RecordedProvider`, `CallBudget`, `JsonlTrace`,
144
+ `read_spans`, `compare`, `gate`, `MinLowerBound`, `NoWorseThan`, `cohen_kappa`, `judge_agreement`, `CoreModel`,
145
+ `read_labels`, `write_labels` and the 20 grader constructors. Everything else is imported from its module:
146
+
147
+ - `gigai_core.models`: `CoreModel`, the strict frozen base of every record.
148
+ - `gigai_core.values`: the shared literals (`ParseStatus`, `Outcome`, `Direction`).
149
+ - `gigai_core.canonical`: canonical JSON bytes and sha256 digests.
150
+ - `gigai_core.providers`: the seam (`ModelProvider`, `CallSettings`, `ModelRequest`, `ModelResult`, `ProviderError`).
151
+ - `gigai_core.budget`: `CallBudget`, `Price`, `budgeted`, `BudgetExceeded`.
152
+ - `gigai_core.trace`: the span records, `JsonlTrace`, `ListTrace`, `read_spans`.
153
+ - `gigai_core.dataset`: `Dataset`, `DatasetItem`, `Dataset.of`, `Dataset.from_jsonl`.
154
+ - `gigai_core.datasets`: the ten loaders, `load_slice`, `build_release`, the six shipped slices and `NOTICES.md`.
155
+ - `gigai_core.sample`, `gigai_core.score`, `gigai_core.records`: `Sample`, `Score`, `ScoreRecord`, `RunRecord`, `Prereg`, `LabelRecord`.
156
+ - `gigai_core.recorded`: `RecordedProvider`, replay from stored spans.
157
+ - `gigai_core.graders`: the `Grader` Protocol, `Judge`, `CannotGrade` (defined in `graders.protocol`) and every constructor, re-exported; submodules `builtin`, `lifted`, `judge` (`llm_judge`, `pairwise_judge`), `labels`.
158
+ - `gigai_core.run`: `run`, `Run`, `save_run`, `open_run`.
159
+ - `gigai_core.stats`: intervals, tests, corrections, kappa, alpha, pass@k, power.
160
+ - `gigai_core.comparison`, `gigai_core.gate`, `gigai_core.agreement`: `compare`, `gate`, `judge_agreement`.
161
+
162
+ ## Layering
163
+
164
+ Imports only go downward, and `tests/test_layers.py` fails the build on a violation: `models`, `values` and
165
+ `canonical` import nothing from the package; `providers` sits above them; `budget`, `trace`, `dataset` and `stats`
166
+ above `providers` (`stats` imports only `models` and `values`); then `sample`, `score`, `records`, `datasets`
167
+ (`dataset` only) and `recorded` (`providers` and `trace` only); then `graders`; then `run`; then `comparison`,
168
+ `agreement` and `gate`. No module imports `gigai`, and nothing imports `click`, `jsonschema`, `pyarrow`, `numpy`,
169
+ `yaml` or `sqlite3` at load time; `jsonschema` and `pyarrow` are imported inside the one function each that needs
170
+ them, behind the `schema` and `parquet` extras.
171
+
172
+ ## Typing
173
+
174
+ The package ships `py.typed` and passes pyright strict (`typeCheckingMode = "strict"`, Python 3.11) with no `Any`
175
+ on the public surface; sequence fields are tuples, open maps are `Mapping`, timestamps are aware datetimes, and
176
+ models are constructed by keyword.
177
+
178
+ ## Licences and datasets
179
+
180
+ `Apache-2.0 AND MIT`. The package is Apache-2.0 (`LICENSE`). `gigai_core._vendor` carries scorers and templates
181
+ from inspect_ai, autoevals and openevals under their MIT licences, each with its `LICENSE` and a `DIFF.md` of the
182
+ changes. The six `ci` dataset slices in the wheel (`contractnli`, `ifeval`, `jsonschemabench`, `ragtruth`,
183
+ `tinygsm8k`, `tinymmlu`) and the four download-only sets are listed with their licences and attributions in
184
+ `src/gigai_core/datasets/NOTICES.md`, also shipped in the wheel.
185
+
186
+ ## Not in 0.1.0
187
+
188
+ - The agent loop, tools, environments and the conversation graders (`TurnLimits`, `holds_every_turn`,
189
+ `state_equals`): 0.2.0.
190
+ - The sqlite ledger, the CLI, provider adapters and the gig layer: they stay in gigai.
191
+ - Windows is not tested.
192
+
193
+ See `CHANGELOG.md` for what each release holds.
@@ -0,0 +1,165 @@
1
+ # gigai-core
2
+
3
+ The library half of GigAI: typed evaluation records, a provider seam, a local span trace, graders, paired statistics,
4
+ a release gate and one run file format. Every record is a pydantic model (strict, frozen, `extra="forbid"`), every
5
+ file is JSON Lines read through `model_validate_json` and written through `model_dump_json`, and the only runtime
6
+ dependency is `pydantic`. There is no CLI, no server and no database: `run()` takes a dataset, a provider and graders
7
+ and returns a `Run` value. Import name `gigai_core`.
8
+
9
+ ## Install
10
+
11
+ ```text
12
+ pip install gigai-core # pydantic only
13
+ pip install 'gigai-core[schema]' # + jsonschema, for graders.builtin.schema_valid
14
+ pip install 'gigai-core[parquet]' # + pyarrow, for datasets.build_release on parquet-backed sets
15
+ pip install 'gigai-core[inspect]' # + inspect-ai, agent-client-protocol
16
+ ```
17
+
18
+ Python 3.11, 3.12 or 3.13. `schema_valid` without the extra raises
19
+ `ModuleNotFoundError: schema_valid needs the schema extra: pip install 'gigai-core[schema]'`; a parquet build without
20
+ `pyarrow` raises `datasets.ParquetUnavailable`.
21
+
22
+ ## Quickstart
23
+
24
+ The examples below run in order as one script and need no API key: the provider answers from a list. A real
25
+ provider implements the same four members of `gigai_core.providers.ModelProvider` (`identity`, `capabilities`,
26
+ `invoke`, `close`); gigai binds its adapters to it.
27
+
28
+ ```python
29
+ import threading
30
+ from datetime import UTC, datetime
31
+
32
+ from gigai_core.providers import Capability, ModelRequest, ModelResult, ProviderIdentity, TokenUsage
33
+
34
+ NOW = datetime(2026, 1, 1, tzinfo=UTC)
35
+
36
+
37
+ class Scripted:
38
+ """A ModelProvider that answers from a list, in order."""
39
+
40
+ identity = ProviderIdentity(provider="scripted", endpoint="memory", adapter="readme")
41
+ capabilities: frozenset[Capability] = frozenset({"text", "system", "messages"})
42
+
43
+ def __init__(self, replies: list[str]) -> None:
44
+ self._replies = iter(replies)
45
+
46
+ def invoke(self, request: ModelRequest, *, cancel: threading.Event | None = None) -> ModelResult:
47
+ usage = TokenUsage(input_tokens=None, output_tokens=None, total_tokens=None)
48
+ return ModelResult(text=next(self._replies), finish_reason="stop", resolved_model=request.settings.model,
49
+ usage=usage, cost_status="unavailable", cost_usd=None, latency_ms=0,
50
+ started_at=NOW, completed_at=NOW)
51
+
52
+ def close(self) -> None:
53
+ pass
54
+ ```
55
+
56
+ Ask one item, grade the answer with the lifted inspect_ai `includes` scorer, and read the run:
57
+
58
+ ```python
59
+ from gigai_core import CallBudget, CallSettings, Dataset, DatasetItem, includes, run
60
+ from gigai_core.budget import Price
61
+
62
+ dataset = Dataset.of("capitals", (DatasetItem(id="fr", cluster_id="fr", prompt="Capital of France?", expected="Paris"),))
63
+ price = Price(model="some/model", prompt_usd_per_token=1e-6, completion_usd_per_token=1e-6, fetched_at=NOW, source="readme")
64
+ budget = CallBudget(max_usd=0.05, max_calls=20, prices={"some/model": price})
65
+ result = run(dataset, Scripted(["Paris, of course."]), [includes()], settings=CallSettings(model="some/model"), budget=budget)
66
+ print(result.record.spent_usd, result.values("includes")) # 0.0 {'fr': 1.0}
67
+ ```
68
+
69
+ `budget.plan` runs over every planned request before the first call, so a run that cannot fit its cap never
70
+ starts; a money cap needs a price for the model (nothing is guessed).
71
+
72
+ ### The trace
73
+
74
+ Every model call (and, in 0.2.0, every tool call) is a span. With `trace_dir` the spans of a run go to one JSONL
75
+ file, `<trace_dir>/<run_id>.jsonl`; without it they stay in memory on the samples.
76
+
77
+ ```python
78
+ from pathlib import Path
79
+
80
+ settings = CallSettings(model="some/model")
81
+ result = run(dataset, Scripted(["Paris"]), [includes()], settings=settings, budget=CallBudget(max_calls=20), trace_dir=Path("traces"))
82
+ for span in result.trace("fr"):
83
+ print(span.turn, span.kind, span.started_at) # 0 trial ..., 0 model_call ...
84
+ assert result.record.trace_path == Path("traces") / f"{result.record.run_id}.jsonl"
85
+ ```
86
+
87
+ ### Paired comparison and the gate
88
+
89
+ Two runs over the same items are compared item by item (per-cluster bootstrap intervals, exact McNemar for 0/1
90
+ metrics, Holm correction across metrics). A gate turns that into a verdict: `MinLowerBound` asks for a floor on the
91
+ candidate's interval, `NoWorseThan` for a bounded regression against the baseline.
92
+
93
+ ```python
94
+ from gigai_core import MinLowerBound, NoWorseThan, compare, gate, open_run, save_run
95
+
96
+ items = tuple(DatasetItem(id=f"c{n}", cluster_id=f"c{n}", prompt=f"Capital of country {n}?", expected="Paris") for n in range(20))
97
+ twenty = Dataset.of("twenty-capitals", items)
98
+ for name, replies in (("gem", ["Paris"] * 20), ("min", ["Paris"] * 18 + ["Lyon"] * 2)):
99
+ saved = run(twenty, Scripted(replies), [includes()], settings=settings, budget=CallBudget())
100
+ save_run(saved, Path(f"{name}.jsonl"), inputs_by_reference=False)
101
+
102
+ a, b = open_run(Path("gem.jsonl")), open_run(Path("min.jsonl"))
103
+ comparison = compare(a, b, ["includes"])
104
+ verdict = gate(candidate=b, baseline=a, rules=[MinLowerBound(metric="includes", floor=0.6), NoWorseThan(metric="includes", margin=0.05)])
105
+ print(round(comparison.metrics[0].difference, 2), verdict.status, verdict.exit_code) # -0.1 fail 1
106
+ assert not verdict.passed and verdict.failed[0].rule == NoWorseThan(metric="includes", margin=0.05)
107
+ ```
108
+
109
+ `open_run` raises `RunFileError` with the file and line number on a bad line; `save_run` is the only write path and
110
+ refuses to overwrite.
111
+
112
+ ## Modules
113
+
114
+ `from gigai_core import ...` is the façade (`gigai_core.__all__`, 41 names): `run`, `save_run`, `open_run`, `Run`,
115
+ `Dataset`, `DatasetItem`, `CallSettings`, `ModelProvider`, `RecordedProvider`, `CallBudget`, `JsonlTrace`,
116
+ `read_spans`, `compare`, `gate`, `MinLowerBound`, `NoWorseThan`, `cohen_kappa`, `judge_agreement`, `CoreModel`,
117
+ `read_labels`, `write_labels` and the 20 grader constructors. Everything else is imported from its module:
118
+
119
+ - `gigai_core.models`: `CoreModel`, the strict frozen base of every record.
120
+ - `gigai_core.values`: the shared literals (`ParseStatus`, `Outcome`, `Direction`).
121
+ - `gigai_core.canonical`: canonical JSON bytes and sha256 digests.
122
+ - `gigai_core.providers`: the seam (`ModelProvider`, `CallSettings`, `ModelRequest`, `ModelResult`, `ProviderError`).
123
+ - `gigai_core.budget`: `CallBudget`, `Price`, `budgeted`, `BudgetExceeded`.
124
+ - `gigai_core.trace`: the span records, `JsonlTrace`, `ListTrace`, `read_spans`.
125
+ - `gigai_core.dataset`: `Dataset`, `DatasetItem`, `Dataset.of`, `Dataset.from_jsonl`.
126
+ - `gigai_core.datasets`: the ten loaders, `load_slice`, `build_release`, the six shipped slices and `NOTICES.md`.
127
+ - `gigai_core.sample`, `gigai_core.score`, `gigai_core.records`: `Sample`, `Score`, `ScoreRecord`, `RunRecord`, `Prereg`, `LabelRecord`.
128
+ - `gigai_core.recorded`: `RecordedProvider`, replay from stored spans.
129
+ - `gigai_core.graders`: the `Grader` Protocol, `Judge`, `CannotGrade` (defined in `graders.protocol`) and every constructor, re-exported; submodules `builtin`, `lifted`, `judge` (`llm_judge`, `pairwise_judge`), `labels`.
130
+ - `gigai_core.run`: `run`, `Run`, `save_run`, `open_run`.
131
+ - `gigai_core.stats`: intervals, tests, corrections, kappa, alpha, pass@k, power.
132
+ - `gigai_core.comparison`, `gigai_core.gate`, `gigai_core.agreement`: `compare`, `gate`, `judge_agreement`.
133
+
134
+ ## Layering
135
+
136
+ Imports only go downward, and `tests/test_layers.py` fails the build on a violation: `models`, `values` and
137
+ `canonical` import nothing from the package; `providers` sits above them; `budget`, `trace`, `dataset` and `stats`
138
+ above `providers` (`stats` imports only `models` and `values`); then `sample`, `score`, `records`, `datasets`
139
+ (`dataset` only) and `recorded` (`providers` and `trace` only); then `graders`; then `run`; then `comparison`,
140
+ `agreement` and `gate`. No module imports `gigai`, and nothing imports `click`, `jsonschema`, `pyarrow`, `numpy`,
141
+ `yaml` or `sqlite3` at load time; `jsonschema` and `pyarrow` are imported inside the one function each that needs
142
+ them, behind the `schema` and `parquet` extras.
143
+
144
+ ## Typing
145
+
146
+ The package ships `py.typed` and passes pyright strict (`typeCheckingMode = "strict"`, Python 3.11) with no `Any`
147
+ on the public surface; sequence fields are tuples, open maps are `Mapping`, timestamps are aware datetimes, and
148
+ models are constructed by keyword.
149
+
150
+ ## Licences and datasets
151
+
152
+ `Apache-2.0 AND MIT`. The package is Apache-2.0 (`LICENSE`). `gigai_core._vendor` carries scorers and templates
153
+ from inspect_ai, autoevals and openevals under their MIT licences, each with its `LICENSE` and a `DIFF.md` of the
154
+ changes. The six `ci` dataset slices in the wheel (`contractnli`, `ifeval`, `jsonschemabench`, `ragtruth`,
155
+ `tinygsm8k`, `tinymmlu`) and the four download-only sets are listed with their licences and attributions in
156
+ `src/gigai_core/datasets/NOTICES.md`, also shipped in the wheel.
157
+
158
+ ## Not in 0.1.0
159
+
160
+ - The agent loop, tools, environments and the conversation graders (`TurnLimits`, `holds_every_turn`,
161
+ `state_equals`): 0.2.0.
162
+ - The sqlite ledger, the CLI, provider adapters and the gig layer: they stay in gigai.
163
+ - Windows is not tested.
164
+
165
+ See `CHANGELOG.md` for what each release holds.