Skip to content

Commit 53dc5d2

Browse files
committed
docs(eval): clarify _args_match comments per review
Address review nits on search_tool _args_match: - reword _normalize_str_list comment: dropping non-string entries prevents a crash, it does not force a mismatch (surviving strings still compare) - note that object_types is compared case-sensitively on purpose (controlled ObjectType StrEnum values emitted verbatim) No behavior change. keywords/object_types are declared list[str] in the search_objects schema, so string-collapse false-negatives cannot occur. JIRA: TRIVIAL risk: nonprod
1 parent f847679 commit 53dc5d2

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • packages/gooddata-eval/src/gooddata_eval/core/evaluators

packages/gooddata-eval/src/gooddata_eval/core/evaluators/search_tool.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66

77

88
def _normalize_str_list(value: object, *, lowercase: bool = False) -> list[str]:
9-
# Arguments come from raw model-emitted JSON, so a malformed tool call may
10-
# contain non-string entries. Drop them defensively so bad input scores as a
11-
# mismatch instead of raising and aborting the whole evaluation.
9+
# Arguments come from raw model-emitted JSON. The search_objects schema
10+
# declares keywords/object_types as list[str], but a malformed tool call may
11+
# send a non-list or non-string entries. Drop the offending entries defensively
12+
# so bad input can't raise (.lower()/sorted() on a non-str) and abort the whole
13+
# evaluation run; a non-list collapses to [] and the surviving strings are
14+
# still compared normally.
1215
if not isinstance(value, list):
1316
return []
1417
items = [item for item in value if isinstance(item, str)]
@@ -23,6 +26,9 @@ def _args_match(actual_args: dict, expected_args: dict) -> bool:
2326
expected_kw = _normalize_str_list(expected_args.get("keywords"), lowercase=True)
2427
if actual_kw != expected_kw:
2528
return False
29+
# object_types is compared case-sensitively (no lowercase=True): they are
30+
# controlled ObjectType StrEnum values the model emits verbatim ("metric",
31+
# "dashboard"), so a case mismatch is a genuine error, not a formatting quirk.
2632
return _normalize_str_list(actual_args.get("object_types")) == _normalize_str_list(
2733
expected_args.get("object_types")
2834
)

0 commit comments

Comments
 (0)