Problem
ValidationIssue.issue_kind is typed as _IssueKind, a private enum that is not included in __all__ and not part of the public API:
# prompt_validation.py
class _IssueKind(enum.Enum): # private name
FAILED = "failed"
NON_EXACT = "non_exact"
@dataclasses.dataclass(frozen=True)
class ValidationIssue:
...
issue_kind: _IssueKind # ← typed as private enum
__all__ exports ValidationIssue but not _IssueKind:
__all__ = [
"PromptValidationLevel",
"ValidationIssue", # exported
"ValidationReport",
...
]
# _IssueKind is NOT in __all__
This forces users to import a private symbol to filter individual issues:
from langextract.prompt_validation import _IssueKind # accessing private!
report = validate_prompt_alignment(examples)
failed = [i for i in report.issues if i.issue_kind == _IssueKind.FAILED]
While ValidationReport.has_failed and ValidationReport.has_non_exact give aggregate info, users who need to categorize or filter individual issues have no public API to do so.
Proposed Fix
Rename _IssueKind → IssueKind (make it public) and add it to __all__. This is backwards-compatible for users relying on the public API.
class IssueKind(enum.Enum):
FAILED = "failed"
NON_EXACT = "non_exact"
__all__ = [
"IssueKind", # now exported
"PromptValidationLevel",
"ValidationIssue",
...
]
Users can then write clean, public-API-only code:
from langextract.prompt_validation import IssueKind
failed = [i for i in report.issues if i.issue_kind == IssueKind.FAILED]
Problem
ValidationIssue.issue_kindis typed as_IssueKind, a private enum that is not included in__all__and not part of the public API:__all__exportsValidationIssuebut not_IssueKind:This forces users to import a private symbol to filter individual issues:
While
ValidationReport.has_failedandValidationReport.has_non_exactgive aggregate info, users who need to categorize or filter individual issues have no public API to do so.Proposed Fix
Rename
_IssueKind→IssueKind(make it public) and add it to__all__. This is backwards-compatible for users relying on the public API.Users can then write clean, public-API-only code: