llmvalidate 0.4.4__tar.gz → 0.4.6__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.
- {llmvalidate-0.4.4/src/llmvalidate.egg-info → llmvalidate-0.4.6}/PKG-INFO +1 -1
- {llmvalidate-0.4.4 → llmvalidate-0.4.6}/pyproject.toml +1 -1
- llmvalidate-0.4.6/src/llmvalidate/__init__.py +39 -0
- {llmvalidate-0.4.4 → llmvalidate-0.4.6}/src/llmvalidate/validation.py +9 -1
- {llmvalidate-0.4.4 → llmvalidate-0.4.6/src/llmvalidate.egg-info}/PKG-INFO +1 -1
- llmvalidate-0.4.4/src/llmvalidate/__init__.py +0 -12
- {llmvalidate-0.4.4 → llmvalidate-0.4.6}/LICENSE +0 -0
- {llmvalidate-0.4.4 → llmvalidate-0.4.6}/readme.md +0 -0
- {llmvalidate-0.4.4 → llmvalidate-0.4.6}/setup.cfg +0 -0
- {llmvalidate-0.4.4 → llmvalidate-0.4.6}/src/llmvalidate/structured.py +0 -0
- {llmvalidate-0.4.4 → llmvalidate-0.4.6}/src/llmvalidate/utils.py +0 -0
- {llmvalidate-0.4.4 → llmvalidate-0.4.6}/src/llmvalidate.egg-info/SOURCES.txt +0 -0
- {llmvalidate-0.4.4 → llmvalidate-0.4.6}/src/llmvalidate.egg-info/dependency_links.txt +0 -0
- {llmvalidate-0.4.4 → llmvalidate-0.4.6}/src/llmvalidate.egg-info/requires.txt +0 -0
- {llmvalidate-0.4.4 → llmvalidate-0.4.6}/src/llmvalidate.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
__version__ = "0.0.0"
|
|
2
|
+
|
|
3
|
+
# `structured` is pydantic-only and cheap, so it is imported eagerly: consumers that
|
|
4
|
+
# only need the extraction contract (StructuredResult / StructuredField) get it without
|
|
5
|
+
# pulling in the pandas/numpy scoring stack.
|
|
6
|
+
from .structured import StructuredResult, StructuredGroup, StructuredField
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"validate",
|
|
10
|
+
"bootstrap_CI",
|
|
11
|
+
"StructuredResult",
|
|
12
|
+
"StructuredGroup",
|
|
13
|
+
"StructuredField",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __getattr__(name: str):
|
|
18
|
+
"""Lazily expose the pandas-backed scorer (PEP 562).
|
|
19
|
+
|
|
20
|
+
`validation` imports pandas/numpy/tqdm, so importing this package — or the
|
|
21
|
+
lightweight `llmvalidate.structured` types — must not import it eagerly. `validate`
|
|
22
|
+
and `bootstrap_CI` are resolved on first access, loading `validation` (and pandas)
|
|
23
|
+
only then, and cached into the module namespace so later access skips this hook.
|
|
24
|
+
`from llmvalidate import validate`, `from llmvalidate.validation import validate`,
|
|
25
|
+
and `import llmvalidate.validation` all keep working. See ONC-12308.
|
|
26
|
+
"""
|
|
27
|
+
if name in ("validate", "bootstrap_CI"):
|
|
28
|
+
from . import validation
|
|
29
|
+
attr = getattr(validation, name)
|
|
30
|
+
globals()[name] = attr # cache so repeated access doesn't re-enter __getattr__
|
|
31
|
+
return attr
|
|
32
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def __dir__() -> list[str]:
|
|
36
|
+
"""Include the lazily-exposed entry points in `dir()` so introspection (and IDEs)
|
|
37
|
+
still list `validate` / `bootstrap_CI` before first access — PEP 562 `__getattr__`
|
|
38
|
+
alone would hide them, unlike the previous eager imports."""
|
|
39
|
+
return sorted(set(__all__) | set(globals()))
|
|
@@ -16,7 +16,15 @@ def compare_results_binary(expected, actual):
|
|
|
16
16
|
if (is_expected_undefined(expected)):
|
|
17
17
|
return {'TP': None, 'TN': None, 'FP': None, 'FN': None}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
# Fully-labelled binary columns get re-inferred to numpy bool dtype by convert_lists,
|
|
20
|
+
# so iterrows yields numpy.bool_ scalars; normalize those to native bool because the
|
|
21
|
+
# identity checks below (is True / is False) fail for numpy.bool_ (ONC-12248).
|
|
22
|
+
if isinstance(expected, np.bool_):
|
|
23
|
+
expected = bool(expected)
|
|
24
|
+
if isinstance(actual, np.bool_):
|
|
25
|
+
actual = bool(actual)
|
|
26
|
+
|
|
27
|
+
TP = 1 if expected is True and actual is True else 0
|
|
20
28
|
FN = 1 if expected is True and actual is not True else 0
|
|
21
29
|
TN = 1 if expected is False and actual is False else 0
|
|
22
30
|
FP = 1 if expected is False and actual is not False else 0
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
__version__ = "0.0.0"
|
|
2
|
-
|
|
3
|
-
from .validation import validate, bootstrap_CI
|
|
4
|
-
from .structured import StructuredResult, StructuredGroup, StructuredField
|
|
5
|
-
|
|
6
|
-
__all__ = [
|
|
7
|
-
"validate",
|
|
8
|
-
"bootstrap_CI",
|
|
9
|
-
"StructuredResult",
|
|
10
|
-
"StructuredGroup",
|
|
11
|
-
"StructuredField"
|
|
12
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|