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

Function amounts_match

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

Check if two amount strings match within tolerance.

(gt_val: str, agent_val: str, tolerance: float)

Source from the content-addressed store, hash-verified

120
121
122def amounts_match(gt_val: str, agent_val: str, tolerance: float) -> bool:
123 """Check if two amount strings match within tolerance."""
124 gt = parse_amount(gt_val)
125 agent = parse_amount(agent_val)
126 if gt is None and agent is None:
127 return True
128 if gt is None or agent is None:
129 return False
130 return abs(gt - agent) <= tolerance
131
132
133def normalize_string(val: str | None) -> str:

Callers 4

compare_financialsFunction · 0.85
compare_field_groupFunction · 0.85
_compare_per_line_fieldsFunction · 0.85
compare_line_itemsFunction · 0.85

Calls 1

parse_amountFunction · 0.85

Tested by

no test coverage detected