Skip to content

Commit 680ddf4

Browse files
authored
[SO] Add error handling for per-field scoring (#134)
1 parent 5e8d058 commit 680ddf4

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.1.38] - 2025-11-13
11+
12+
## Added
13+
14+
- Add error handling for structure outputs per-field scoring
15+
1016
## [1.1.37] - 2025-11-10
1117

1218
## Added
@@ -380,7 +386,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
380386

381387
- Release of the Cleanlab TLM Python client.
382388

383-
[Unreleased]: https://github.com/cleanlab/cleanlab-tlm/compare/v1.1.37...HEAD
389+
[Unreleased]: https://github.com/cleanlab/cleanlab-tlm/compare/v1.1.38...HEAD
390+
[1.1.38]: https://github.com/cleanlab/cleanlab-tlm/compare/v1.1.37...v1.1.38
384391
[1.1.37]: https://github.com/cleanlab/cleanlab-tlm/compare/v1.1.36...v1.1.37
385392
[1.1.36]: https://github.com/cleanlab/cleanlab-tlm/compare/v1.1.35...v1.1.36
386393
[1.1.35]: https://github.com/cleanlab/cleanlab-tlm/compare/v1.1.34...v1.1.35

src/cleanlab_tlm/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# SPDX-License-Identifier: MIT
2-
__version__ = "1.1.37"
2+
__version__ = "1.1.38"

src/cleanlab_tlm/utils/per_field_score_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ def _get_untrustworthy_fields(
5555
per_field_score = tlm_metadata["log"]["per_field_score"]
5656
per_score_details = []
5757

58+
# handle cases where error log is returned
59+
if len(per_field_score) == 1 and isinstance(per_field_score.get("error"), str):
60+
print("Per-field score returned an error:")
61+
print(per_field_score.get("error"))
62+
return []
63+
5864
for key, value in per_field_score.items():
5965
score = value["score"]
6066
if float(score) < threshold:

0 commit comments

Comments
 (0)