MCPcopy Create free account
hub / github.com/google/adk-samples / compare_header

Function compare_header

python/agents/invoice-processing/eval/eval.py:284–305  ·  view source on GitHub ↗

Compare invoice header fields (number, date).

(gt: dict, agent: dict)

Source from the content-addressed store, hash-verified

282
283
284def compare_header(gt: dict, agent: dict) -> dict:
285 """Compare invoice header fields (number, date)."""
286 gt_details = gt.get("Invoice Details") or {}
287 agent_details = agent.get("Invoice Details") or {}
288
289 results = {}
290 all_match = True
291
292 for field in ["Vendor Invoice", "Invoice Date"]:
293 gt_val = str(gt_details.get(field, "")).strip()
294 agent_val = str(agent_details.get(field, "")).strip()
295 match = normalize_string(gt_val) == normalize_string(agent_val)
296 if not match:
297 all_match = False
298 results[field] = {
299 "ground_truth": gt_val,
300 "agent": agent_val,
301 "match": match,
302 }
303
304 results["all_match"] = all_match
305 return results
306
307
308def compare_field_group(

Callers 1

_evaluate_legacyFunction · 0.85

Calls 2

normalize_stringFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected