Skip to content

Commit cd257b7

Browse files
error to var
1 parent 7ee6156 commit cd257b7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

toolium/utils/ai_utils/text_analysis.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,11 @@ def assert_text_criteria(text_input, text_criteria, threshold, model_name=None,
103103
analysis = json.loads(get_text_criteria_analysis(text_input, text_criteria, model_name, azure, **kwargs))
104104
overall_match = analysis.get("overall_match", 0.0)
105105
if overall_match < threshold:
106-
logger.error(f"Text criteria analysis failed: overall match {overall_match} "
107-
f"is below threshold {threshold}\n"
108-
f"Failed features: {analysis.get('features', [])}")
109-
raise AssertionError(f"Text criteria analysis failed: overall match {overall_match} "
110-
f"is below threshold {threshold}\n"
111-
f"Failed features: {analysis.get('features', [])}")
106+
error = (f"Text criteria analysis failed: overall match {overall_match} "
107+
f"is below threshold {threshold}\n"
108+
f"Failed features: {analysis.get('features', [])}")
109+
logger.error(error)
110+
raise AssertionError(error)
112111
logger.info(f"Text criteria analysis passed: overall match {overall_match} "
113112
f"is above threshold {threshold}."
114113
f"Low scored features: {analysis.get('features', [])}")

0 commit comments

Comments
 (0)