aid-runtime-python 0.1.159__tar.gz → 0.1.160__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 (126) hide show
  1. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/PKG-INFO +1 -1
  2. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/pyproject.toml +1 -1
  3. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/__init__.py +5 -1
  4. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/errors.py +11 -0
  5. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/evals/__init__.py +2 -1
  6. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/evals/dataset.py +38 -2
  7. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime_python.egg-info/PKG-INFO +1 -1
  8. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_dataset.py +35 -1
  9. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/README.md +0 -0
  10. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/setup.cfg +0 -0
  11. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/agents/__init__.py +0 -0
  12. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/agents/chat_model.py +0 -0
  13. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/agents/deep_agents.py +0 -0
  14. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/agents/engine.py +0 -0
  15. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/agents/guardrails.py +0 -0
  16. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/agents/ir.py +0 -0
  17. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/agents/loop.py +0 -0
  18. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/agents/managed.py +0 -0
  19. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/agents/memory.py +0 -0
  20. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/agents/policy.py +0 -0
  21. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/agents/state.py +0 -0
  22. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/cache.py +0 -0
  23. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/concurrency.py +0 -0
  24. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/control.py +0 -0
  25. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/cost.py +0 -0
  26. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/decisions.py +0 -0
  27. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/evals/agent_runner.py +0 -0
  28. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/evals/gate.py +0 -0
  29. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/evals/metrics.py +0 -0
  30. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/evals/predicate.py +0 -0
  31. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/evals/runner.py +0 -0
  32. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/evals/trajectory.py +0 -0
  33. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/gateway.py +0 -0
  34. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/local_trace.py +0 -0
  35. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/metrics.py +0 -0
  36. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/pipeline.py +0 -0
  37. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/prompts.py +0 -0
  38. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/providers/__init__.py +0 -0
  39. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/providers/anthropic.py +0 -0
  40. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/providers/base.py +0 -0
  41. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/providers/bedrock.py +0 -0
  42. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/providers/fake.py +0 -0
  43. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/providers/gemini.py +0 -0
  44. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/providers/gemini_wire.py +0 -0
  45. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/providers/http.py +0 -0
  46. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/providers/recorded.py +0 -0
  47. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/providers/vertex.py +0 -0
  48. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/py.typed +0 -0
  49. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/__init__.py +0 -0
  50. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/chunking.py +0 -0
  51. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/citations.py +0 -0
  52. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/connectors.py +0 -0
  53. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/embedding.py +0 -0
  54. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/filters.py +0 -0
  55. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/gate.py +0 -0
  56. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/hybrid.py +0 -0
  57. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/knowledge_base.py +0 -0
  58. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/metrics.py +0 -0
  59. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/pgvector.py +0 -0
  60. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/rerank.py +0 -0
  61. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/retriever.py +0 -0
  62. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/stores.py +0 -0
  63. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/retrieval/types.py +0 -0
  64. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/steps.py +0 -0
  65. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/structured.py +0 -0
  66. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/telemetry.py +0 -0
  67. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/tools.py +0 -0
  68. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/tracing.py +0 -0
  69. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime/types.py +0 -0
  70. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime_python.egg-info/SOURCES.txt +0 -0
  71. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime_python.egg-info/dependency_links.txt +0 -0
  72. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime_python.egg-info/requires.txt +0 -0
  73. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/src/aid_runtime_python.egg-info/top_level.txt +0 -0
  74. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_agent_eval_runner.py +0 -0
  75. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_agents_budget.py +0 -0
  76. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_agents_deep_agents.py +0 -0
  77. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_agents_hitl.py +0 -0
  78. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_agents_loop.py +0 -0
  79. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_agents_memory.py +0 -0
  80. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_anthropic_provider.py +0 -0
  81. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_bedrock_provider.py +0 -0
  82. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_cache.py +0 -0
  83. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_concurrency.py +0 -0
  84. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_control.py +0 -0
  85. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_cost.py +0 -0
  86. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_decisions.py +0 -0
  87. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_evals.py +0 -0
  88. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_evals_assert_gate.py +0 -0
  89. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_evals_budgets.py +0 -0
  90. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_evals_decision.py +0 -0
  91. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_evals_gate.py +0 -0
  92. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_evals_predicate.py +0 -0
  93. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_evals_trajectory.py +0 -0
  94. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_gateway.py +0 -0
  95. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_gemini_provider.py +0 -0
  96. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_guardrails.py +0 -0
  97. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_guardrails_managed.py +0 -0
  98. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_guardrails_model_armor.py +0 -0
  99. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_http_provider.py +0 -0
  100. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_local_trace.py +0 -0
  101. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_metrics.py +0 -0
  102. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_package.py +0 -0
  103. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_pipeline.py +0 -0
  104. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_prompts.py +0 -0
  105. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_recorded_provider.py +0 -0
  106. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_retrieval_chunking.py +0 -0
  107. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_retrieval_citations.py +0 -0
  108. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_retrieval_connectors.py +0 -0
  109. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_retrieval_embedding.py +0 -0
  110. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_retrieval_filters.py +0 -0
  111. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_retrieval_gate.py +0 -0
  112. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_retrieval_hybrid.py +0 -0
  113. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_retrieval_knowledge_base.py +0 -0
  114. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_retrieval_metrics.py +0 -0
  115. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_retrieval_rerank.py +0 -0
  116. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_retrieval_stores.py +0 -0
  117. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_retrieval_types.py +0 -0
  118. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_steps.py +0 -0
  119. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_streaming.py +0 -0
  120. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_structured.py +0 -0
  121. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_telemetry.py +0 -0
  122. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_tool_permissions.py +0 -0
  123. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_tools.py +0 -0
  124. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_tracing.py +0 -0
  125. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_types.py +0 -0
  126. {aid_runtime_python-0.1.159 → aid_runtime_python-0.1.160}/tests/test_vertex_provider.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aid-runtime-python
3
- Version: 0.1.159
3
+ Version: 0.1.160
4
4
  Summary: The AID Framework Python runtime: model gateway with pinning and cost budgets, prompt registry, tool executor, OTel GenAI tracing, plain-async pipeline, and an eval harness that gates on statistical regression against a stored baseline.
5
5
  Author: The AID Framework authors
6
6
  License-Expression: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "aid-runtime-python"
7
- version = "0.1.159"
7
+ version = "0.1.160"
8
8
  description = "The AID Framework Python runtime: model gateway with pinning and cost budgets, prompt registry, tool executor, OTel GenAI tracing, plain-async pipeline, and an eval harness that gates on statistical regression against a stored baseline."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -112,6 +112,7 @@ from aid_runtime.errors import (
112
112
  ToolNotFoundError,
113
113
  ToolPermissionError,
114
114
  UnknownModelAliasError,
115
+ UnreviewedCasesError,
115
116
  )
116
117
  from aid_runtime.evals import (
117
118
  AgentEvalRunner,
@@ -152,6 +153,7 @@ from aid_runtime.evals import (
152
153
  gateway_judge,
153
154
  metric_names,
154
155
  normalize,
156
+ require_reviewed,
155
157
  run_evaluation,
156
158
  z_critical,
157
159
  )
@@ -347,7 +349,7 @@ from aid_runtime.types import (
347
349
  )
348
350
 
349
351
  #: Kept in sync with ``pyproject.toml`` by a test, so the two cannot drift.
350
- __version__ = "0.1.159"
352
+ __version__ = "0.1.160"
351
353
 
352
354
  __all__ = [
353
355
  "AGENT_LABEL",
@@ -574,6 +576,7 @@ __all__ = [
574
576
  "Transcript",
575
577
  "TranscriptEntry",
576
578
  "UnknownModelAliasError",
579
+ "UnreviewedCasesError",
577
580
  "VectorStore",
578
581
  "VectorStoreSpec",
579
582
  "VertexProvider",
@@ -634,6 +637,7 @@ __all__ = [
634
637
  "record_usage",
635
638
  "reduce_step",
636
639
  "repair_prompt",
640
+ "require_reviewed",
637
641
  "reranker_for",
638
642
  "resolve_source",
639
643
  "resolve_uri",
@@ -35,6 +35,7 @@ __all__ = [
35
35
  "ToolExecutionError",
36
36
  "ToolNotFoundError",
37
37
  "UnknownModelAliasError",
38
+ "UnreviewedCasesError",
38
39
  ]
39
40
 
40
41
 
@@ -335,3 +336,13 @@ class GateConfigurationError(EvalError):
335
336
  itself produced by a model. Gating on one source of non-determinism using
336
337
  another is not a gate.
337
338
  """
339
+
340
+
341
+ class UnreviewedCasesError(GateConfigurationError):
342
+ """A CI-gating eval was handed a dataset that still carries unreviewed cases.
343
+
344
+ ``aid trace export`` writes every case it produces tagged ``unreviewed``, because
345
+ a machine turned captured traffic into a case and nobody has read it. That is the
346
+ raw material of the improvement loop, not evidence that a change is safe, so a
347
+ ``gate.ci`` eval refuses it rather than letting unread data approve a release.
348
+ """
@@ -3,7 +3,7 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from aid_runtime.evals.agent_runner import AgentEvalRunner, ApprovalPolicy
6
- from aid_runtime.evals.dataset import Dataset, EvalCase
6
+ from aid_runtime.evals.dataset import Dataset, EvalCase, require_reviewed
7
7
  from aid_runtime.evals.gate import (
8
8
  BaselineGate,
9
9
  EvalBaseline,
@@ -89,6 +89,7 @@ __all__ = [
89
89
  "gateway_judge",
90
90
  "metric_names",
91
91
  "normalize",
92
+ "require_reviewed",
92
93
  "run_evaluation",
93
94
  "z_critical",
94
95
  ]
@@ -12,9 +12,17 @@ from pathlib import Path
12
12
 
13
13
  from pydantic import BaseModel, ConfigDict, Field, field_validator
14
14
 
15
- from aid_runtime.errors import EvalError
15
+ from aid_runtime.errors import EvalError, UnreviewedCasesError
16
16
 
17
- __all__ = ["Dataset", "EvalCase"]
17
+ __all__ = ["UNREVIEWED_TAG", "Dataset", "EvalCase", "require_reviewed"]
18
+
19
+ UNREVIEWED_TAG = "unreviewed"
20
+ """The tag ``aid trace export`` puts on every case it writes.
21
+
22
+ A case carrying it was produced by a machine from captured traffic, so no human has
23
+ read it. It is a legitimate case -- the raw material of the improvement loop -- but it
24
+ is not evidence that a change is safe.
25
+ """
18
26
 
19
27
 
20
28
  class EvalCase(BaseModel):
@@ -110,3 +118,31 @@ class Dataset(BaseModel):
110
118
  if not case.get("approvals"):
111
119
  case.pop("approvals", None)
112
120
  return payload
121
+
122
+
123
+ def require_reviewed(dataset: Dataset, *, eval_id: str) -> Dataset:
124
+ """Refuse a dataset that still carries cases no human has reviewed.
125
+
126
+ Returns the dataset so a generated CI-gating eval can wrap its loader:
127
+ ``require_reviewed(load_dataset(), eval_id=EVAL_ID)``. An eval that does not gate
128
+ CI is left alone -- unreviewed cases are the point of the improvement loop.
129
+
130
+ The refusal is the product. A ``gate.ci`` eval decides whether a change ships, so a
131
+ case exported from traffic and never read would let unread data approve a release.
132
+ Dropping those cases silently would be worse than refusing: the dataset would look
133
+ complete while part of it never ran. The message names the cases and the fix, because
134
+ the fix is a human reading them -- nothing in the runtime can clear the tag for them.
135
+ """
136
+ unreviewed = dataset.by_tag(UNREVIEWED_TAG)
137
+ if not unreviewed:
138
+ return dataset
139
+ named = ", ".join(case.id for case in unreviewed[:5])
140
+ remainder = "" if len(unreviewed) <= 5 else f" and {len(unreviewed) - 5} more"
141
+ raise UnreviewedCasesError(
142
+ f"eval {eval_id!r} gates CI but its dataset {dataset.name!r} ({dataset.version}) "
143
+ f"carries {len(unreviewed)} case(s) tagged {UNREVIEWED_TAG!r}: {named}{remainder}. "
144
+ f"A case tagged {UNREVIEWED_TAG!r} came from `aid trace export` and no human has "
145
+ f"read it, so it cannot decide whether a change ships. Review each case, then drop "
146
+ f"{UNREVIEWED_TAG!r} from its tags; or point this eval at a dataset you curated. "
147
+ f"An eval with `gate.ci: false` may use an unreviewed dataset as it is."
148
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aid-runtime-python
3
- Version: 0.1.159
3
+ Version: 0.1.160
4
4
  Summary: The AID Framework Python runtime: model gateway with pinning and cost budgets, prompt registry, tool executor, OTel GenAI tracing, plain-async pipeline, and an eval harness that gates on statistical regression against a stored baseline.
5
5
  Author: The AID Framework authors
6
6
  License-Expression: Apache-2.0
@@ -13,7 +13,7 @@ from pathlib import Path
13
13
  import pytest
14
14
  from pydantic import ValidationError
15
15
 
16
- from aid_runtime import Dataset, EvalCase, EvalError
16
+ from aid_runtime import Dataset, EvalCase, EvalError, UnreviewedCasesError, require_reviewed
17
17
 
18
18
 
19
19
  def _dataset(*, tags: tuple[str, ...] = ()) -> Dataset:
@@ -119,3 +119,37 @@ def test_a_dataset_round_trips_through_a_path(tmp_path: Path) -> None:
119
119
 
120
120
  assert Dataset.from_path(path) == dataset
121
121
  assert Dataset.from_path(str(path)) == dataset
122
+
123
+
124
+ def test_require_reviewed_passes_a_dataset_with_no_unreviewed_case() -> None:
125
+ dataset = _dataset(tags=("curated",))
126
+
127
+ assert require_reviewed(dataset, eval_id="refunds") is dataset
128
+
129
+
130
+ def test_require_reviewed_refuses_a_dataset_exported_from_traces() -> None:
131
+ """The tag stops being a comment: an unreviewed case cannot approve a release."""
132
+ dataset = _dataset(tags=("trace-export", "unreviewed"))
133
+
134
+ with pytest.raises(UnreviewedCasesError) as refusal:
135
+ require_reviewed(dataset, eval_id="refunds")
136
+
137
+ message = str(refusal.value)
138
+ assert "'refunds'" in message
139
+ assert "'d'" in message
140
+ assert "1 case(s) tagged 'unreviewed': a" in message
141
+ assert "gate.ci: false" in message
142
+
143
+
144
+ def test_require_reviewed_names_at_most_five_cases_and_counts_the_rest() -> None:
145
+ """A dataset exported from a busy service has thousands; the message stays readable."""
146
+ cases = tuple(EvalCase(id=f"c{index}", input="Q", tags=("unreviewed",)) for index in range(8))
147
+ dataset = Dataset(name="d", version="1", cases=cases)
148
+
149
+ with pytest.raises(UnreviewedCasesError) as refusal:
150
+ require_reviewed(dataset, eval_id="refunds")
151
+
152
+ message = str(refusal.value)
153
+ assert "8 case(s)" in message
154
+ assert "c0, c1, c2, c3, c4 and 3 more" in message
155
+ assert "c5" not in message